Lines Matching refs:hwmgr

29 int psm_init_power_state_table(struct pp_hwmgr *hwmgr)  in psm_init_power_state_table()  argument
36 if (hwmgr->hwmgr_func->get_num_of_pp_table_entries == NULL) in psm_init_power_state_table()
39 if (hwmgr->hwmgr_func->get_power_state_size == NULL) in psm_init_power_state_table()
42 table_entries = hwmgr->hwmgr_func->get_num_of_pp_table_entries(hwmgr); in psm_init_power_state_table()
44 size = hwmgr->hwmgr_func->get_power_state_size(hwmgr) + in psm_init_power_state_table()
49 hwmgr->num_ps = 0; in psm_init_power_state_table()
50 hwmgr->ps_size = 0; in psm_init_power_state_table()
53 hwmgr->num_ps = table_entries; in psm_init_power_state_table()
54 hwmgr->ps_size = size; in psm_init_power_state_table()
56 hwmgr->ps = kcalloc(table_entries, size, GFP_KERNEL); in psm_init_power_state_table()
57 if (hwmgr->ps == NULL) in psm_init_power_state_table()
60 hwmgr->request_ps = kzalloc(size, GFP_KERNEL); in psm_init_power_state_table()
61 if (hwmgr->request_ps == NULL) { in psm_init_power_state_table()
62 kfree(hwmgr->ps); in psm_init_power_state_table()
63 hwmgr->ps = NULL; in psm_init_power_state_table()
67 hwmgr->current_ps = kzalloc(size, GFP_KERNEL); in psm_init_power_state_table()
68 if (hwmgr->current_ps == NULL) { in psm_init_power_state_table()
69 kfree(hwmgr->request_ps); in psm_init_power_state_table()
70 kfree(hwmgr->ps); in psm_init_power_state_table()
71 hwmgr->request_ps = NULL; in psm_init_power_state_table()
72 hwmgr->ps = NULL; in psm_init_power_state_table()
76 state = hwmgr->ps; in psm_init_power_state_table()
79 result = hwmgr->hwmgr_func->get_pp_table_entry(hwmgr, i, state); in psm_init_power_state_table()
81 kfree(hwmgr->current_ps); in psm_init_power_state_table()
82 kfree(hwmgr->request_ps); in psm_init_power_state_table()
83 kfree(hwmgr->ps); in psm_init_power_state_table()
84 hwmgr->current_ps = NULL; in psm_init_power_state_table()
85 hwmgr->request_ps = NULL; in psm_init_power_state_table()
86 hwmgr->ps = NULL; in psm_init_power_state_table()
91 hwmgr->boot_ps = state; in psm_init_power_state_table()
92 memcpy(hwmgr->current_ps, state, size); in psm_init_power_state_table()
93 memcpy(hwmgr->request_ps, state, size); in psm_init_power_state_table()
99 hwmgr->uvd_ps = state; in psm_init_power_state_table()
106 int psm_fini_power_state_table(struct pp_hwmgr *hwmgr) in psm_fini_power_state_table() argument
108 if (hwmgr == NULL) in psm_fini_power_state_table()
111 if (!hwmgr->ps) in psm_fini_power_state_table()
114 kfree(hwmgr->current_ps); in psm_fini_power_state_table()
115 kfree(hwmgr->request_ps); in psm_fini_power_state_table()
116 kfree(hwmgr->ps); in psm_fini_power_state_table()
117 hwmgr->request_ps = NULL; in psm_fini_power_state_table()
118 hwmgr->ps = NULL; in psm_fini_power_state_table()
119 hwmgr->current_ps = NULL; in psm_fini_power_state_table()
123 static int psm_get_ui_state(struct pp_hwmgr *hwmgr, in psm_get_ui_state() argument
131 table_entries = hwmgr->num_ps; in psm_get_ui_state()
132 state = hwmgr->ps; in psm_get_ui_state()
139 state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size); in psm_get_ui_state()
144 static int psm_get_state_by_classification(struct pp_hwmgr *hwmgr, in psm_get_state_by_classification() argument
152 table_entries = hwmgr->num_ps; in psm_get_state_by_classification()
153 state = hwmgr->ps; in psm_get_state_by_classification()
160 state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size); in psm_get_state_by_classification()
165 static int psm_set_states(struct pp_hwmgr *hwmgr, unsigned long state_id) in psm_set_states() argument
171 table_entries = hwmgr->num_ps; in psm_set_states()
173 state = hwmgr->ps; in psm_set_states()
177 memcpy(hwmgr->request_ps, state, hwmgr->ps_size); in psm_set_states()
180 state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size); in psm_set_states()
185 int psm_set_boot_states(struct pp_hwmgr *hwmgr) in psm_set_boot_states() argument
190 if (!hwmgr->ps) in psm_set_boot_states()
193 if (!psm_get_state_by_classification(hwmgr, PP_StateClassificationFlag_Boot, in psm_set_boot_states()
195 ret = psm_set_states(hwmgr, state_id); in psm_set_boot_states()
200 int psm_set_performance_states(struct pp_hwmgr *hwmgr) in psm_set_performance_states() argument
205 if (!hwmgr->ps) in psm_set_performance_states()
208 if (!psm_get_ui_state(hwmgr, PP_StateUILabel_Performance, in psm_set_performance_states()
210 ret = psm_set_states(hwmgr, state_id); in psm_set_performance_states()
215 int psm_set_user_performance_state(struct pp_hwmgr *hwmgr, in psm_set_user_performance_state() argument
222 if (!hwmgr->ps) in psm_set_user_performance_state()
225 table_entries = hwmgr->num_ps; in psm_set_user_performance_state()
226 *state = hwmgr->ps; in psm_set_user_performance_state()
232 *state = (struct pp_power_state *)((uintptr_t)*state + hwmgr->ps_size); in psm_set_user_performance_state()
246 static void power_state_management(struct pp_hwmgr *hwmgr, in power_state_management() argument
256 requested = hwmgr->request_ps; in power_state_management()
258 pcurrent = hwmgr->current_ps; in power_state_management()
260 phm_apply_state_adjust_rules(hwmgr, requested, pcurrent); in power_state_management()
261 if (pcurrent == NULL || (0 != phm_check_states_equal(hwmgr, in power_state_management()
265 if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) { in power_state_management()
266 phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware); in power_state_management()
267 memcpy(hwmgr->current_ps, hwmgr->request_ps, hwmgr->ps_size); in power_state_management()
271 int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip_display_settings, in psm_adjust_power_state_dynamic() argument
277 if (hwmgr->not_vf) { in psm_adjust_power_state_dynamic()
279 phm_display_configuration_changed(hwmgr); in psm_adjust_power_state_dynamic()
281 if (hwmgr->ps) in psm_adjust_power_state_dynamic()
282 power_state_management(hwmgr, new_ps); in psm_adjust_power_state_dynamic()
288 phm_apply_clock_adjust_rules(hwmgr); in psm_adjust_power_state_dynamic()
291 phm_notify_smc_display_config_after_ps_adjustment(hwmgr); in psm_adjust_power_state_dynamic()
294 if (!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level)) in psm_adjust_power_state_dynamic()
295 hwmgr->dpm_level = hwmgr->request_dpm_level; in psm_adjust_power_state_dynamic()
297 if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) { in psm_adjust_power_state_dynamic()
298 index = fls(hwmgr->workload_mask); in psm_adjust_power_state_dynamic()
300 workload[0] = hwmgr->workload_setting[index]; in psm_adjust_power_state_dynamic()
302 if (hwmgr->power_profile_mode != workload[0] && hwmgr->hwmgr_func->set_power_profile_mode) in psm_adjust_power_state_dynamic()
303 hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, workload, 0); in psm_adjust_power_state_dynamic()