summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2021-02-09 12:23:33 +0800
committerAlex Deucher <alexander.deucher@amd.com>2021-08-16 15:35:56 -0400
commitd9ca7567b864322b9fd13b0d29ed510b80bba2f0 (patch)
tree9a239080ab9a7675c7c860a7d73c55723f1f6354 /drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
parentfb1f667e71c079defa5918b8f457faa48120b6f1 (diff)
drm/amd/pm: correct the fan speed RPM retrieving
The relationship "PWM = RPM / smu->fan_max_rpm" between fan speed PWM and RPM is not true for SMU11 ASICs. So, we need a new way to retrieving the fan speed RPM. Signed-off-by: Evan Quan <evan.quan@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/navi10_ppt.c')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index 52943ed738d2..17f0be97a5ec 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -1671,6 +1671,29 @@ static bool navi10_is_dpm_running(struct smu_context *smu)
return !!(feature_enabled & SMC_DPM_FEATURE);
}
+static int navi10_get_fan_speed_rpm(struct smu_context *smu,
+ uint32_t *speed)
+{
+ int ret = 0;
+
+ if (!speed)
+ return -EINVAL;
+
+ switch (smu_v11_0_get_fan_control_mode(smu)) {
+ case AMD_FAN_CTRL_AUTO:
+ ret = navi10_get_smu_metrics_data(smu,
+ METRICS_CURR_FANSPEED,
+ speed);
+ break;
+ default:
+ ret = smu_v11_0_get_fan_speed_rpm(smu,
+ speed);
+ break;
+ }
+
+ return ret;
+}
+
static int navi10_get_fan_parameters(struct smu_context *smu)
{
PPTable_t *pptable = smu->smu_table.driver_pptable;
@@ -3205,6 +3228,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
.notify_smc_display_config = navi10_notify_smc_display_config,
.is_dpm_running = navi10_is_dpm_running,
.get_fan_speed_percent = smu_v11_0_get_fan_speed_percent,
+ .get_fan_speed_rpm = navi10_get_fan_speed_rpm,
.get_power_profile_mode = navi10_get_power_profile_mode,
.set_power_profile_mode = navi10_set_power_profile_mode,
.set_watermarks_table = navi10_set_watermarks_table,