diff options
author | Kevin Wang <kevin1.wang@amd.com> | 2019-06-04 11:38:42 +0200 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-06-22 01:59:31 +0200 |
commit | 576851345b677b28617217f5d97920f62eab471e (patch) | |
tree | 04eee9ca6e649c47fbf213d10ddbcea72ef0d5f8 /drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | |
parent | drm/amd/powerplay: remove smu mutex lock in smu_hw_init (diff) | |
download | linux-576851345b677b28617217f5d97920f62eab471e.tar.xz linux-576851345b677b28617217f5d97920f62eab471e.zip |
drm/amd/powerplay: remove smu callback funciton get_mclk(get_sclk)
remove smu callback: get_mclk, get_sclk.
because the function smu_get_dpm_freq_range has the same function.
Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/amdgpu_smu.c')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c index 3cb71668e523..4d7aeee91bc8 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c @@ -135,30 +135,52 @@ int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, if (!min && !max) return -EINVAL; + switch (clk_type) { + case SMU_UCLK: + if (!smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UCLK_BIT)) { + pr_warn("uclk dpm is not enabled\n"); + return 0; + } + break; + case SMU_GFXCLK: + if (!smu_feature_is_enabled(smu, SMU_FEATURE_DPM_GFXCLK_BIT)) { + pr_warn("gfxclk dpm is not enabled\n"); + return 0; + } + break; + default: + break; + } + + mutex_lock(&smu->mutex); clk_id = smu_clk_get_index(smu, clk_type); - if (clk_id < 0) - return clk_id; + if (clk_id < 0) { + ret = -EINVAL; + goto failed; + } param = (clk_id & 0xffff) << 16; if (max) { ret = smu_send_smc_msg_with_param(smu, SMU_MSG_GetMaxDpmFreq, param); if (ret) - return ret; + goto failed; ret = smu_read_smc_arg(smu, max); if (ret) - return ret; + goto failed; } if (min) { ret = smu_send_smc_msg_with_param(smu, SMU_MSG_GetMinDpmFreq, param); if (ret) - return ret; + goto failed; ret = smu_read_smc_arg(smu, min); if (ret) - return ret; + goto failed; } +failed: + mutex_unlock(&smu->mutex); return ret; } |