aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLijo Lazar <lijo.lazar@amd.com>2021-01-28 18:20:06 +0800
committerAlex Deucher <alexander.deucher@amd.com>2021-03-23 22:58:07 -0400
commitd6f19a9949417db7264521b536fc86c7a68e23b1 (patch)
tree6765f2e5eec153bb41083455dd97cac071d531cf /drivers/gpu
parentdrm/amdgpu: mask the xgmi number of hops reported from psp to kfd (diff)
downloadlinux-dev-d6f19a9949417db7264521b536fc86c7a68e23b1.tar.xz
linux-dev-d6f19a9949417db7264521b536fc86c7a68e23b1.zip
drm/amd/pm: Fix power limit query on aldebaran
Aldebaran doesn't have AC/DC power limits. Separate the implementation from SMU13. Max power limit is queried from PPTable. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Kevin Wang <kevin1.wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
index 2810cc0a958c..e08df4da57a8 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
@@ -1066,30 +1066,28 @@ static int aldebaran_read_sensor(struct smu_context *smu,
static int aldebaran_get_power_limit(struct smu_context *smu)
{
- struct smu_13_0_powerplay_table *powerplay_table =
- (struct smu_13_0_powerplay_table *)smu->smu_table.power_play_table;
PPTable_t *pptable = smu->smu_table.driver_pptable;
- uint32_t power_limit, od_percent;
+ uint32_t power_limit = 0;
+ int ret;
+
+ if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_PPT_BIT))
+ return -EINVAL;
+
+ ret = smu_cmn_send_smc_msg(smu, SMU_MSG_GetPptLimit, &power_limit);
- if (smu_v13_0_get_current_power_limit(smu, &power_limit)) {
+ if (!ret) {
/* the last hope to figure out the ppt limit */
if (!pptable) {
dev_err(smu->adev->dev, "Cannot get PPT limit due to pptable missing!");
return -EINVAL;
}
- }
- smu->current_power_limit = power_limit;
-
- if (smu->od_enabled) {
- od_percent = le32_to_cpu(powerplay_table->overdrive_table.max[SMU_13_0_ODSETTING_POWERPERCENTAGE]);
-
- dev_dbg(smu->adev->dev, "ODSETTING_POWERPERCENTAGE: %d (default: %d)\n", od_percent, power_limit);
-
- power_limit *= (100 + od_percent);
- power_limit /= 100;
+ power_limit = pptable->PptLimit;
}
- smu->max_power_limit = power_limit;
+
+ smu->current_power_limit = power_limit;
+ if (pptable)
+ smu->max_power_limit = pptable->PptLimit;
return 0;
}