aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Wang <kevin1.wang@amd.com>2019-06-06 05:12:34 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-06-25 14:25:48 -0400
commitab43c4bf1cc8e8e1f0c7036c3448c5a628d18913 (patch)
tree873aaa07efb9e9bcd0300b59712d1ae1da2e10a3
parent709527c77a8977e95166d7d446e6a54f60e1e285 (diff)
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>
-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)
885 return !!(feature_enabled & SMC_DPM_FEATURE); 885 return !!(feature_enabled & SMC_DPM_FEATURE);
886} 886}
887 887
888static int navi10_get_fan_speed(struct smu_context *smu, uint16_t *value)
889{
890 SmuMetrics_t metrics = {0};
891 int ret = 0;
892
893 if (!value)
894 return -EINVAL;
895
896 ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS,
897 (void *)&metrics, false);
898 if (ret)
899 return ret;
900
901 *value = metrics.CurrFanSpeed;
902
903 return ret;
904}
905
888static int navi10_get_fan_speed_percent(struct smu_context *smu, 906static int navi10_get_fan_speed_percent(struct smu_context *smu,
889 uint32_t *speed) 907 uint32_t *speed)
890{ 908{
891 int ret = 0; 909 int ret = 0;
892 uint32_t percent = 0; 910 uint32_t percent = 0;
893 uint32_t current_rpm; 911 uint16_t current_rpm;
894 PPTable_t *pptable = smu->smu_table.driver_pptable; 912 PPTable_t *pptable = smu->smu_table.driver_pptable;
895 913
896 ret = smu_get_current_rpm(smu, &current_rpm); 914 ret = navi10_get_fan_speed(smu, &current_rpm);
897 if (ret) 915 if (ret)
898 return ret; 916 return ret;
899 917