Commit 2d589a5b authored by Kevin Wang's avatar Kevin Wang Committed by Alex Deucher

drm/amd/powerplay: add function get_fan_speed_percent for navi10

add callback function get_fan_speed_percent for navi10 asic
Signed-off-by: default avatarKevin Wang <kevin1.wang@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent da85f081
...@@ -819,6 +819,24 @@ static int navi10_set_thermal_fan_table(struct smu_context *smu) ...@@ -819,6 +819,24 @@ static int navi10_set_thermal_fan_table(struct smu_context *smu)
return ret; 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;
PPTable_t *pptable = smu->smu_table.driver_pptable;
ret = smu_get_current_rpm(smu, &current_rpm);
if (ret)
return ret;
percent = current_rpm * 100 / pptable->FanMaximumRpm;
*speed = percent > 100 ? 100 : percent;
return ret;
}
static const struct pptable_funcs navi10_ppt_funcs = { static const struct pptable_funcs navi10_ppt_funcs = {
.tables_init = navi10_tables_init, .tables_init = navi10_tables_init,
.alloc_dpm_context = navi10_allocate_dpm_context, .alloc_dpm_context = navi10_allocate_dpm_context,
...@@ -846,6 +864,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { ...@@ -846,6 +864,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
.get_current_activity_percent = navi10_get_current_activity_percent, .get_current_activity_percent = navi10_get_current_activity_percent,
.is_dpm_running = navi10_is_dpm_running, .is_dpm_running = navi10_is_dpm_running,
.set_thermal_fan_table = navi10_set_thermal_fan_table, .set_thermal_fan_table = navi10_set_thermal_fan_table,
.get_fan_speed_percent = navi10_get_fan_speed_percent,
}; };
void navi10_set_ppt_funcs(struct smu_context *smu) void navi10_set_ppt_funcs(struct smu_context *smu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment