drm/amd/powerplay: fix bug dpm level unexpectly be reset to auto.
authorRex Zhu <Rex.Zhu@amd.com>
Fri, 23 Dec 2016 08:08:12 +0000 (16:08 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 27 Jan 2017 16:12:53 +0000 (11:12 -0500)
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c

index ec36c0e28388105e75e294de99300c8dac5a6218..e04216ec7ee15b51043045064455598696655d45 100644 (file)
 int pem_task_update_allowed_performance_levels(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data)
 {
 
+       if (eventmgr == NULL || eventmgr->hwmgr == NULL)
+               return -EINVAL;
+
        if (pem_is_hw_access_blocked(eventmgr))
                return 0;
 
-       phm_force_dpm_levels(eventmgr->hwmgr, AMD_DPM_FORCED_LEVEL_AUTO);
+       phm_force_dpm_levels(eventmgr->hwmgr, eventmgr->hwmgr->dpm_level);
 
        return 0;
 }
index d66febe1aa6097e994cebbaa5207efeeaaba7bb3..bd4ca681e2605b0b7c3e380489aad8a5c58c5d02 100644 (file)
@@ -69,7 +69,7 @@ int hwmgr_init(struct amd_pp_init *pp_init, struct pp_instance *handle)
        hwmgr->usec_timeout = AMD_MAX_USEC_TIMEOUT;
        hwmgr->power_source = PP_PowerSource_AC;
        hwmgr->pp_table_version = PP_TABLE_V1;
-
+       hwmgr->dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;
        hwmgr_init_default_caps(hwmgr);
        hwmgr_set_user_specify_caps(hwmgr);