OSDN Git Service

drm/amd/pp: Set Max clock level to display by default
authorRex Zhu <rex.zhu@amd.com>
Tue, 17 Jul 2018 10:31:50 +0000 (18:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Sep 2018 06:39:28 +0000 (08:39 +0200)
[ Upstream commit 97e8f102f5a9123d30258e196c6c1ea29cf52e83 ]

avoid the error in dmesg:
[drm:dm_pp_get_static_clocks]
*ERROR* DM_PPLIB: invalid powerlevel state: 0!

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/powerplay/amd_powerplay.c

index d567be4..b487774 100644 (file)
@@ -1020,7 +1020,7 @@ static int pp_get_display_power_level(void *handle,
 static int pp_get_current_clocks(void *handle,
                struct amd_pp_clock_info *clocks)
 {
-       struct amd_pp_simple_clock_info simple_clocks;
+       struct amd_pp_simple_clock_info simple_clocks = { 0 };
        struct pp_clock_info hw_clocks;
        struct pp_hwmgr *hwmgr = handle;
        int ret = 0;
@@ -1056,7 +1056,10 @@ static int pp_get_current_clocks(void *handle,
        clocks->max_engine_clock_in_sr = hw_clocks.max_eng_clk;
        clocks->min_engine_clock_in_sr = hw_clocks.min_eng_clk;
 
-       clocks->max_clocks_state = simple_clocks.level;
+       if (simple_clocks.level == 0)
+               clocks->max_clocks_state = PP_DAL_POWERLEVEL_7;
+       else
+               clocks->max_clocks_state = simple_clocks.level;
 
        if (0 == phm_get_current_shallow_sleep_clocks(hwmgr, &hwmgr->current_ps->hardware, &hw_clocks)) {
                clocks->max_engine_clock_in_sr = hw_clocks.max_eng_clk;
@@ -1159,6 +1162,8 @@ static int pp_get_display_mode_validation_clocks(void *handle,
        if (!hwmgr || !hwmgr->pm_en ||!clocks)
                return -EINVAL;
 
+       clocks->level = PP_DAL_POWERLEVEL_7;
+
        mutex_lock(&hwmgr->smu_lock);
 
        if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_DynamicPatchPowerState))