summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/swsmu/smu11
diff options
context:
space:
mode:
authorDarren Powell <darren.powell@amd.com>2021-08-20 22:08:07 -0400
committerAlex Deucher <alexander.deucher@amd.com>2021-10-13 14:15:02 -0400
commit02f8aa9f2a3249d32316d745d1e4a3afef4180e5 (patch)
treeb8eaa2b9d308a8cd27aeb4e5f374e40eaf917376 /drivers/gpu/drm/amd/pm/swsmu/smu11
parent2d1ac1cbe57b306b244c43aa11610b89ea5a3178 (diff)
drm/amd/pm: Fix incorrect power limit readback in smu11 if POWER_SOURCE_DC
when smu->adev->pm.ac_power == 0, message parameter with bit 16 set is saved to smu->current_power_limit. Fixes: 0cb4c62125a9 ("drm/amd/pm: correct power limit setting for SMU V11)" Signed-off-by: Darren Powell <darren.powell@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/swsmu/smu11')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index b9386c55bd85..aa4d34f35c33 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -984,6 +984,7 @@ int smu_v11_0_set_power_limit(struct smu_context *smu,
{
int power_src;
int ret = 0;
+ uint32_t limit_param;
if (limit_type != SMU_DEFAULT_PPT_LIMIT)
return -EINVAL;
@@ -1006,10 +1007,10 @@ int smu_v11_0_set_power_limit(struct smu_context *smu,
* BIT 16-23: PowerSource
* BIT 0-15: PowerLimit
*/
- limit &= 0xFFFF;
- limit |= 0 << 24;
- limit |= (power_src) << 16;
- ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, limit, NULL);
+ limit_param = (limit & 0xFFFF);
+ limit_param |= 0 << 24;
+ limit_param |= (power_src) << 16;
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, limit_param, NULL);
if (ret) {
dev_err(smu->adev->dev, "[%s] Set power limit Failed!\n", __func__);
return ret;