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()
40 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in smu7_fan_ctrl_get_fan_speed_info()
42 hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution) { in smu7_fan_ctrl_get_fan_speed_info()
45 fan_speed_info->min_rpm = hwmgr->thermal_controller.fanInfo.ulMinRPM; in smu7_fan_ctrl_get_fan_speed_info()
46 fan_speed_info->max_rpm = hwmgr->thermal_controller.fanInfo.ulMaxRPM; in smu7_fan_ctrl_get_fan_speed_info()
55 int smu7_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr, in smu7_fan_ctrl_get_fan_speed_percent() argument
62 if (hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_fan_ctrl_get_fan_speed_percent()
65 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_get_fan_speed_percent()
67 duty = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_get_fan_speed_percent()
84 int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed) in smu7_fan_ctrl_get_fan_speed_rpm() argument
89 if (hwmgr->thermal_controller.fanInfo.bNoFan || in smu7_fan_ctrl_get_fan_speed_rpm()
90 (hwmgr->thermal_controller.fanInfo. in smu7_fan_ctrl_get_fan_speed_rpm()
94 tach_period = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_get_fan_speed_rpm()
100 crystal_clock_freq = smu7_get_xclk(hwmgr); in smu7_fan_ctrl_get_fan_speed_rpm()
113 int smu7_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode) in smu7_fan_ctrl_set_static_mode() argument
116 if (hwmgr->fan_ctrl_is_in_default_mode) { in smu7_fan_ctrl_set_static_mode()
117 hwmgr->fan_ctrl_default_mode = in smu7_fan_ctrl_set_static_mode()
118 PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_static_mode()
120 hwmgr->tmin = in smu7_fan_ctrl_set_static_mode()
121 PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_static_mode()
123 hwmgr->fan_ctrl_is_in_default_mode = false; in smu7_fan_ctrl_set_static_mode()
126 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_static_mode()
128 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_static_mode()
139 int smu7_fan_ctrl_set_default_mode(struct pp_hwmgr *hwmgr) in smu7_fan_ctrl_set_default_mode() argument
141 if (!hwmgr->fan_ctrl_is_in_default_mode) { in smu7_fan_ctrl_set_default_mode()
142 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_default_mode()
143 CG_FDO_CTRL2, FDO_PWM_MODE, hwmgr->fan_ctrl_default_mode); in smu7_fan_ctrl_set_default_mode()
144 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_default_mode()
145 CG_FDO_CTRL2, TMIN, hwmgr->tmin); in smu7_fan_ctrl_set_default_mode()
146 hwmgr->fan_ctrl_is_in_default_mode = true; in smu7_fan_ctrl_set_default_mode()
152 static int smu7_fan_ctrl_start_smc_fan_control(struct pp_hwmgr *hwmgr) in smu7_fan_ctrl_start_smc_fan_control() argument
156 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in smu7_fan_ctrl_start_smc_fan_control()
158 cgs_write_register(hwmgr->device, mmSMC_MSG_ARG_0, FAN_CONTROL_FUZZY); in smu7_fan_ctrl_start_smc_fan_control()
159 result = smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_StartFanControl); in smu7_fan_ctrl_start_smc_fan_control()
161 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in smu7_fan_ctrl_start_smc_fan_control()
163 hwmgr->hwmgr_func->set_max_fan_rpm_output(hwmgr, in smu7_fan_ctrl_start_smc_fan_control()
164 hwmgr->thermal_controller. in smu7_fan_ctrl_start_smc_fan_control()
167 hwmgr->hwmgr_func->set_max_fan_pwm_output(hwmgr, in smu7_fan_ctrl_start_smc_fan_control()
168 hwmgr->thermal_controller. in smu7_fan_ctrl_start_smc_fan_control()
172 cgs_write_register(hwmgr->device, mmSMC_MSG_ARG_0, FAN_CONTROL_TABLE); in smu7_fan_ctrl_start_smc_fan_control()
173 result = smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_StartFanControl); in smu7_fan_ctrl_start_smc_fan_control()
176 if (!result && hwmgr->thermal_controller. in smu7_fan_ctrl_start_smc_fan_control()
178 result = smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, in smu7_fan_ctrl_start_smc_fan_control()
180 hwmgr->thermal_controller. in smu7_fan_ctrl_start_smc_fan_control()
187 int smu7_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr) in smu7_fan_ctrl_stop_smc_fan_control() argument
189 return smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_StopFanControl); in smu7_fan_ctrl_stop_smc_fan_control()
198 int smu7_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr, in smu7_fan_ctrl_set_fan_speed_percent() argument
205 if (hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_fan_ctrl_set_fan_speed_percent()
211 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in smu7_fan_ctrl_set_fan_speed_percent()
213 smu7_fan_ctrl_stop_smc_fan_control(hwmgr); in smu7_fan_ctrl_set_fan_speed_percent()
215 duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_fan_speed_percent()
225 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_fan_speed_percent()
228 return smu7_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); in smu7_fan_ctrl_set_fan_speed_percent()
236 int smu7_fan_ctrl_reset_fan_speed_to_default(struct pp_hwmgr *hwmgr) in smu7_fan_ctrl_reset_fan_speed_to_default() argument
240 if (hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_fan_ctrl_reset_fan_speed_to_default()
243 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in smu7_fan_ctrl_reset_fan_speed_to_default()
245 result = smu7_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); in smu7_fan_ctrl_reset_fan_speed_to_default()
247 result = smu7_fan_ctrl_start_smc_fan_control(hwmgr); in smu7_fan_ctrl_reset_fan_speed_to_default()
249 result = smu7_fan_ctrl_set_default_mode(hwmgr); in smu7_fan_ctrl_reset_fan_speed_to_default()
260 int smu7_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed) in smu7_fan_ctrl_set_fan_speed_rpm() argument
265 if (hwmgr->thermal_controller.fanInfo.bNoFan || in smu7_fan_ctrl_set_fan_speed_rpm()
266 (hwmgr->thermal_controller.fanInfo. in smu7_fan_ctrl_set_fan_speed_rpm()
268 (speed < hwmgr->thermal_controller.fanInfo.ulMinRPM) || in smu7_fan_ctrl_set_fan_speed_rpm()
269 (speed > hwmgr->thermal_controller.fanInfo.ulMaxRPM)) in smu7_fan_ctrl_set_fan_speed_rpm()
272 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in smu7_fan_ctrl_set_fan_speed_rpm()
274 smu7_fan_ctrl_stop_smc_fan_control(hwmgr); in smu7_fan_ctrl_set_fan_speed_rpm()
276 crystal_clock_freq = smu7_get_xclk(hwmgr); in smu7_fan_ctrl_set_fan_speed_rpm()
280 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_fan_ctrl_set_fan_speed_rpm()
283 return smu7_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); in smu7_fan_ctrl_set_fan_speed_rpm()
291 int smu7_thermal_get_temperature(struct pp_hwmgr *hwmgr) in smu7_thermal_get_temperature() argument
295 temp = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_get_temperature()
316 static int smu7_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, in smu7_thermal_set_temperature_range() argument
332 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_set_temperature_range()
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()
350 static int smu7_thermal_initialize(struct pp_hwmgr *hwmgr) in smu7_thermal_initialize() argument
352 if (hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution) in smu7_thermal_initialize()
353 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_initialize()
355 hwmgr->thermal_controller.fanInfo. in smu7_thermal_initialize()
358 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_initialize()
369 int smu7_thermal_enable_alert(struct pp_hwmgr *hwmgr) in smu7_thermal_enable_alert() argument
373 alert = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_enable_alert()
376 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_enable_alert()
380 return smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_Thermal_Cntl_Enable); in smu7_thermal_enable_alert()
387 int smu7_thermal_disable_alert(struct pp_hwmgr *hwmgr) in smu7_thermal_disable_alert() argument
391 alert = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_disable_alert()
394 PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, in smu7_thermal_disable_alert()
398 return smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_Thermal_Cntl_Disable); in smu7_thermal_disable_alert()
406 int smu7_thermal_stop_thermal_controller(struct pp_hwmgr *hwmgr) in smu7_thermal_stop_thermal_controller() argument
408 int result = smu7_thermal_disable_alert(hwmgr); in smu7_thermal_stop_thermal_controller()
410 if (!hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_thermal_stop_thermal_controller()
411 smu7_fan_ctrl_set_default_mode(hwmgr); in smu7_thermal_stop_thermal_controller()
425 static int tf_smu7_thermal_start_smc_fan_control(struct pp_hwmgr *hwmgr, in tf_smu7_thermal_start_smc_fan_control() argument
433 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, in tf_smu7_thermal_start_smc_fan_control()
435 smu7_fan_ctrl_start_smc_fan_control(hwmgr); in tf_smu7_thermal_start_smc_fan_control()
436 smu7_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); in tf_smu7_thermal_start_smc_fan_control()
451 static int tf_smu7_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, in tf_smu7_thermal_set_temperature_range() argument
459 return smu7_thermal_set_temperature_range(hwmgr, range->min, range->max); in tf_smu7_thermal_set_temperature_range()
471 static int tf_smu7_thermal_initialize(struct pp_hwmgr *hwmgr, in tf_smu7_thermal_initialize() argument
474 return smu7_thermal_initialize(hwmgr); in tf_smu7_thermal_initialize()
486 static int tf_smu7_thermal_enable_alert(struct pp_hwmgr *hwmgr, in tf_smu7_thermal_enable_alert() argument
489 return smu7_thermal_enable_alert(hwmgr); in tf_smu7_thermal_enable_alert()
501 static int tf_smu7_thermal_disable_alert(struct pp_hwmgr *hwmgr, in tf_smu7_thermal_disable_alert() argument
504 return smu7_thermal_disable_alert(hwmgr); in tf_smu7_thermal_disable_alert()
545 int smu7_thermal_ctrl_uninitialize_thermal_controller(struct pp_hwmgr *hwmgr) in smu7_thermal_ctrl_uninitialize_thermal_controller() argument
547 if (!hwmgr->thermal_controller.fanInfo.bNoFan) in smu7_thermal_ctrl_uninitialize_thermal_controller()
548 smu7_fan_ctrl_set_default_mode(hwmgr); in smu7_thermal_ctrl_uninitialize_thermal_controller()
557 int pp_smu7_thermal_initialize(struct pp_hwmgr *hwmgr) in pp_smu7_thermal_initialize() argument
561 result = phm_construct_table(hwmgr, in pp_smu7_thermal_initialize()
563 &(hwmgr->set_temperature_range)); in pp_smu7_thermal_initialize()
566 result = phm_construct_table(hwmgr, in pp_smu7_thermal_initialize()
568 &(hwmgr->start_thermal_controller)); in pp_smu7_thermal_initialize()
570 phm_destroy_table(hwmgr, &(hwmgr->set_temperature_range)); in pp_smu7_thermal_initialize()
574 hwmgr->fan_ctrl_is_in_default_mode = true; in pp_smu7_thermal_initialize()