drm/amd/powerplay/vega20: correct the hwmon interface ppt limit output
authorEvan Quan <evan.quan@amd.com>
Mon, 17 Sep 2018 07:05:54 +0000 (15:05 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 9 Oct 2018 21:45:57 +0000 (16:45 -0500)
The ppt limit read out by hwmon interface is always 0.
Correct this hwmon interface output.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if.h

index 2a554f9edcdaf293ea3e129116f55764aeff719e..2926313574276bd1400a24b55836e2031c739c60 100644 (file)
@@ -1544,6 +1544,14 @@ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
                        "[EnableDPMTasks] Failed to populate umdpstate clocks!",
                        return result);
 
+       result = smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_GetPptLimit,
+                       POWER_SOURCE_AC << 16);
+       PP_ASSERT_WITH_CODE(!result,
+                       "[GetPptLimit] get default PPT limit failed!",
+                       return result);
+       hwmgr->power_limit =
+               hwmgr->default_power_limit = smum_get_argument(hwmgr);
+
        return 0;
 }
 
index 71191deb4e76dbcf9654214447954a28d791f14d..a002021414ff3bf1291d035c0efb4036f4677046 100644 (file)
@@ -268,6 +268,12 @@ typedef enum {
   PPCLK_COUNT,
 } PPCLK_e;
 
+typedef enum {
+  POWER_SOURCE_AC,
+  POWER_SOURCE_DC,
+  POWER_SOURCE_COUNT,
+} POWER_SOURCE_e;
+
 typedef enum {
   VOLTAGE_MODE_AVFS = 0,
   VOLTAGE_MODE_AVFS_SS,