drm/amdgpu: Add fan RPM setting via sysfs
Add fan1_target for get/set fan speed in RPM unit Add fan1_min/fan1_max for get min, max fan speed in RPM unit Add fan1_enable to enable/disable the fan1 sensor v3: drop the hardcode value of min/max rpm in comments pointed out by Alex. v2: query the min/max rpm gpu support instand of hardcode value. Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -576,6 +576,24 @@ static int pp_dpm_get_fan_speed_rpm(void *handle, uint32_t *rpm)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pp_dpm_set_fan_speed_rpm(void *handle, uint32_t rpm)
|
||||
{
|
||||
struct pp_hwmgr *hwmgr = handle;
|
||||
int ret = 0;
|
||||
|
||||
if (!hwmgr || !hwmgr->pm_en)
|
||||
return -EINVAL;
|
||||
|
||||
if (hwmgr->hwmgr_func->set_fan_speed_rpm == NULL) {
|
||||
pr_info("%s was not implemented.\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
mutex_lock(&hwmgr->smu_lock);
|
||||
ret = hwmgr->hwmgr_func->set_fan_speed_rpm(hwmgr, rpm);
|
||||
mutex_unlock(&hwmgr->smu_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pp_dpm_get_pp_num_states(void *handle,
|
||||
struct pp_states_info *data)
|
||||
{
|
||||
@@ -1297,6 +1315,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = {
|
||||
.set_fan_speed_percent = pp_dpm_set_fan_speed_percent,
|
||||
.get_fan_speed_percent = pp_dpm_get_fan_speed_percent,
|
||||
.get_fan_speed_rpm = pp_dpm_get_fan_speed_rpm,
|
||||
.set_fan_speed_rpm = pp_dpm_set_fan_speed_rpm,
|
||||
.get_pp_num_states = pp_dpm_get_pp_num_states,
|
||||
.get_pp_table = pp_dpm_get_pp_table,
|
||||
.set_pp_table = pp_dpm_set_pp_table,
|
||||
|
Reference in New Issue
Block a user