Lines Matching refs:hwmgr
32 static int vega10_get_current_rpm(struct pp_hwmgr *hwmgr, uint32_t *current_rpm) in vega10_get_current_rpm() argument
34 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetCurrentRpm, current_rpm); in vega10_get_current_rpm()
38 int vega10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, in vega10_fan_ctrl_get_fan_speed_info() argument
42 if (hwmgr->thermal_controller.fanInfo.bNoFan) in vega10_fan_ctrl_get_fan_speed_info()
51 hwmgr->thermal_controller.fanInfo. in vega10_fan_ctrl_get_fan_speed_info()
56 hwmgr->thermal_controller.fanInfo.ulMinRPM; in vega10_fan_ctrl_get_fan_speed_info()
58 hwmgr->thermal_controller.fanInfo.ulMaxRPM; in vega10_fan_ctrl_get_fan_speed_info()
67 int vega10_fan_ctrl_get_fan_speed_pwm(struct pp_hwmgr *hwmgr, in vega10_fan_ctrl_get_fan_speed_pwm() argument
70 struct amdgpu_device *adev = hwmgr->adev; in vega10_fan_ctrl_get_fan_speed_pwm()
89 int vega10_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed) in vega10_fan_ctrl_get_fan_speed_rpm() argument
91 struct amdgpu_device *adev = hwmgr->adev; in vega10_fan_ctrl_get_fan_speed_rpm()
92 struct vega10_hwmgr *data = hwmgr->backend; in vega10_fan_ctrl_get_fan_speed_rpm()
97 if (hwmgr->thermal_controller.fanInfo.bNoFan) in vega10_fan_ctrl_get_fan_speed_rpm()
101 result = vega10_get_current_rpm(hwmgr, speed); in vega10_fan_ctrl_get_fan_speed_rpm()
111 crystal_clock_freq = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev); in vega10_fan_ctrl_get_fan_speed_rpm()
126 int vega10_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode) in vega10_fan_ctrl_set_static_mode() argument
128 struct amdgpu_device *adev = hwmgr->adev; in vega10_fan_ctrl_set_static_mode()
130 if (hwmgr->fan_ctrl_is_in_default_mode) { in vega10_fan_ctrl_set_static_mode()
131 hwmgr->fan_ctrl_default_mode = in vega10_fan_ctrl_set_static_mode()
134 hwmgr->tmin = in vega10_fan_ctrl_set_static_mode()
137 hwmgr->fan_ctrl_is_in_default_mode = false; in vega10_fan_ctrl_set_static_mode()
155 int vega10_fan_ctrl_set_default_mode(struct pp_hwmgr *hwmgr) in vega10_fan_ctrl_set_default_mode() argument
157 struct amdgpu_device *adev = hwmgr->adev; in vega10_fan_ctrl_set_default_mode()
159 if (!hwmgr->fan_ctrl_is_in_default_mode) { in vega10_fan_ctrl_set_default_mode()
163 hwmgr->fan_ctrl_default_mode)); in vega10_fan_ctrl_set_default_mode()
167 hwmgr->tmin << CG_FDO_CTRL2__TMIN__SHIFT)); in vega10_fan_ctrl_set_default_mode()
168 hwmgr->fan_ctrl_is_in_default_mode = true; in vega10_fan_ctrl_set_default_mode()
180 static int vega10_enable_fan_control_feature(struct pp_hwmgr *hwmgr) in vega10_enable_fan_control_feature() argument
182 struct vega10_hwmgr *data = hwmgr->backend; in vega10_enable_fan_control_feature()
186 hwmgr, true, in vega10_enable_fan_control_feature()
197 static int vega10_disable_fan_control_feature(struct pp_hwmgr *hwmgr) in vega10_disable_fan_control_feature() argument
199 struct vega10_hwmgr *data = hwmgr->backend; in vega10_disable_fan_control_feature()
203 hwmgr, false, in vega10_disable_fan_control_feature()
214 int vega10_fan_ctrl_start_smc_fan_control(struct pp_hwmgr *hwmgr) in vega10_fan_ctrl_start_smc_fan_control() argument
216 if (hwmgr->thermal_controller.fanInfo.bNoFan) in vega10_fan_ctrl_start_smc_fan_control()
219 PP_ASSERT_WITH_CODE(!vega10_enable_fan_control_feature(hwmgr), in vega10_fan_ctrl_start_smc_fan_control()
227 int vega10_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr) in vega10_fan_ctrl_stop_smc_fan_control() argument
229 struct vega10_hwmgr *data = hwmgr->backend; in vega10_fan_ctrl_stop_smc_fan_control()
231 if (hwmgr->thermal_controller.fanInfo.bNoFan) in vega10_fan_ctrl_stop_smc_fan_control()
235 PP_ASSERT_WITH_CODE(!vega10_disable_fan_control_feature(hwmgr), in vega10_fan_ctrl_stop_smc_fan_control()
247 int vega10_fan_ctrl_set_fan_speed_pwm(struct pp_hwmgr *hwmgr, in vega10_fan_ctrl_set_fan_speed_pwm() argument
250 struct amdgpu_device *adev = hwmgr->adev; in vega10_fan_ctrl_set_fan_speed_pwm()
255 if (hwmgr->thermal_controller.fanInfo.bNoFan) in vega10_fan_ctrl_set_fan_speed_pwm()
261 vega10_fan_ctrl_stop_smc_fan_control(hwmgr); in vega10_fan_ctrl_set_fan_speed_pwm()
277 return vega10_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC); in vega10_fan_ctrl_set_fan_speed_pwm()
285 int vega10_fan_ctrl_reset_fan_speed_to_default(struct pp_hwmgr *hwmgr) in vega10_fan_ctrl_reset_fan_speed_to_default() argument
287 if (hwmgr->thermal_controller.fanInfo.bNoFan) in vega10_fan_ctrl_reset_fan_speed_to_default()
291 return vega10_fan_ctrl_start_smc_fan_control(hwmgr); in vega10_fan_ctrl_reset_fan_speed_to_default()
293 return vega10_fan_ctrl_set_default_mode(hwmgr); in vega10_fan_ctrl_reset_fan_speed_to_default()
302 int vega10_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed) in vega10_fan_ctrl_set_fan_speed_rpm() argument
304 struct amdgpu_device *adev = hwmgr->adev; in vega10_fan_ctrl_set_fan_speed_rpm()
309 if (hwmgr->thermal_controller.fanInfo.bNoFan || in vega10_fan_ctrl_set_fan_speed_rpm()
311 (speed < hwmgr->thermal_controller.fanInfo.ulMinRPM) || in vega10_fan_ctrl_set_fan_speed_rpm()
312 (speed > hwmgr->thermal_controller.fanInfo.ulMaxRPM)) in vega10_fan_ctrl_set_fan_speed_rpm()
316 result = vega10_fan_ctrl_stop_smc_fan_control(hwmgr); in vega10_fan_ctrl_set_fan_speed_rpm()
319 crystal_clock_freq = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev); in vega10_fan_ctrl_set_fan_speed_rpm()
326 return vega10_fan_ctrl_set_static_mode(hwmgr, FDO_PWM_MODE_STATIC_RPM); in vega10_fan_ctrl_set_fan_speed_rpm()
334 int vega10_thermal_get_temperature(struct pp_hwmgr *hwmgr) in vega10_thermal_get_temperature() argument
336 struct amdgpu_device *adev = hwmgr->adev; in vega10_thermal_get_temperature()
359 static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, in vega10_thermal_set_temperature_range() argument
363 (struct phm_ppt_v2_information *)(hwmgr->pptable); in vega10_thermal_set_temperature_range()
365 struct amdgpu_device *adev = hwmgr->adev; in vega10_thermal_set_temperature_range()
409 static int vega10_thermal_initialize(struct pp_hwmgr *hwmgr) in vega10_thermal_initialize() argument
411 struct amdgpu_device *adev = hwmgr->adev; in vega10_thermal_initialize()
413 if (hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution) { in vega10_thermal_initialize()
417 hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution - 1)); in vega10_thermal_initialize()
432 static int vega10_thermal_enable_alert(struct pp_hwmgr *hwmgr) in vega10_thermal_enable_alert() argument
434 struct amdgpu_device *adev = hwmgr->adev; in vega10_thermal_enable_alert()
435 struct vega10_hwmgr *data = hwmgr->backend; in vega10_thermal_enable_alert()
442 PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr, in vega10_thermal_enable_alert()
463 int vega10_thermal_disable_alert(struct pp_hwmgr *hwmgr) in vega10_thermal_disable_alert() argument
465 struct amdgpu_device *adev = hwmgr->adev; in vega10_thermal_disable_alert()
466 struct vega10_hwmgr *data = hwmgr->backend; in vega10_thermal_disable_alert()
473 PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr, in vega10_thermal_disable_alert()
491 int vega10_thermal_stop_thermal_controller(struct pp_hwmgr *hwmgr) in vega10_thermal_stop_thermal_controller() argument
493 int result = vega10_thermal_disable_alert(hwmgr); in vega10_thermal_stop_thermal_controller()
495 if (!hwmgr->thermal_controller.fanInfo.bNoFan) in vega10_thermal_stop_thermal_controller()
496 vega10_fan_ctrl_set_default_mode(hwmgr); in vega10_thermal_stop_thermal_controller()
506 static int vega10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr) in vega10_thermal_setup_fan_table() argument
509 struct vega10_hwmgr *data = hwmgr->backend; in vega10_thermal_setup_fan_table()
515 table->FanMaximumRpm = (uint16_t)hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
517 table->FanThrottlingRpm = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
519 table->FanAcousticLimitRpm = (uint16_t)(hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
521 table->FanTargetTemperature = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
524 smum_send_msg_to_smc_with_parameter(hwmgr, in vega10_thermal_setup_fan_table()
529 table->FanPwmMin = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
531 table->FanTargetGfxclk = (uint16_t)(hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
533 table->FanGainEdge = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
535 table->FanGainHotspot = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
537 table->FanGainLiquid = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
539 table->FanGainVrVddc = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
541 table->FanGainVrMvdd = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
543 table->FanGainPlx = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
545 table->FanGainHbm = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
547 table->FanZeroRpmEnable = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
549 table->FanStopTemp = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
551 table->FanStartTemp = hwmgr->thermal_controller. in vega10_thermal_setup_fan_table()
554 ret = smum_smc_table_manager(hwmgr, in vega10_thermal_setup_fan_table()
563 int vega10_enable_mgpu_fan_boost(struct pp_hwmgr *hwmgr) in vega10_enable_mgpu_fan_boost() argument
565 struct vega10_hwmgr *data = hwmgr->backend; in vega10_enable_mgpu_fan_boost()
572 if (!hwmgr->thermal_controller.advanceFanControlParameters. in vega10_enable_mgpu_fan_boost()
576 table->FanThrottlingRpm = hwmgr->thermal_controller. in vega10_enable_mgpu_fan_boost()
579 ret = smum_smc_table_manager(hwmgr, in vega10_enable_mgpu_fan_boost()
587 ret = vega10_disable_fan_control_feature(hwmgr); in vega10_enable_mgpu_fan_boost()
593 ret = vega10_enable_fan_control_feature(hwmgr); in vega10_enable_mgpu_fan_boost()
605 static int vega10_thermal_start_smc_fan_control(struct pp_hwmgr *hwmgr) in vega10_thermal_start_smc_fan_control() argument
613 vega10_fan_ctrl_start_smc_fan_control(hwmgr); in vega10_thermal_start_smc_fan_control()
619 int vega10_start_thermal_controller(struct pp_hwmgr *hwmgr, in vega10_start_thermal_controller() argument
627 vega10_thermal_initialize(hwmgr); in vega10_start_thermal_controller()
628 ret = vega10_thermal_set_temperature_range(hwmgr, range); in vega10_start_thermal_controller()
632 vega10_thermal_enable_alert(hwmgr); in vega10_start_thermal_controller()
638 ret = vega10_thermal_setup_fan_table(hwmgr); in vega10_start_thermal_controller()
642 vega10_thermal_start_smc_fan_control(hwmgr); in vega10_start_thermal_controller()
650 int vega10_thermal_ctrl_uninitialize_thermal_controller(struct pp_hwmgr *hwmgr) in vega10_thermal_ctrl_uninitialize_thermal_controller() argument
652 if (!hwmgr->thermal_controller.fanInfo.bNoFan) { in vega10_thermal_ctrl_uninitialize_thermal_controller()
653 vega10_fan_ctrl_set_default_mode(hwmgr); in vega10_thermal_ctrl_uninitialize_thermal_controller()
654 vega10_fan_ctrl_stop_smc_fan_control(hwmgr); in vega10_thermal_ctrl_uninitialize_thermal_controller()