提交 0b93c543 编写于 作者: E Evan Quan 提交者: Alex Deucher

drm/amd/pm: correct the fan speed retrieving in PWM for some SMU13 asics

For SMU 13.0.0 and 13.0.7, the output from PMFW is in percent. Driver
need to convert that into correct PMW(255) based.
Signed-off-by: NEvan Quan <evan.quan@amd.com>
Acked-by: NAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 82986fd6
...@@ -1442,12 +1442,23 @@ static void smu_v13_0_0_get_unique_id(struct smu_context *smu) ...@@ -1442,12 +1442,23 @@ static void smu_v13_0_0_get_unique_id(struct smu_context *smu)
static int smu_v13_0_0_get_fan_speed_pwm(struct smu_context *smu, static int smu_v13_0_0_get_fan_speed_pwm(struct smu_context *smu,
uint32_t *speed) uint32_t *speed)
{ {
int ret;
if (!speed) if (!speed)
return -EINVAL; return -EINVAL;
return smu_v13_0_0_get_smu_metrics_data(smu, ret = smu_v13_0_0_get_smu_metrics_data(smu,
METRICS_CURR_FANPWM, METRICS_CURR_FANPWM,
speed); speed);
if (ret) {
dev_err(smu->adev->dev, "Failed to get fan speed(PWM)!");
return ret;
}
/* Convert the PMFW output which is in percent to pwm(255) based */
*speed = MIN(*speed * 255 / 100, 255);
return 0;
} }
static int smu_v13_0_0_get_fan_speed_rpm(struct smu_context *smu, static int smu_v13_0_0_get_fan_speed_rpm(struct smu_context *smu,
......
...@@ -1363,12 +1363,23 @@ static int smu_v13_0_7_populate_umd_state_clk(struct smu_context *smu) ...@@ -1363,12 +1363,23 @@ static int smu_v13_0_7_populate_umd_state_clk(struct smu_context *smu)
static int smu_v13_0_7_get_fan_speed_pwm(struct smu_context *smu, static int smu_v13_0_7_get_fan_speed_pwm(struct smu_context *smu,
uint32_t *speed) uint32_t *speed)
{ {
int ret;
if (!speed) if (!speed)
return -EINVAL; return -EINVAL;
return smu_v13_0_7_get_smu_metrics_data(smu, ret = smu_v13_0_7_get_smu_metrics_data(smu,
METRICS_CURR_FANPWM, METRICS_CURR_FANPWM,
speed); speed);
if (ret) {
dev_err(smu->adev->dev, "Failed to get fan speed(PWM)!");
return ret;
}
/* Convert the PMFW output which is in percent to pwm(255) based */
*speed = MIN(*speed * 255 / 100, 255);
return 0;
} }
static int smu_v13_0_7_get_fan_speed_rpm(struct smu_context *smu, static int smu_v13_0_7_get_fan_speed_rpm(struct smu_context *smu,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册