summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
diff options
context:
space:
mode:
authorKevin Wang <kevin1.wang@amd.com>2019-06-06 17:12:34 +0800
committerAlex Deucher <alexander.deucher@amd.com>2019-06-25 13:25:48 -0500
commitab43c4bf1cc8e8e1f0c7036c3448c5a628d18913 (patch)
tree873aaa07efb9e9bcd0300b59712d1ae1da2e10a3 /drivers/gpu/drm/amd/powerplay/navi10_ppt.c
parent709527c77a8977e95166d7d446e6a54f60e1e285 (diff)
downloadlinux-ab43c4bf1cc8e8e1f0c7036c3448c5a628d18913.tar.bz2
drm/amd/powerplay: fix fan speed show error (for hwmon pwm)
the navi asic can't get current rpm by MSG_GetCurrentRpm, it will cause show fan rpm error, use Metrics_t to replace it. Signed-off-by: Kevin Wang <kevin1.wang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/navi10_ppt.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/navi10_ppt.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 2d43e3dc79f6..953209b7c3eb 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -885,15 +885,33 @@ static bool navi10_is_dpm_running(struct smu_context *smu)
return !!(feature_enabled & SMC_DPM_FEATURE);
}
+static int navi10_get_fan_speed(struct smu_context *smu, uint16_t *value)
+{
+ SmuMetrics_t metrics = {0};
+ int ret = 0;
+
+ if (!value)
+ return -EINVAL;
+
+ ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS,
+ (void *)&metrics, false);
+ if (ret)
+ return ret;
+
+ *value = metrics.CurrFanSpeed;
+
+ return ret;
+}
+
static int navi10_get_fan_speed_percent(struct smu_context *smu,
uint32_t *speed)
{
int ret = 0;
uint32_t percent = 0;
- uint32_t current_rpm;
+ uint16_t current_rpm;
PPTable_t *pptable = smu->smu_table.driver_pptable;
- ret = smu_get_current_rpm(smu, &current_rpm);
+ ret = navi10_get_fan_speed(smu, &current_rpm);
if (ret)
return ret;