Skip to contentSkip to conversation

drm/amd/pp: Restore power profile mode in auto dpm level on smu7

PATCH In review Rex Zhu 2 participants 2 messages Feb 8, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH v2 9/10 drm/amd/pp: Restore power profile mode in auto dpm level on smu7

v2: cancel or wait current work finish before restart auto wattman.

Disable auto wattman feature in manual mode if feature is enabled

Change-Id: I4361d16df27d2666dd978c3e33e05c020d65fe6a

---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +19 -0
index b89b530..937b30a 100644
@@ -82,6 +82,7 @@
 #define TCLK                        (PCIE_BUS_CLK / 10)
 #define WATTMAM_SAMPLE_PERIOD msecs_to_jiffies(1000)
 
+static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint32_t size);
 static const struct profile_mode_setting smu7_profiling[5] =
 					{{1, 0, 100, 30, 1, 0, 100, 10},
 					 {1, 10, 0, 30, 0, 0, 0, 0},
@@ -2792,6 +2793,19 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
 		ret = smu7_force_dpm_lowest(hwmgr);
 		break;
 	case AMD_DPM_FORCED_LEVEL_AUTO:
+		if (hwmgr->autowattman_enabled) {
+			if (hwmgr->hwmgr_func->start_auto_wattman != NULL) {
+				if (!cancel_delayed_work_sync(&hwmgr->wattman_update_work))
+					hwmgr->hwmgr_func->start_auto_wattman(hwmgr, true);
+			}
+		} else {
+			if (hwmgr->default_power_profile_mode != hwmgr->power_profile_mode) {
+				long mode = hwmgr->default_power_profile_mode;
+
+				smu7_set_power_profile_mode(hwmgr, &mode, 0);
+			}
+
+		}
 		ret = smu7_unforce_dpm_levels(hwmgr);
 		break;
 	case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD:
@@ -2806,6 +2820,11 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
 		smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
 		break;
 	case AMD_DPM_FORCED_LEVEL_MANUAL:
+		if (hwmgr->autowattman_enabled) {
+			if (hwmgr->hwmgr_func->start_auto_wattman != NULL)
+				hwmgr->hwmgr_func->start_auto_wattman(hwmgr, false);
+		}
+		break;
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518088778-4671-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 4 lines · Rex Zhu

v2: cancel or wait current work finish before restart auto wattman.

Disable auto wattman feature in manual mode if feature is enabled

Quoted 53 lines

Change-Id: I4361d16df27d2666dd978c3e33e05c020d65fe6a

---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +19 -1
index b89b530..937b30a 100644
@@ -82,6 +82,7 @@
 #define TCLK                        (PCIE_BUS_CLK / 10)
 #define WATTMAM_SAMPLE_PERIOD msecs_to_jiffies(1000)
 
+static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint32_t size);
 static const struct profile_mode_setting smu7_profiling[5] =
                                        {{1, 0, 100, 30, 1, 0, 100, 10},
                                         {1, 10, 0, 30, 0, 0, 0, 0},
@@ -2792,6 +2793,19 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
                ret = smu7_force_dpm_lowest(hwmgr);
                break;
        case AMD_DPM_FORCED_LEVEL_AUTO:
+               if (hwmgr->autowattman_enabled) {
+                       if (hwmgr->hwmgr_func->start_auto_wattman != NULL) {
+                               if (!cancel_delayed_work_sync(&hwmgr->wattman_update_work))
+                                       hwmgr->hwmgr_func->start_auto_wattman(hwmgr, true);
+                       }
+               } else {
+                       if (hwmgr->default_power_profile_mode != hwmgr->power_profile_mode) {
+                               long mode = hwmgr->default_power_profile_mode;
+
+                               smu7_set_power_profile_mode(hwmgr, &mode, 0);
+                       }
+
+               }
                ret = smu7_unforce_dpm_levels(hwmgr);
                break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD:
@@ -2806,6 +2820,11 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
                smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
                break;
        case AMD_DPM_FORCED_LEVEL_MANUAL:
+               if (hwmgr->autowattman_enabled) {
+                       if (hwmgr->hwmgr_func->start_auto_wattman != NULL)
+                               hwmgr->hwmgr_func->start_auto_wattman(hwmgr, false);
+               }
+               break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx