diff options
author | Mario Limonciello <mario.limonciello@amd.com> | 2021-10-29 16:09:26 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-11-03 12:22:07 -0400 |
commit | a750559132c64f3fa40418876bc43881e169a8f0 (patch) | |
tree | eb2b40948022c4324849864e1f63075d8a56d858 /drivers/gpu/drm/amd/pm/powerplay | |
parent | a035be8a05bf7b9591cff1be4e9175bd5edab35a (diff) |
drm/amdgpu/pm: Don't show pp_power_profile_mode for unsupported devices
For ASICs not supporting power profile mode, don't show the attribute.
Verify that the function has been implemented by the subsystem.
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/powerplay')
-rw-r--r-- | drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c index 79e565121206..8d796ed3b7d1 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c @@ -877,16 +877,11 @@ static int pp_get_power_profile_mode(void *handle, char *buf) struct pp_hwmgr *hwmgr = handle; int ret; - if (!hwmgr || !hwmgr->pm_en) + if (!hwmgr || !hwmgr->pm_en || !hwmgr->hwmgr_func->get_power_profile_mode) return -EOPNOTSUPP; if (!buf) return -EINVAL; - if (hwmgr->hwmgr_func->get_power_profile_mode == NULL) { - pr_info_ratelimited("%s was not implemented.\n", __func__); - return snprintf(buf, PAGE_SIZE, "\n"); - } - mutex_lock(&hwmgr->smu_lock); ret = hwmgr->hwmgr_func->get_power_profile_mode(hwmgr, buf); mutex_unlock(&hwmgr->smu_lock); @@ -898,13 +893,8 @@ static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size) struct pp_hwmgr *hwmgr = handle; int ret = -EOPNOTSUPP; - if (!hwmgr || !hwmgr->pm_en) - return ret; - - if (hwmgr->hwmgr_func->set_power_profile_mode == NULL) { - pr_info_ratelimited("%s was not implemented.\n", __func__); + if (!hwmgr || !hwmgr->pm_en || !hwmgr->hwmgr_func->set_power_profile_mode) return ret; - } if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) { pr_debug("power profile setting is for manual dpm mode only.\n"); |