Lines Matching refs:hwmgr
29 int smu7_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, in smu7_fan_ctrl_get_fan_speed_info() argument
32 if (hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_fan_ctrl_get_fan_speed_info()
41 hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution) { in smu7_fan_ctrl_get_fan_speed_info()
44 fan_speed_info->min_rpm = hwmgr->thermal_controller.fanInfo.ulMinRPM; in smu7_fan_ctrl_get_fan_speed_info()
45 fan_speed_info->max_rpm = hwmgr->thermal_controller.fanInfo.ulMaxRPM; in smu7_fan_ctrl_get_fan_speed_info()
54 int smu7_fan_ctrl_get_fan_speed_pwm(struct pp_hwmgr *hwmgr, in smu7_fan_ctrl_get_fan_speed_pwm() argument
61 if (hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_fan_ctrl_get_fan_speed_pwm()
64 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_get_fan_speed_pwm()
66 duty = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_get_fan_speed_pwm()
80 int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed) in smu7_fan_ctrl_get_fan_speed_rpm() argument
85 if (hwmgr->thermal_controller.fanInfo.bNoFan || in smu7_fan_ctrl_get_fan_speed_rpm()
86 !hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution) in smu7_fan_ctrl_get_fan_speed_rpm()
89 tach_period = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_get_fan_speed_rpm()
95 crystal_clock_freq = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev); in smu7_fan_ctrl_get_fan_speed_rpm()
108 int smu7_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode) in smu7_fan_ctrl_set_static_mode() argument
110 if (hwmgr->fan_ctrl_is_in_default_mode) { in smu7_fan_ctrl_set_static_mode()
111 hwmgr->fan_ctrl_default_mode = in smu7_fan_ctrl_set_static_mode()
112 PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_static_mode()
114 hwmgr->tmin = in smu7_fan_ctrl_set_static_mode()
115 PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_static_mode()
117 hwmgr->fan_ctrl_is_in_default_mode = false; in smu7_fan_ctrl_set_static_mode()
120 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_static_mode()
122 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_static_mode()
133 int smu7_fan_ctrl_set_default_mode(struct pp_hwmgr *hwmgr) in smu7_fan_ctrl_set_default_mode() argument
135 if (!hwmgr->fan_ctrl_is_in_default_mode) { in smu7_fan_ctrl_set_default_mode()
136 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_default_mode()
137 CG_FDO_CTRL2, FDO_PWM_MODE, hwmgr->fan_ctrl_default_mode); in smu7_fan_ctrl_set_default_mode()
138 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_default_mode()
139 CG_FDO_CTRL2, TMIN, hwmgr->tmin); in smu7_fan_ctrl_set_default_mode()
140 hwmgr->fan_ctrl_is_in_default_mode = true; in smu7_fan_ctrl_set_default_mode()
146 int smu7_fan_ctrl_start_smc_fan_control(struct pp_hwmgr *hwmgr) in smu7_fan_ctrl_start_smc_fan_control() argument
151 result = smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_StartFanControl, in smu7_fan_ctrl_start_smc_fan_control()
155 hwmgr->hwmgr_func->set_max_fan_rpm_output(hwmgr, in smu7_fan_ctrl_start_smc_fan_control()
156 hwmgr->thermal_controller. in smu7_fan_ctrl_start_smc_fan_control()
159 hwmgr->hwmgr_func->set_max_fan_pwm_output(hwmgr, in smu7_fan_ctrl_start_smc_fan_control()
160 hwmgr->thermal_controller. in smu7_fan_ctrl_start_smc_fan_control()
164 result = smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_StartFanControl, in smu7_fan_ctrl_start_smc_fan_control()
168 if (!result && hwmgr->thermal_controller. in smu7_fan_ctrl_start_smc_fan_control()
170 result = smum_send_msg_to_smc_with_parameter(hwmgr, in smu7_fan_ctrl_start_smc_fan_control()
172 hwmgr->thermal_controller. in smu7_fan_ctrl_start_smc_fan_control()
177 (hwmgr->chip_id == CHIP_POLARIS10 || in smu7_fan_ctrl_start_smc_fan_control()
178 hwmgr->chip_id == CHIP_POLARIS11 || in smu7_fan_ctrl_start_smc_fan_control()
179 hwmgr->chip_id == CHIP_POLARIS12) && in smu7_fan_ctrl_start_smc_fan_control()
180 hwmgr->thermal_controller.advanceFanControlParameters.ucEnableZeroRPM && in smu7_fan_ctrl_start_smc_fan_control()
182 result = smum_send_msg_to_smc(hwmgr, in smu7_fan_ctrl_start_smc_fan_control()
186 hwmgr->fan_ctrl_enabled = true; in smu7_fan_ctrl_start_smc_fan_control()
192 int smu7_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr) in smu7_fan_ctrl_stop_smc_fan_control() argument
194 hwmgr->fan_ctrl_enabled = false; in smu7_fan_ctrl_stop_smc_fan_control()
195 return smum_send_msg_to_smc(hwmgr, PPSMC_StopFanControl, NULL); in smu7_fan_ctrl_stop_smc_fan_control()
203 int smu7_fan_ctrl_set_fan_speed_pwm(struct pp_hwmgr *hwmgr, in smu7_fan_ctrl_set_fan_speed_pwm() argument
210 if (hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_fan_ctrl_set_fan_speed_pwm()
216 smu7_fan_ctrl_stop_smc_fan_control(hwmgr); in smu7_fan_ctrl_set_fan_speed_pwm()
218 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_fan_speed_pwm()
228 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_fan_speed_pwm()
231 return smu7_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); in smu7_fan_ctrl_set_fan_speed_pwm()
239 int smu7_fan_ctrl_reset_fan_speed_to_default(struct pp_hwmgr *hwmgr) in smu7_fan_ctrl_reset_fan_speed_to_default() argument
243 if (hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_fan_ctrl_reset_fan_speed_to_default()
247 result = smu7_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); in smu7_fan_ctrl_reset_fan_speed_to_default()
249 result = smu7_fan_ctrl_start_smc_fan_control(hwmgr); in smu7_fan_ctrl_reset_fan_speed_to_default()
251 result = smu7_fan_ctrl_set_default_mode(hwmgr); in smu7_fan_ctrl_reset_fan_speed_to_default()
262 int smu7_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed) in smu7_fan_ctrl_set_fan_speed_rpm() argument
267 if (hwmgr->thermal_controller.fanInfo.bNoFan || in smu7_fan_ctrl_set_fan_speed_rpm()
268 (hwmgr->thermal_controller.fanInfo. in smu7_fan_ctrl_set_fan_speed_rpm()
271 (speed < hwmgr->thermal_controller.fanInfo.ulMinRPM) || in smu7_fan_ctrl_set_fan_speed_rpm()
272 (speed > hwmgr->thermal_controller.fanInfo.ulMaxRPM)) in smu7_fan_ctrl_set_fan_speed_rpm()
276 smu7_fan_ctrl_stop_smc_fan_control(hwmgr); in smu7_fan_ctrl_set_fan_speed_rpm()
278 crystal_clock_freq = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev); in smu7_fan_ctrl_set_fan_speed_rpm()
282 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_fan_speed_rpm()
285 return smu7_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC_RPM); in smu7_fan_ctrl_set_fan_speed_rpm()
293 int smu7_thermal_get_temperature(struct pp_hwmgr *hwmgr) in smu7_thermal_get_temperature() argument
297 temp = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_get_temperature()
319 static int smu7_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, in smu7_thermal_set_temperature_range() argument
335 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_set_temperature_range()
338 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_set_temperature_range()
341 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_set_temperature_range()
353 static int smu7_thermal_initialize(struct pp_hwmgr *hwmgr) in smu7_thermal_initialize() argument
355 if (hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution) in smu7_thermal_initialize()
356 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_initialize()
358 hwmgr->thermal_controller.fanInfo. in smu7_thermal_initialize()
361 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_initialize()
372 static void smu7_thermal_enable_alert(struct pp_hwmgr *hwmgr) in smu7_thermal_enable_alert() argument
376 alert = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_enable_alert()
379 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_enable_alert()
383 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_Thermal_Cntl_Enable, NULL); in smu7_thermal_enable_alert()
390 int smu7_thermal_disable_alert(struct pp_hwmgr *hwmgr) in smu7_thermal_disable_alert() argument
394 alert = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_disable_alert()
397 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_disable_alert()
401 return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_Thermal_Cntl_Disable, NULL); in smu7_thermal_disable_alert()
409 int smu7_thermal_stop_thermal_controller(struct pp_hwmgr *hwmgr) in smu7_thermal_stop_thermal_controller() argument
411 int result = smu7_thermal_disable_alert(hwmgr); in smu7_thermal_stop_thermal_controller()
413 if (!hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_thermal_stop_thermal_controller()
414 smu7_fan_ctrl_set_default_mode(hwmgr); in smu7_thermal_stop_thermal_controller()
424 static int smu7_thermal_start_smc_fan_control(struct pp_hwmgr *hwmgr) in smu7_thermal_start_smc_fan_control() argument
432 smu7_fan_ctrl_start_smc_fan_control(hwmgr); in smu7_thermal_start_smc_fan_control()
433 smu7_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); in smu7_thermal_start_smc_fan_control()
439 int smu7_start_thermal_controller(struct pp_hwmgr *hwmgr, in smu7_start_thermal_controller() argument
447 smu7_thermal_initialize(hwmgr); in smu7_start_thermal_controller()
448 ret = smu7_thermal_set_temperature_range(hwmgr, range->min, range->max); in smu7_start_thermal_controller()
451 smu7_thermal_enable_alert(hwmgr); in smu7_start_thermal_controller()
452 ret = smum_thermal_avfs_enable(hwmgr); in smu7_start_thermal_controller()
461 smum_thermal_setup_fan_table(hwmgr); in smu7_start_thermal_controller()
462 smu7_thermal_start_smc_fan_control(hwmgr); in smu7_start_thermal_controller()
468 int smu7_thermal_ctrl_uninitialize_thermal_controller(struct pp_hwmgr *hwmgr) in smu7_thermal_ctrl_uninitialize_thermal_controller() argument
470 if (!hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_thermal_ctrl_uninitialize_thermal_controller()
471 smu7_fan_ctrl_set_default_mode(hwmgr); in smu7_thermal_ctrl_uninitialize_thermal_controller()