drm/amd/pm: Return auto perf level, if unsupported
authorLijo Lazar <lijo.lazar@amd.com>
Tue, 24 May 2022 12:05:55 +0000 (17:35 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 26 May 2022 18:56:33 +0000 (14:56 -0400)
When powerplay is not enabled, return AUTO as default level.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/amdgpu_dpm.c

index 5472f9936febc6ba17dccdc07844b79a7cdb1176..d1bf073adf54392510b7e16b60c1885578427243 100644 (file)
@@ -770,6 +770,9 @@ enum amd_dpm_forced_level amdgpu_dpm_get_performance_level(struct amdgpu_device
        const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
        enum amd_dpm_forced_level level;
 
+       if (!pp_funcs)
+               return AMD_DPM_FORCED_LEVEL_AUTO;
+
        mutex_lock(&adev->pm.mutex);
        if (pp_funcs->get_performance_level)
                level = pp_funcs->get_performance_level(adev->powerplay.pp_handle);