summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
diff options
context:
space:
mode:
authorLikun Gao2019-02-01 06:22:33 +0100
committerAlex Deucher2019-03-19 21:04:02 +0100
commit07740adcbcd326060e142f6af674a036a5106c6f (patch)
tree06a727492fb3cf3f370e15598a53f9f4b2bf7f6d /drivers/gpu/drm/amd/powerplay/smu_v11_0.c
parentdrm/amd/powerplay: add limit of pp_feature for smu (v3) (diff)
downloadkernel-qcow2-linux-07740adcbcd326060e142f6af674a036a5106c6f.tar.gz
kernel-qcow2-linux-07740adcbcd326060e142f6af674a036a5106c6f.tar.xz
kernel-qcow2-linux-07740adcbcd326060e142f6af674a036a5106c6f.zip
drm/amd/powerplay: add od condition for power limit
Add condition to judge whether overdrive is enabled and correct power limit value for overdrive used by power limit interface. Signed-off-by: Likun Gao <Likun.Gao@amd.com> Reviewed-by: Kevin Wang <kevin1.wang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/smu_v11_0.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/smu_v11_0.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index a3c7d1d5176f..f90410435e4c 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -925,6 +925,10 @@ static int smu_v11_0_get_power_limit(struct smu_context *smu,
if (get_default) {
mutex_lock(&smu->mutex);
*limit = smu->default_power_limit;
+ if (smu->od_enabled) {
+ *limit *= (100 + smu->smu_table.TDPODLimit);
+ *limit /= 100;
+ }
mutex_unlock(&smu->mutex);
} else {
ret = smu_send_smc_msg_with_param(smu, SMU_MSG_GetPptLimit,
@@ -942,8 +946,19 @@ static int smu_v11_0_get_power_limit(struct smu_context *smu,
static int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n)
{
+ uint32_t max_power_limit;
int ret = 0;
+ if (n == 0)
+ n = smu->default_power_limit;
+
+ max_power_limit = smu->default_power_limit;
+
+ if (smu->od_enabled) {
+ max_power_limit *= (100 + smu->smu_table.TDPODLimit);
+ max_power_limit /= 100;
+ }
+
if (smu_feature_is_enabled(smu, FEATURE_PPT_BIT))
ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, n);
if (ret) {