Lines Matching +full:ps +full:- +full:speed
25 #include <linux/hwmon-sysfs.h>
62 int found_instance = -1; in radeon_pm_get_type_index()
64 for (i = 0; i < rdev->pm.num_power_states; i++) { in radeon_pm_get_type_index()
65 if (rdev->pm.power_state[i].type == ps_type) { in radeon_pm_get_type_index()
72 return rdev->pm.default_power_state_index; in radeon_pm_get_type_index()
77 if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { in radeon_pm_acpi_event_handler()
78 mutex_lock(&rdev->pm.mutex); in radeon_pm_acpi_event_handler()
80 rdev->pm.dpm.ac_power = true; in radeon_pm_acpi_event_handler()
82 rdev->pm.dpm.ac_power = false; in radeon_pm_acpi_event_handler()
83 if (rdev->family == CHIP_ARUBA) { in radeon_pm_acpi_event_handler()
84 if (rdev->asic->dpm.enable_bapm) in radeon_pm_acpi_event_handler()
85 radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); in radeon_pm_acpi_event_handler()
87 mutex_unlock(&rdev->pm.mutex); in radeon_pm_acpi_event_handler()
88 } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { in radeon_pm_acpi_event_handler()
89 if (rdev->pm.profile == PM_PROFILE_AUTO) { in radeon_pm_acpi_event_handler()
90 mutex_lock(&rdev->pm.mutex); in radeon_pm_acpi_event_handler()
93 mutex_unlock(&rdev->pm.mutex); in radeon_pm_acpi_event_handler()
100 switch (rdev->pm.profile) { in radeon_pm_update_profile()
102 rdev->pm.profile_index = PM_PROFILE_DEFAULT_IDX; in radeon_pm_update_profile()
106 if (rdev->pm.active_crtc_count > 1) in radeon_pm_update_profile()
107 rdev->pm.profile_index = PM_PROFILE_HIGH_MH_IDX; in radeon_pm_update_profile()
109 rdev->pm.profile_index = PM_PROFILE_HIGH_SH_IDX; in radeon_pm_update_profile()
111 if (rdev->pm.active_crtc_count > 1) in radeon_pm_update_profile()
112 rdev->pm.profile_index = PM_PROFILE_MID_MH_IDX; in radeon_pm_update_profile()
114 rdev->pm.profile_index = PM_PROFILE_MID_SH_IDX; in radeon_pm_update_profile()
118 if (rdev->pm.active_crtc_count > 1) in radeon_pm_update_profile()
119 rdev->pm.profile_index = PM_PROFILE_LOW_MH_IDX; in radeon_pm_update_profile()
121 rdev->pm.profile_index = PM_PROFILE_LOW_SH_IDX; in radeon_pm_update_profile()
124 if (rdev->pm.active_crtc_count > 1) in radeon_pm_update_profile()
125 rdev->pm.profile_index = PM_PROFILE_MID_MH_IDX; in radeon_pm_update_profile()
127 rdev->pm.profile_index = PM_PROFILE_MID_SH_IDX; in radeon_pm_update_profile()
130 if (rdev->pm.active_crtc_count > 1) in radeon_pm_update_profile()
131 rdev->pm.profile_index = PM_PROFILE_HIGH_MH_IDX; in radeon_pm_update_profile()
133 rdev->pm.profile_index = PM_PROFILE_HIGH_SH_IDX; in radeon_pm_update_profile()
137 if (rdev->pm.active_crtc_count == 0) { in radeon_pm_update_profile()
138 rdev->pm.requested_power_state_index = in radeon_pm_update_profile()
139 rdev->pm.profiles[rdev->pm.profile_index].dpms_off_ps_idx; in radeon_pm_update_profile()
140 rdev->pm.requested_clock_mode_index = in radeon_pm_update_profile()
141 rdev->pm.profiles[rdev->pm.profile_index].dpms_off_cm_idx; in radeon_pm_update_profile()
143 rdev->pm.requested_power_state_index = in radeon_pm_update_profile()
144 rdev->pm.profiles[rdev->pm.profile_index].dpms_on_ps_idx; in radeon_pm_update_profile()
145 rdev->pm.requested_clock_mode_index = in radeon_pm_update_profile()
146 rdev->pm.profiles[rdev->pm.profile_index].dpms_on_cm_idx; in radeon_pm_update_profile()
154 if (list_empty(&rdev->gem.objects)) in radeon_unmap_vram_bos()
157 list_for_each_entry_safe(bo, n, &rdev->gem.objects, list) { in radeon_unmap_vram_bos()
158 if (bo->tbo.resource->mem_type == TTM_PL_VRAM) in radeon_unmap_vram_bos()
159 ttm_bo_unmap_virtual(&bo->tbo); in radeon_unmap_vram_bos()
165 if (rdev->pm.active_crtcs) { in radeon_sync_with_vblank()
166 rdev->pm.vblank_sync = false; in radeon_sync_with_vblank()
168 rdev->irq.vblank_queue, rdev->pm.vblank_sync, in radeon_sync_with_vblank()
178 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) && in radeon_set_power_state()
179 (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index)) in radeon_set_power_state()
183 sclk = rdev->pm.power_state[rdev->pm.requested_power_state_index]. in radeon_set_power_state()
184 clock_info[rdev->pm.requested_clock_mode_index].sclk; in radeon_set_power_state()
185 if (sclk > rdev->pm.default_sclk) in radeon_set_power_state()
186 sclk = rdev->pm.default_sclk; in radeon_set_power_state()
192 if ((rdev->pm.pm_method == PM_METHOD_PROFILE) && in radeon_set_power_state()
193 (rdev->family >= CHIP_BARTS) && in radeon_set_power_state()
194 rdev->pm.active_crtc_count && in radeon_set_power_state()
195 ((rdev->pm.profile_index == PM_PROFILE_MID_MH_IDX) || in radeon_set_power_state()
196 (rdev->pm.profile_index == PM_PROFILE_LOW_MH_IDX))) in radeon_set_power_state()
197 mclk = rdev->pm.power_state[rdev->pm.requested_power_state_index]. in radeon_set_power_state()
198 clock_info[rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_cm_idx].mclk; in radeon_set_power_state()
200 mclk = rdev->pm.power_state[rdev->pm.requested_power_state_index]. in radeon_set_power_state()
201 clock_info[rdev->pm.requested_clock_mode_index].mclk; in radeon_set_power_state()
203 if (mclk > rdev->pm.default_mclk) in radeon_set_power_state()
204 mclk = rdev->pm.default_mclk; in radeon_set_power_state()
207 if (sclk < rdev->pm.current_sclk) in radeon_set_power_state()
212 if (rdev->pm.pm_method == PM_METHOD_DYNPM) { in radeon_set_power_state()
224 if (sclk != rdev->pm.current_sclk) { in radeon_set_power_state()
228 rdev->pm.current_sclk = sclk; in radeon_set_power_state()
233 if (rdev->asic->pm.set_memory_clock && (mclk != rdev->pm.current_mclk)) { in radeon_set_power_state()
237 rdev->pm.current_mclk = mclk; in radeon_set_power_state()
247 rdev->pm.current_power_state_index = rdev->pm.requested_power_state_index; in radeon_set_power_state()
248 rdev->pm.current_clock_mode_index = rdev->pm.requested_clock_mode_index; in radeon_set_power_state()
259 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) && in radeon_pm_set_clocks()
260 (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index)) in radeon_pm_set_clocks()
263 down_write(&rdev->pm.mclk_lock); in radeon_pm_set_clocks()
264 mutex_lock(&rdev->ring_lock); in radeon_pm_set_clocks()
268 struct radeon_ring *ring = &rdev->ring[i]; in radeon_pm_set_clocks()
269 if (!ring->ready) { in radeon_pm_set_clocks()
275 mutex_unlock(&rdev->ring_lock); in radeon_pm_set_clocks()
276 up_write(&rdev->pm.mclk_lock); in radeon_pm_set_clocks()
283 if (rdev->irq.installed) { in radeon_pm_set_clocks()
286 if (rdev->pm.active_crtcs & (1 << i)) { in radeon_pm_set_clocks()
289 rdev->pm.req_vblank |= (1 << i); in radeon_pm_set_clocks()
300 if (rdev->irq.installed) { in radeon_pm_set_clocks()
303 if (rdev->pm.req_vblank & (1 << i)) { in radeon_pm_set_clocks()
304 rdev->pm.req_vblank &= ~(1 << i); in radeon_pm_set_clocks()
313 if (rdev->pm.active_crtc_count) in radeon_pm_set_clocks()
316 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; in radeon_pm_set_clocks()
318 mutex_unlock(&rdev->ring_lock); in radeon_pm_set_clocks()
319 up_write(&rdev->pm.mclk_lock); in radeon_pm_set_clocks()
328 DRM_DEBUG_DRIVER("%d Power State(s)\n", rdev->pm.num_power_states); in radeon_pm_print_states()
329 for (i = 0; i < rdev->pm.num_power_states; i++) { in radeon_pm_print_states()
330 power_state = &rdev->pm.power_state[i]; in radeon_pm_print_states()
332 radeon_pm_state_type_name[power_state->type]); in radeon_pm_print_states()
333 if (i == rdev->pm.default_power_state_index) in radeon_pm_print_states()
335 if ((rdev->flags & RADEON_IS_PCIE) && !(rdev->flags & RADEON_IS_IGP)) in radeon_pm_print_states()
336 DRM_DEBUG_DRIVER("\t%d PCIE Lanes\n", power_state->pcie_lanes); in radeon_pm_print_states()
337 if (power_state->flags & RADEON_PM_STATE_SINGLE_DISPLAY_ONLY) in radeon_pm_print_states()
339 DRM_DEBUG_DRIVER("\t%d Clock Mode(s)\n", power_state->num_clock_modes); in radeon_pm_print_states()
340 for (j = 0; j < power_state->num_clock_modes; j++) { in radeon_pm_print_states()
341 clock_info = &(power_state->clock_info[j]); in radeon_pm_print_states()
342 if (rdev->flags & RADEON_IS_IGP) in radeon_pm_print_states()
345 clock_info->sclk * 10); in radeon_pm_print_states()
349 clock_info->sclk * 10, in radeon_pm_print_states()
350 clock_info->mclk * 10, in radeon_pm_print_states()
351 clock_info->voltage.voltage); in radeon_pm_print_states()
361 struct radeon_device *rdev = ddev->dev_private; in radeon_get_pm_profile()
362 int cp = rdev->pm.profile; in radeon_get_pm_profile()
376 struct radeon_device *rdev = ddev->dev_private; in radeon_set_pm_profile()
379 if ((rdev->flags & RADEON_IS_PX) && in radeon_set_pm_profile()
380 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) in radeon_set_pm_profile()
381 return -EINVAL; in radeon_set_pm_profile()
383 mutex_lock(&rdev->pm.mutex); in radeon_set_pm_profile()
384 if (rdev->pm.pm_method == PM_METHOD_PROFILE) { in radeon_set_pm_profile()
386 rdev->pm.profile = PM_PROFILE_DEFAULT; in radeon_set_pm_profile()
388 rdev->pm.profile = PM_PROFILE_AUTO; in radeon_set_pm_profile()
390 rdev->pm.profile = PM_PROFILE_LOW; in radeon_set_pm_profile()
392 rdev->pm.profile = PM_PROFILE_MID; in radeon_set_pm_profile()
394 rdev->pm.profile = PM_PROFILE_HIGH; in radeon_set_pm_profile()
396 count = -EINVAL; in radeon_set_pm_profile()
402 count = -EINVAL; in radeon_set_pm_profile()
405 mutex_unlock(&rdev->pm.mutex); in radeon_set_pm_profile()
415 struct radeon_device *rdev = ddev->dev_private; in radeon_get_pm_method()
416 int pm = rdev->pm.pm_method; in radeon_get_pm_method()
428 struct radeon_device *rdev = ddev->dev_private; in radeon_set_pm_method()
431 if ((rdev->flags & RADEON_IS_PX) && in radeon_set_pm_method()
432 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) { in radeon_set_pm_method()
433 count = -EINVAL; in radeon_set_pm_method()
438 if (rdev->pm.pm_method == PM_METHOD_DPM) { in radeon_set_pm_method()
439 count = -EINVAL; in radeon_set_pm_method()
444 mutex_lock(&rdev->pm.mutex); in radeon_set_pm_method()
445 rdev->pm.pm_method = PM_METHOD_DYNPM; in radeon_set_pm_method()
446 rdev->pm.dynpm_state = DYNPM_STATE_PAUSED; in radeon_set_pm_method()
447 rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT; in radeon_set_pm_method()
448 mutex_unlock(&rdev->pm.mutex); in radeon_set_pm_method()
450 mutex_lock(&rdev->pm.mutex); in radeon_set_pm_method()
452 rdev->pm.dynpm_state = DYNPM_STATE_DISABLED; in radeon_set_pm_method()
453 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; in radeon_set_pm_method()
454 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_set_pm_method()
455 mutex_unlock(&rdev->pm.mutex); in radeon_set_pm_method()
456 cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); in radeon_set_pm_method()
458 count = -EINVAL; in radeon_set_pm_method()
471 struct radeon_device *rdev = ddev->dev_private; in radeon_get_dpm_state()
472 enum radeon_pm_state_type pm = rdev->pm.dpm.user_state; in radeon_get_dpm_state()
485 struct radeon_device *rdev = ddev->dev_private; in radeon_set_dpm_state()
487 mutex_lock(&rdev->pm.mutex); in radeon_set_dpm_state()
489 rdev->pm.dpm.user_state = POWER_STATE_TYPE_BATTERY; in radeon_set_dpm_state()
491 rdev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED; in radeon_set_dpm_state()
493 rdev->pm.dpm.user_state = POWER_STATE_TYPE_PERFORMANCE; in radeon_set_dpm_state()
495 mutex_unlock(&rdev->pm.mutex); in radeon_set_dpm_state()
496 count = -EINVAL; in radeon_set_dpm_state()
499 mutex_unlock(&rdev->pm.mutex); in radeon_set_dpm_state()
502 if (!(rdev->flags & RADEON_IS_PX) || in radeon_set_dpm_state()
503 (ddev->switch_power_state == DRM_SWITCH_POWER_ON)) in radeon_set_dpm_state()
515 struct radeon_device *rdev = ddev->dev_private; in radeon_get_dpm_forced_performance_level()
516 enum radeon_dpm_forced_level level = rdev->pm.dpm.forced_level; in radeon_get_dpm_forced_performance_level()
518 if ((rdev->flags & RADEON_IS_PX) && in radeon_get_dpm_forced_performance_level()
519 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) in radeon_get_dpm_forced_performance_level()
533 struct radeon_device *rdev = ddev->dev_private; in radeon_set_dpm_forced_performance_level()
538 if ((rdev->flags & RADEON_IS_PX) && in radeon_set_dpm_forced_performance_level()
539 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) in radeon_set_dpm_forced_performance_level()
540 return -EINVAL; in radeon_set_dpm_forced_performance_level()
542 mutex_lock(&rdev->pm.mutex); in radeon_set_dpm_forced_performance_level()
550 count = -EINVAL; in radeon_set_dpm_forced_performance_level()
553 if (rdev->asic->dpm.force_performance_level) { in radeon_set_dpm_forced_performance_level()
554 if (rdev->pm.dpm.thermal_active) { in radeon_set_dpm_forced_performance_level()
555 count = -EINVAL; in radeon_set_dpm_forced_performance_level()
560 count = -EINVAL; in radeon_set_dpm_forced_performance_level()
563 mutex_unlock(&rdev->pm.mutex); in radeon_set_dpm_forced_performance_level()
575 if (rdev->asic->dpm.fan_ctrl_get_mode) in radeon_hwmon_get_pwm1_enable()
576 pwm_mode = rdev->asic->dpm.fan_ctrl_get_mode(rdev); in radeon_hwmon_get_pwm1_enable()
578 /* never 0 (full-speed), fuse or smc-controlled always */ in radeon_hwmon_get_pwm1_enable()
591 if (!rdev->asic->dpm.fan_ctrl_set_mode) in radeon_hwmon_set_pwm1_enable()
592 return -EINVAL; in radeon_hwmon_set_pwm1_enable()
599 case 1: /* manual, percent-based */ in radeon_hwmon_set_pwm1_enable()
600 rdev->asic->dpm.fan_ctrl_set_mode(rdev, FDO_PWM_MODE_STATIC); in radeon_hwmon_set_pwm1_enable()
603 rdev->asic->dpm.fan_ctrl_set_mode(rdev, 0); in radeon_hwmon_set_pwm1_enable()
638 err = rdev->asic->dpm.set_fan_speed_percent(rdev, value); in radeon_hwmon_set_pwm1()
651 u32 speed; in radeon_hwmon_get_pwm1() local
653 err = rdev->asic->dpm.get_fan_speed_percent(rdev, &speed); in radeon_hwmon_get_pwm1()
657 speed = (speed * 255) / 100; in radeon_hwmon_get_pwm1()
659 return sprintf(buf, "%i\n", speed); in radeon_hwmon_get_pwm1()
678 if ((rdev->flags & RADEON_IS_PX) && in radeon_hwmon_show_temp()
679 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) in radeon_hwmon_show_temp()
680 return -EINVAL; in radeon_hwmon_show_temp()
682 if (rdev->asic->pm.get_temperature) in radeon_hwmon_show_temp()
695 int hyst = to_sensor_dev_attr(attr)->index; in radeon_hwmon_show_temp_thresh()
699 temp = rdev->pm.dpm.thermal.min_temp; in radeon_hwmon_show_temp_thresh()
701 temp = rdev->pm.dpm.thermal.max_temp; in radeon_hwmon_show_temp_thresh()
722 if ((rdev->flags & RADEON_IS_PX) && in radeon_hwmon_show_sclk()
723 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) in radeon_hwmon_show_sclk()
724 return -EINVAL; in radeon_hwmon_show_sclk()
726 if (rdev->asic->dpm.get_current_sclk) in radeon_hwmon_show_sclk()
747 if ((rdev->flags & RADEON_IS_PX) && in radeon_hwmon_show_vddc()
748 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) in radeon_hwmon_show_vddc()
749 return -EINVAL; in radeon_hwmon_show_vddc()
751 if (rdev->asic->dpm.get_current_vddc) in radeon_hwmon_show_vddc()
752 vddc = rdev->asic->dpm.get_current_vddc(rdev); in radeon_hwmon_show_vddc()
778 umode_t effective_mode = attr->mode; in hwmon_attributes_visible()
781 if (rdev->pm.pm_method != PM_METHOD_DPM && in hwmon_attributes_visible()
794 !rdev->asic->dpm.get_current_vddc) in hwmon_attributes_visible()
798 if (rdev->pm.no_fan && in hwmon_attributes_visible()
806 if ((!rdev->asic->dpm.get_fan_speed_percent && in hwmon_attributes_visible()
808 (!rdev->asic->dpm.fan_ctrl_get_mode && in hwmon_attributes_visible()
812 if ((!rdev->asic->dpm.set_fan_speed_percent && in hwmon_attributes_visible()
814 (!rdev->asic->dpm.fan_ctrl_set_mode && in hwmon_attributes_visible()
819 if ((!rdev->asic->dpm.set_fan_speed_percent && in hwmon_attributes_visible()
820 !rdev->asic->dpm.get_fan_speed_percent) && in hwmon_attributes_visible()
842 switch (rdev->pm.int_thermal_type) { in radeon_hwmon_init()
851 if (rdev->asic->pm.get_temperature == NULL) in radeon_hwmon_init()
853 rdev->pm.int_hwmon_dev = hwmon_device_register_with_groups(rdev->dev, in radeon_hwmon_init()
856 if (IS_ERR(rdev->pm.int_hwmon_dev)) { in radeon_hwmon_init()
857 err = PTR_ERR(rdev->pm.int_hwmon_dev); in radeon_hwmon_init()
858 dev_err(rdev->dev, in radeon_hwmon_init()
871 if (rdev->pm.int_hwmon_dev) in radeon_hwmon_fini()
872 hwmon_device_unregister(rdev->pm.int_hwmon_dev); in radeon_hwmon_fini()
883 if (!rdev->pm.dpm_enabled) in radeon_dpm_thermal_work_handler()
886 if (rdev->asic->pm.get_temperature) { in radeon_dpm_thermal_work_handler()
889 if (temp < rdev->pm.dpm.thermal.min_temp) in radeon_dpm_thermal_work_handler()
891 dpm_state = rdev->pm.dpm.user_state; in radeon_dpm_thermal_work_handler()
893 if (rdev->pm.dpm.thermal.high_to_low) in radeon_dpm_thermal_work_handler()
895 dpm_state = rdev->pm.dpm.user_state; in radeon_dpm_thermal_work_handler()
897 mutex_lock(&rdev->pm.mutex); in radeon_dpm_thermal_work_handler()
899 rdev->pm.dpm.thermal_active = true; in radeon_dpm_thermal_work_handler()
901 rdev->pm.dpm.thermal_active = false; in radeon_dpm_thermal_work_handler()
902 rdev->pm.dpm.state = dpm_state; in radeon_dpm_thermal_work_handler()
903 mutex_unlock(&rdev->pm.mutex); in radeon_dpm_thermal_work_handler()
910 bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ? in radeon_dpm_single_display()
914 if (single_display && rdev->asic->dpm.vblank_too_short) { in radeon_dpm_single_display()
932 struct radeon_ps *ps; in radeon_dpm_pick_power_state() local
947 for (i = 0; i < rdev->pm.dpm.num_ps; i++) { in radeon_dpm_pick_power_state()
948 ps = &rdev->pm.dpm.ps[i]; in radeon_dpm_pick_power_state()
949 ui_class = ps->class & ATOM_PPLIB_CLASSIFICATION_UI_MASK; in radeon_dpm_pick_power_state()
954 if (ps->caps & ATOM_PPLIB_SINGLE_DISPLAY_ONLY) { in radeon_dpm_pick_power_state()
956 return ps; in radeon_dpm_pick_power_state()
958 return ps; in radeon_dpm_pick_power_state()
963 if (ps->caps & ATOM_PPLIB_SINGLE_DISPLAY_ONLY) { in radeon_dpm_pick_power_state()
965 return ps; in radeon_dpm_pick_power_state()
967 return ps; in radeon_dpm_pick_power_state()
972 if (ps->caps & ATOM_PPLIB_SINGLE_DISPLAY_ONLY) { in radeon_dpm_pick_power_state()
974 return ps; in radeon_dpm_pick_power_state()
976 return ps; in radeon_dpm_pick_power_state()
981 if (rdev->pm.dpm.uvd_ps) in radeon_dpm_pick_power_state()
982 return rdev->pm.dpm.uvd_ps; in radeon_dpm_pick_power_state()
986 if (ps->class & ATOM_PPLIB_CLASSIFICATION_SDSTATE) in radeon_dpm_pick_power_state()
987 return ps; in radeon_dpm_pick_power_state()
990 if (ps->class & ATOM_PPLIB_CLASSIFICATION_HDSTATE) in radeon_dpm_pick_power_state()
991 return ps; in radeon_dpm_pick_power_state()
994 if (ps->class & ATOM_PPLIB_CLASSIFICATION_HD2STATE) in radeon_dpm_pick_power_state()
995 return ps; in radeon_dpm_pick_power_state()
998 if (ps->class2 & ATOM_PPLIB_CLASSIFICATION2_MVC) in radeon_dpm_pick_power_state()
999 return ps; in radeon_dpm_pick_power_state()
1002 return rdev->pm.dpm.boot_ps; in radeon_dpm_pick_power_state()
1004 if (ps->class & ATOM_PPLIB_CLASSIFICATION_THERMAL) in radeon_dpm_pick_power_state()
1005 return ps; in radeon_dpm_pick_power_state()
1008 if (ps->class & ATOM_PPLIB_CLASSIFICATION_ACPI) in radeon_dpm_pick_power_state()
1009 return ps; in radeon_dpm_pick_power_state()
1012 if (ps->class2 & ATOM_PPLIB_CLASSIFICATION2_ULV) in radeon_dpm_pick_power_state()
1013 return ps; in radeon_dpm_pick_power_state()
1016 if (ps->class & ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE) in radeon_dpm_pick_power_state()
1017 return ps; in radeon_dpm_pick_power_state()
1031 if (rdev->pm.dpm.uvd_ps) { in radeon_dpm_pick_power_state()
1032 return rdev->pm.dpm.uvd_ps; in radeon_dpm_pick_power_state()
1058 struct radeon_ps *ps; in radeon_dpm_change_power_state_locked() local
1064 if (!rdev->pm.dpm_enabled) in radeon_dpm_change_power_state_locked()
1067 if (rdev->pm.dpm.user_state != rdev->pm.dpm.state) { in radeon_dpm_change_power_state_locked()
1069 if ((!rdev->pm.dpm.thermal_active) && in radeon_dpm_change_power_state_locked()
1070 (!rdev->pm.dpm.uvd_active)) in radeon_dpm_change_power_state_locked()
1071 rdev->pm.dpm.state = rdev->pm.dpm.user_state; in radeon_dpm_change_power_state_locked()
1073 dpm_state = rdev->pm.dpm.state; in radeon_dpm_change_power_state_locked()
1075 ps = radeon_dpm_pick_power_state(rdev, dpm_state); in radeon_dpm_change_power_state_locked()
1076 if (ps) in radeon_dpm_change_power_state_locked()
1077 rdev->pm.dpm.requested_ps = ps; in radeon_dpm_change_power_state_locked()
1082 if (rdev->pm.dpm.current_ps == rdev->pm.dpm.requested_ps) { in radeon_dpm_change_power_state_locked()
1084 if (ps->vce_active != rdev->pm.dpm.vce_active) in radeon_dpm_change_power_state_locked()
1087 if (rdev->pm.dpm.single_display != single_display) in radeon_dpm_change_power_state_locked()
1089 if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) { in radeon_dpm_change_power_state_locked()
1090 /* for pre-BTC and APUs if the num crtcs changed but state is the same, in radeon_dpm_change_power_state_locked()
1093 if (rdev->pm.dpm.new_active_crtcs != rdev->pm.dpm.current_active_crtcs) { in radeon_dpm_change_power_state_locked()
1098 rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; in radeon_dpm_change_power_state_locked()
1099 rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; in radeon_dpm_change_power_state_locked()
1107 if (rdev->pm.dpm.new_active_crtcs == in radeon_dpm_change_power_state_locked()
1108 rdev->pm.dpm.current_active_crtcs) { in radeon_dpm_change_power_state_locked()
1111 if ((rdev->pm.dpm.current_active_crtc_count > 1) && in radeon_dpm_change_power_state_locked()
1112 (rdev->pm.dpm.new_active_crtc_count > 1)) { in radeon_dpm_change_power_state_locked()
1117 rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; in radeon_dpm_change_power_state_locked()
1118 rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; in radeon_dpm_change_power_state_locked()
1128 radeon_dpm_print_power_state(rdev, rdev->pm.dpm.current_ps); in radeon_dpm_change_power_state_locked()
1130 radeon_dpm_print_power_state(rdev, rdev->pm.dpm.requested_ps); in radeon_dpm_change_power_state_locked()
1133 down_write(&rdev->pm.mclk_lock); in radeon_dpm_change_power_state_locked()
1134 mutex_lock(&rdev->ring_lock); in radeon_dpm_change_power_state_locked()
1137 ps->vce_active = rdev->pm.dpm.vce_active; in radeon_dpm_change_power_state_locked()
1150 struct radeon_ring *ring = &rdev->ring[i]; in radeon_dpm_change_power_state_locked()
1151 if (ring->ready) in radeon_dpm_change_power_state_locked()
1159 rdev->pm.dpm.current_ps = rdev->pm.dpm.requested_ps; in radeon_dpm_change_power_state_locked()
1163 rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; in radeon_dpm_change_power_state_locked()
1164 rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; in radeon_dpm_change_power_state_locked()
1165 rdev->pm.dpm.single_display = single_display; in radeon_dpm_change_power_state_locked()
1167 if (rdev->asic->dpm.force_performance_level) { in radeon_dpm_change_power_state_locked()
1168 if (rdev->pm.dpm.thermal_active) { in radeon_dpm_change_power_state_locked()
1169 enum radeon_dpm_forced_level level = rdev->pm.dpm.forced_level; in radeon_dpm_change_power_state_locked()
1173 rdev->pm.dpm.forced_level = level; in radeon_dpm_change_power_state_locked()
1176 radeon_dpm_force_performance_level(rdev, rdev->pm.dpm.forced_level); in radeon_dpm_change_power_state_locked()
1181 mutex_unlock(&rdev->ring_lock); in radeon_dpm_change_power_state_locked()
1182 up_write(&rdev->pm.mclk_lock); in radeon_dpm_change_power_state_locked()
1189 if (rdev->asic->dpm.powergate_uvd) { in radeon_dpm_enable_uvd()
1190 mutex_lock(&rdev->pm.mutex); in radeon_dpm_enable_uvd()
1193 enable |= rdev->pm.dpm.sd > 0; in radeon_dpm_enable_uvd()
1194 enable |= rdev->pm.dpm.hd > 0; in radeon_dpm_enable_uvd()
1197 mutex_unlock(&rdev->pm.mutex); in radeon_dpm_enable_uvd()
1200 mutex_lock(&rdev->pm.mutex); in radeon_dpm_enable_uvd()
1201 rdev->pm.dpm.uvd_active = true; in radeon_dpm_enable_uvd()
1204 if ((rdev->pm.dpm.sd == 1) && (rdev->pm.dpm.hd == 0)) in radeon_dpm_enable_uvd()
1206 else if ((rdev->pm.dpm.sd == 2) && (rdev->pm.dpm.hd == 0)) in radeon_dpm_enable_uvd()
1208 else if ((rdev->pm.dpm.sd == 0) && (rdev->pm.dpm.hd == 1)) in radeon_dpm_enable_uvd()
1210 else if ((rdev->pm.dpm.sd == 0) && (rdev->pm.dpm.hd == 2)) in radeon_dpm_enable_uvd()
1215 rdev->pm.dpm.state = dpm_state; in radeon_dpm_enable_uvd()
1216 mutex_unlock(&rdev->pm.mutex); in radeon_dpm_enable_uvd()
1218 mutex_lock(&rdev->pm.mutex); in radeon_dpm_enable_uvd()
1219 rdev->pm.dpm.uvd_active = false; in radeon_dpm_enable_uvd()
1220 mutex_unlock(&rdev->pm.mutex); in radeon_dpm_enable_uvd()
1230 mutex_lock(&rdev->pm.mutex); in radeon_dpm_enable_vce()
1231 rdev->pm.dpm.vce_active = true; in radeon_dpm_enable_vce()
1233 rdev->pm.dpm.vce_level = RADEON_VCE_LEVEL_AC_ALL; in radeon_dpm_enable_vce()
1234 mutex_unlock(&rdev->pm.mutex); in radeon_dpm_enable_vce()
1236 mutex_lock(&rdev->pm.mutex); in radeon_dpm_enable_vce()
1237 rdev->pm.dpm.vce_active = false; in radeon_dpm_enable_vce()
1238 mutex_unlock(&rdev->pm.mutex); in radeon_dpm_enable_vce()
1246 mutex_lock(&rdev->pm.mutex); in radeon_pm_suspend_old()
1247 if (rdev->pm.pm_method == PM_METHOD_DYNPM) { in radeon_pm_suspend_old()
1248 if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) in radeon_pm_suspend_old()
1249 rdev->pm.dynpm_state = DYNPM_STATE_SUSPENDED; in radeon_pm_suspend_old()
1251 mutex_unlock(&rdev->pm.mutex); in radeon_pm_suspend_old()
1253 cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); in radeon_pm_suspend_old()
1258 mutex_lock(&rdev->pm.mutex); in radeon_pm_suspend_dpm()
1262 rdev->pm.dpm.current_ps = rdev->pm.dpm.requested_ps = rdev->pm.dpm.boot_ps; in radeon_pm_suspend_dpm()
1263 rdev->pm.dpm_enabled = false; in radeon_pm_suspend_dpm()
1264 mutex_unlock(&rdev->pm.mutex); in radeon_pm_suspend_dpm()
1269 if (rdev->pm.pm_method == PM_METHOD_DPM) in radeon_pm_suspend()
1278 if ((rdev->family >= CHIP_BARTS) && in radeon_pm_resume_old()
1279 (rdev->family <= CHIP_CAYMAN) && in radeon_pm_resume_old()
1280 rdev->mc_fw) { in radeon_pm_resume_old()
1281 if (rdev->pm.default_vddc) in radeon_pm_resume_old()
1282 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc, in radeon_pm_resume_old()
1284 if (rdev->pm.default_vddci) in radeon_pm_resume_old()
1285 radeon_atom_set_voltage(rdev, rdev->pm.default_vddci, in radeon_pm_resume_old()
1287 if (rdev->pm.default_sclk) in radeon_pm_resume_old()
1288 radeon_set_engine_clock(rdev, rdev->pm.default_sclk); in radeon_pm_resume_old()
1289 if (rdev->pm.default_mclk) in radeon_pm_resume_old()
1290 radeon_set_memory_clock(rdev, rdev->pm.default_mclk); in radeon_pm_resume_old()
1293 mutex_lock(&rdev->pm.mutex); in radeon_pm_resume_old()
1294 rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; in radeon_pm_resume_old()
1295 rdev->pm.current_clock_mode_index = 0; in radeon_pm_resume_old()
1296 rdev->pm.current_sclk = rdev->pm.default_sclk; in radeon_pm_resume_old()
1297 rdev->pm.current_mclk = rdev->pm.default_mclk; in radeon_pm_resume_old()
1298 if (rdev->pm.power_state) { in radeon_pm_resume_old()
1299 …rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].vol… in radeon_pm_resume_old()
1300 …rdev->pm.current_vddci = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].vo… in radeon_pm_resume_old()
1302 if (rdev->pm.pm_method == PM_METHOD_DYNPM in radeon_pm_resume_old()
1303 && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) { in radeon_pm_resume_old()
1304 rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; in radeon_pm_resume_old()
1305 schedule_delayed_work(&rdev->pm.dynpm_idle_work, in radeon_pm_resume_old()
1308 mutex_unlock(&rdev->pm.mutex); in radeon_pm_resume_old()
1317 mutex_lock(&rdev->pm.mutex); in radeon_pm_resume_dpm()
1318 rdev->pm.dpm.current_ps = rdev->pm.dpm.requested_ps = rdev->pm.dpm.boot_ps; in radeon_pm_resume_dpm()
1321 mutex_unlock(&rdev->pm.mutex); in radeon_pm_resume_dpm()
1324 rdev->pm.dpm_enabled = true; in radeon_pm_resume_dpm()
1329 if ((rdev->family >= CHIP_BARTS) && in radeon_pm_resume_dpm()
1330 (rdev->family <= CHIP_CAYMAN) && in radeon_pm_resume_dpm()
1331 rdev->mc_fw) { in radeon_pm_resume_dpm()
1332 if (rdev->pm.default_vddc) in radeon_pm_resume_dpm()
1333 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc, in radeon_pm_resume_dpm()
1335 if (rdev->pm.default_vddci) in radeon_pm_resume_dpm()
1336 radeon_atom_set_voltage(rdev, rdev->pm.default_vddci, in radeon_pm_resume_dpm()
1338 if (rdev->pm.default_sclk) in radeon_pm_resume_dpm()
1339 radeon_set_engine_clock(rdev, rdev->pm.default_sclk); in radeon_pm_resume_dpm()
1340 if (rdev->pm.default_mclk) in radeon_pm_resume_dpm()
1341 radeon_set_memory_clock(rdev, rdev->pm.default_mclk); in radeon_pm_resume_dpm()
1347 if (rdev->pm.pm_method == PM_METHOD_DPM) in radeon_pm_resume()
1357 rdev->pm.profile = PM_PROFILE_DEFAULT; in radeon_pm_init_old()
1358 rdev->pm.dynpm_state = DYNPM_STATE_DISABLED; in radeon_pm_init_old()
1359 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; in radeon_pm_init_old()
1360 rdev->pm.dynpm_can_upclock = true; in radeon_pm_init_old()
1361 rdev->pm.dynpm_can_downclock = true; in radeon_pm_init_old()
1362 rdev->pm.default_sclk = rdev->clock.default_sclk; in radeon_pm_init_old()
1363 rdev->pm.default_mclk = rdev->clock.default_mclk; in radeon_pm_init_old()
1364 rdev->pm.current_sclk = rdev->clock.default_sclk; in radeon_pm_init_old()
1365 rdev->pm.current_mclk = rdev->clock.default_mclk; in radeon_pm_init_old()
1366 rdev->pm.int_thermal_type = THERMAL_TYPE_NONE; in radeon_pm_init_old()
1368 if (rdev->bios) { in radeon_pm_init_old()
1369 if (rdev->is_atom_bios) in radeon_pm_init_old()
1376 if ((rdev->family >= CHIP_BARTS) && in radeon_pm_init_old()
1377 (rdev->family <= CHIP_CAYMAN) && in radeon_pm_init_old()
1378 rdev->mc_fw) { in radeon_pm_init_old()
1379 if (rdev->pm.default_vddc) in radeon_pm_init_old()
1380 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc, in radeon_pm_init_old()
1382 if (rdev->pm.default_vddci) in radeon_pm_init_old()
1383 radeon_atom_set_voltage(rdev, rdev->pm.default_vddci, in radeon_pm_init_old()
1385 if (rdev->pm.default_sclk) in radeon_pm_init_old()
1386 radeon_set_engine_clock(rdev, rdev->pm.default_sclk); in radeon_pm_init_old()
1387 if (rdev->pm.default_mclk) in radeon_pm_init_old()
1388 radeon_set_memory_clock(rdev, rdev->pm.default_mclk); in radeon_pm_init_old()
1397 INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler); in radeon_pm_init_old()
1399 if (rdev->pm.num_power_states > 1) { in radeon_pm_init_old()
1411 for (i = 0; i < rdev->pm.dpm.num_ps; i++) { in radeon_dpm_print_power_states()
1413 radeon_dpm_print_power_state(rdev, &rdev->pm.dpm.ps[i]); in radeon_dpm_print_power_states()
1422 rdev->pm.dpm.state = POWER_STATE_TYPE_BALANCED; in radeon_pm_init_dpm()
1423 rdev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED; in radeon_pm_init_dpm()
1424 rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; in radeon_pm_init_dpm()
1425 rdev->pm.default_sclk = rdev->clock.default_sclk; in radeon_pm_init_dpm()
1426 rdev->pm.default_mclk = rdev->clock.default_mclk; in radeon_pm_init_dpm()
1427 rdev->pm.current_sclk = rdev->clock.default_sclk; in radeon_pm_init_dpm()
1428 rdev->pm.current_mclk = rdev->clock.default_mclk; in radeon_pm_init_dpm()
1429 rdev->pm.int_thermal_type = THERMAL_TYPE_NONE; in radeon_pm_init_dpm()
1431 if (rdev->bios && rdev->is_atom_bios) in radeon_pm_init_dpm()
1434 return -EINVAL; in radeon_pm_init_dpm()
1441 INIT_WORK(&rdev->pm.dpm.thermal.work, radeon_dpm_thermal_work_handler); in radeon_pm_init_dpm()
1442 mutex_lock(&rdev->pm.mutex); in radeon_pm_init_dpm()
1444 rdev->pm.dpm.current_ps = rdev->pm.dpm.requested_ps = rdev->pm.dpm.boot_ps; in radeon_pm_init_dpm()
1449 mutex_unlock(&rdev->pm.mutex); in radeon_pm_init_dpm()
1452 rdev->pm.dpm_enabled = true; in radeon_pm_init_dpm()
1461 rdev->pm.dpm_enabled = false; in radeon_pm_init_dpm()
1462 if ((rdev->family >= CHIP_BARTS) && in radeon_pm_init_dpm()
1463 (rdev->family <= CHIP_CAYMAN) && in radeon_pm_init_dpm()
1464 rdev->mc_fw) { in radeon_pm_init_dpm()
1465 if (rdev->pm.default_vddc) in radeon_pm_init_dpm()
1466 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc, in radeon_pm_init_dpm()
1468 if (rdev->pm.default_vddci) in radeon_pm_init_dpm()
1469 radeon_atom_set_voltage(rdev, rdev->pm.default_vddci, in radeon_pm_init_dpm()
1471 if (rdev->pm.default_sclk) in radeon_pm_init_dpm()
1472 radeon_set_engine_clock(rdev, rdev->pm.default_sclk); in radeon_pm_init_dpm()
1473 if (rdev->pm.default_mclk) in radeon_pm_init_dpm()
1474 radeon_set_memory_clock(rdev, rdev->pm.default_mclk); in radeon_pm_init_dpm()
1489 /* TURKS - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1386534 */
1491 /* TURKS - https://bugzilla.kernel.org/show_bug.cgi?id=83731 */
1502 while (p && p->chip_device != 0) { in radeon_pm_init()
1503 if (rdev->pdev->vendor == p->chip_vendor && in radeon_pm_init()
1504 rdev->pdev->device == p->chip_device && in radeon_pm_init()
1505 rdev->pdev->subsystem_vendor == p->subsys_vendor && in radeon_pm_init()
1506 rdev->pdev->subsystem_device == p->subsys_device) { in radeon_pm_init()
1514 switch (rdev->family) { in radeon_pm_init()
1524 if (!rdev->rlc_fw) in radeon_pm_init()
1525 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_pm_init()
1526 else if ((rdev->family >= CHIP_RV770) && in radeon_pm_init()
1527 (!(rdev->flags & RADEON_IS_IGP)) && in radeon_pm_init()
1528 (!rdev->smc_fw)) in radeon_pm_init()
1529 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_pm_init()
1531 rdev->pm.pm_method = PM_METHOD_DPM; in radeon_pm_init()
1533 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_pm_init()
1562 if (!rdev->rlc_fw) in radeon_pm_init()
1563 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_pm_init()
1564 else if ((rdev->family >= CHIP_RV770) && in radeon_pm_init()
1565 (!(rdev->flags & RADEON_IS_IGP)) && in radeon_pm_init()
1566 (!rdev->smc_fw)) in radeon_pm_init()
1567 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_pm_init()
1568 else if (disable_dpm && (radeon_dpm == -1)) in radeon_pm_init()
1569 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_pm_init()
1571 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_pm_init()
1573 rdev->pm.pm_method = PM_METHOD_DPM; in radeon_pm_init()
1577 rdev->pm.pm_method = PM_METHOD_PROFILE; in radeon_pm_init()
1581 if (rdev->pm.pm_method == PM_METHOD_DPM) in radeon_pm_init()
1591 if (rdev->pm.pm_method == PM_METHOD_DPM) { in radeon_pm_late_init()
1592 if (rdev->pm.dpm_enabled) { in radeon_pm_late_init()
1593 if (!rdev->pm.sysfs_initialized) { in radeon_pm_late_init()
1594 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state); in radeon_pm_late_init()
1597 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level); in radeon_pm_late_init()
1601 ret = device_create_file(rdev->dev, &dev_attr_power_profile); in radeon_pm_late_init()
1604 ret = device_create_file(rdev->dev, &dev_attr_power_method); in radeon_pm_late_init()
1607 rdev->pm.sysfs_initialized = true; in radeon_pm_late_init()
1610 mutex_lock(&rdev->pm.mutex); in radeon_pm_late_init()
1612 mutex_unlock(&rdev->pm.mutex); in radeon_pm_late_init()
1614 rdev->pm.dpm_enabled = false; in radeon_pm_late_init()
1624 if ((rdev->pm.num_power_states > 1) && in radeon_pm_late_init()
1625 (!rdev->pm.sysfs_initialized)) { in radeon_pm_late_init()
1627 ret = device_create_file(rdev->dev, &dev_attr_power_profile); in radeon_pm_late_init()
1630 ret = device_create_file(rdev->dev, &dev_attr_power_method); in radeon_pm_late_init()
1634 rdev->pm.sysfs_initialized = true; in radeon_pm_late_init()
1642 if (rdev->pm.num_power_states > 1) { in radeon_pm_fini_old()
1643 mutex_lock(&rdev->pm.mutex); in radeon_pm_fini_old()
1644 if (rdev->pm.pm_method == PM_METHOD_PROFILE) { in radeon_pm_fini_old()
1645 rdev->pm.profile = PM_PROFILE_DEFAULT; in radeon_pm_fini_old()
1648 } else if (rdev->pm.pm_method == PM_METHOD_DYNPM) { in radeon_pm_fini_old()
1650 rdev->pm.dynpm_state = DYNPM_STATE_DISABLED; in radeon_pm_fini_old()
1651 rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT; in radeon_pm_fini_old()
1654 mutex_unlock(&rdev->pm.mutex); in radeon_pm_fini_old()
1656 cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); in radeon_pm_fini_old()
1658 device_remove_file(rdev->dev, &dev_attr_power_profile); in radeon_pm_fini_old()
1659 device_remove_file(rdev->dev, &dev_attr_power_method); in radeon_pm_fini_old()
1663 kfree(rdev->pm.power_state); in radeon_pm_fini_old()
1668 if (rdev->pm.num_power_states > 1) { in radeon_pm_fini_dpm()
1669 mutex_lock(&rdev->pm.mutex); in radeon_pm_fini_dpm()
1671 mutex_unlock(&rdev->pm.mutex); in radeon_pm_fini_dpm()
1673 device_remove_file(rdev->dev, &dev_attr_power_dpm_state); in radeon_pm_fini_dpm()
1674 device_remove_file(rdev->dev, &dev_attr_power_dpm_force_performance_level); in radeon_pm_fini_dpm()
1676 device_remove_file(rdev->dev, &dev_attr_power_profile); in radeon_pm_fini_dpm()
1677 device_remove_file(rdev->dev, &dev_attr_power_method); in radeon_pm_fini_dpm()
1682 kfree(rdev->pm.power_state); in radeon_pm_fini_dpm()
1687 if (rdev->pm.pm_method == PM_METHOD_DPM) in radeon_pm_fini()
1699 if (rdev->pm.num_power_states < 2) in radeon_pm_compute_clocks_old()
1702 mutex_lock(&rdev->pm.mutex); in radeon_pm_compute_clocks_old()
1704 rdev->pm.active_crtcs = 0; in radeon_pm_compute_clocks_old()
1705 rdev->pm.active_crtc_count = 0; in radeon_pm_compute_clocks_old()
1706 if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { in radeon_pm_compute_clocks_old()
1708 &ddev->mode_config.crtc_list, head) { in radeon_pm_compute_clocks_old()
1710 if (radeon_crtc->enabled) { in radeon_pm_compute_clocks_old()
1711 rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id); in radeon_pm_compute_clocks_old()
1712 rdev->pm.active_crtc_count++; in radeon_pm_compute_clocks_old()
1717 if (rdev->pm.pm_method == PM_METHOD_PROFILE) { in radeon_pm_compute_clocks_old()
1720 } else if (rdev->pm.pm_method == PM_METHOD_DYNPM) { in radeon_pm_compute_clocks_old()
1721 if (rdev->pm.dynpm_state != DYNPM_STATE_DISABLED) { in radeon_pm_compute_clocks_old()
1722 if (rdev->pm.active_crtc_count > 1) { in radeon_pm_compute_clocks_old()
1723 if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) { in radeon_pm_compute_clocks_old()
1724 cancel_delayed_work(&rdev->pm.dynpm_idle_work); in radeon_pm_compute_clocks_old()
1726 rdev->pm.dynpm_state = DYNPM_STATE_PAUSED; in radeon_pm_compute_clocks_old()
1727 rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT; in radeon_pm_compute_clocks_old()
1733 } else if (rdev->pm.active_crtc_count == 1) { in radeon_pm_compute_clocks_old()
1736 if (rdev->pm.dynpm_state == DYNPM_STATE_MINIMUM) { in radeon_pm_compute_clocks_old()
1737 rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; in radeon_pm_compute_clocks_old()
1738 rdev->pm.dynpm_planned_action = DYNPM_ACTION_UPCLOCK; in radeon_pm_compute_clocks_old()
1742 schedule_delayed_work(&rdev->pm.dynpm_idle_work, in radeon_pm_compute_clocks_old()
1744 } else if (rdev->pm.dynpm_state == DYNPM_STATE_PAUSED) { in radeon_pm_compute_clocks_old()
1745 rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; in radeon_pm_compute_clocks_old()
1746 schedule_delayed_work(&rdev->pm.dynpm_idle_work, in radeon_pm_compute_clocks_old()
1751 if (rdev->pm.dynpm_state != DYNPM_STATE_MINIMUM) { in radeon_pm_compute_clocks_old()
1752 cancel_delayed_work(&rdev->pm.dynpm_idle_work); in radeon_pm_compute_clocks_old()
1754 rdev->pm.dynpm_state = DYNPM_STATE_MINIMUM; in radeon_pm_compute_clocks_old()
1755 rdev->pm.dynpm_planned_action = DYNPM_ACTION_MINIMUM; in radeon_pm_compute_clocks_old()
1763 mutex_unlock(&rdev->pm.mutex); in radeon_pm_compute_clocks_old()
1773 if (!rdev->pm.dpm_enabled) in radeon_pm_compute_clocks_dpm()
1776 mutex_lock(&rdev->pm.mutex); in radeon_pm_compute_clocks_dpm()
1779 rdev->pm.dpm.new_active_crtcs = 0; in radeon_pm_compute_clocks_dpm()
1780 rdev->pm.dpm.new_active_crtc_count = 0; in radeon_pm_compute_clocks_dpm()
1781 rdev->pm.dpm.high_pixelclock_count = 0; in radeon_pm_compute_clocks_dpm()
1782 if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { in radeon_pm_compute_clocks_dpm()
1784 &ddev->mode_config.crtc_list, head) { in radeon_pm_compute_clocks_dpm()
1786 if (crtc->enabled) { in radeon_pm_compute_clocks_dpm()
1787 rdev->pm.dpm.new_active_crtcs |= (1 << radeon_crtc->crtc_id); in radeon_pm_compute_clocks_dpm()
1788 rdev->pm.dpm.new_active_crtc_count++; in radeon_pm_compute_clocks_dpm()
1789 if (!radeon_crtc->connector) in radeon_pm_compute_clocks_dpm()
1792 radeon_connector = to_radeon_connector(radeon_crtc->connector); in radeon_pm_compute_clocks_dpm()
1793 if (radeon_connector->pixelclock_for_modeset > 297000) in radeon_pm_compute_clocks_dpm()
1794 rdev->pm.dpm.high_pixelclock_count++; in radeon_pm_compute_clocks_dpm()
1801 rdev->pm.dpm.ac_power = true; in radeon_pm_compute_clocks_dpm()
1803 rdev->pm.dpm.ac_power = false; in radeon_pm_compute_clocks_dpm()
1807 mutex_unlock(&rdev->pm.mutex); in radeon_pm_compute_clocks_dpm()
1813 if (rdev->pm.pm_method == PM_METHOD_DPM) in radeon_pm_compute_clocks()
1827 for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) { in radeon_pm_in_vbl()
1828 if (rdev->pm.active_crtcs & (1 << crtc)) { in radeon_pm_in_vbl()
1833 &rdev->mode_info.crtcs[crtc]->base.hwmode); in radeon_pm_in_vbl()
1861 mutex_lock(&rdev->pm.mutex); in radeon_dynpm_idle_work_handler()
1862 if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) { in radeon_dynpm_idle_work_handler()
1867 struct radeon_ring *ring = &rdev->ring[i]; in radeon_dynpm_idle_work_handler()
1869 if (ring->ready) { in radeon_dynpm_idle_work_handler()
1877 if (rdev->pm.dynpm_planned_action == DYNPM_ACTION_DOWNCLOCK) { in radeon_dynpm_idle_work_handler()
1878 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; in radeon_dynpm_idle_work_handler()
1879 } else if (rdev->pm.dynpm_planned_action == DYNPM_ACTION_NONE && in radeon_dynpm_idle_work_handler()
1880 rdev->pm.dynpm_can_upclock) { in radeon_dynpm_idle_work_handler()
1881 rdev->pm.dynpm_planned_action = in radeon_dynpm_idle_work_handler()
1883 rdev->pm.dynpm_action_timeout = jiffies + in radeon_dynpm_idle_work_handler()
1887 if (rdev->pm.dynpm_planned_action == DYNPM_ACTION_UPCLOCK) { in radeon_dynpm_idle_work_handler()
1888 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; in radeon_dynpm_idle_work_handler()
1889 } else if (rdev->pm.dynpm_planned_action == DYNPM_ACTION_NONE && in radeon_dynpm_idle_work_handler()
1890 rdev->pm.dynpm_can_downclock) { in radeon_dynpm_idle_work_handler()
1891 rdev->pm.dynpm_planned_action = in radeon_dynpm_idle_work_handler()
1893 rdev->pm.dynpm_action_timeout = jiffies + in radeon_dynpm_idle_work_handler()
1901 if (rdev->pm.dynpm_planned_action != DYNPM_ACTION_NONE && in radeon_dynpm_idle_work_handler()
1902 time_after(jiffies, rdev->pm.dynpm_action_timeout)) { in radeon_dynpm_idle_work_handler()
1907 schedule_delayed_work(&rdev->pm.dynpm_idle_work, in radeon_dynpm_idle_work_handler()
1910 mutex_unlock(&rdev->pm.mutex); in radeon_dynpm_idle_work_handler()
1920 struct radeon_device *rdev = m->private; in radeon_debugfs_pm_info_show()
1923 if ((rdev->flags & RADEON_IS_PX) && in radeon_debugfs_pm_info_show()
1924 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) { in radeon_debugfs_pm_info_show()
1926 } else if (rdev->pm.dpm_enabled) { in radeon_debugfs_pm_info_show()
1927 mutex_lock(&rdev->pm.mutex); in radeon_debugfs_pm_info_show()
1928 if (rdev->asic->dpm.debugfs_print_current_performance_level) in radeon_debugfs_pm_info_show()
1932 mutex_unlock(&rdev->pm.mutex); in radeon_debugfs_pm_info_show()
1934 seq_printf(m, "default engine clock: %u0 kHz\n", rdev->pm.default_sclk); in radeon_debugfs_pm_info_show()
1936 if ((rdev->family >= CHIP_PALM) && (rdev->flags & RADEON_IS_IGP)) in radeon_debugfs_pm_info_show()
1937 seq_printf(m, "current engine clock: %u0 kHz\n", rdev->pm.current_sclk); in radeon_debugfs_pm_info_show()
1940 seq_printf(m, "default memory clock: %u0 kHz\n", rdev->pm.default_mclk); in radeon_debugfs_pm_info_show()
1941 if (rdev->asic->pm.get_memory_clock) in radeon_debugfs_pm_info_show()
1943 if (rdev->pm.current_vddc) in radeon_debugfs_pm_info_show()
1944 seq_printf(m, "voltage: %u mV\n", rdev->pm.current_vddc); in radeon_debugfs_pm_info_show()
1945 if (rdev->asic->pm.get_pcie_lanes) in radeon_debugfs_pm_info_show()
1958 struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root; in radeon_debugfs_pm_init()