]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/gpu/drm/amd/powerplay/eventmgr/eventactionchains.c
Merge remote-tracking branches 'asoc/topic/inntel', 'asoc/topic/input', 'asoc/topic...
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / amd / powerplay / eventmgr / eventactionchains.c
1 /*
2 * Copyright 2015 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 */
23 #include "eventmgr.h"
24 #include "eventactionchains.h"
25 #include "eventsubchains.h"
26
27 static const pem_event_action * const initialize_event[] = {
28 block_adjust_power_state_tasks,
29 power_budget_tasks,
30 system_config_tasks,
31 setup_asic_tasks,
32 enable_dynamic_state_management_tasks,
33 get_2d_performance_state_tasks,
34 set_performance_state_tasks,
35 initialize_thermal_controller_tasks,
36 conditionally_force_3d_performance_state_tasks,
37 process_vbios_eventinfo_tasks,
38 broadcast_power_policy_tasks,
39 NULL
40 };
41
42 const struct action_chain initialize_action_chain = {
43 "Initialize",
44 initialize_event
45 };
46
47 static const pem_event_action * const uninitialize_event[] = {
48 ungate_all_display_phys_tasks,
49 uninitialize_display_phy_access_tasks,
50 disable_gfx_voltage_island_power_gating_tasks,
51 disable_gfx_clock_gating_tasks,
52 uninitialize_thermal_controller_tasks,
53 set_boot_state_tasks,
54 adjust_power_state_tasks,
55 disable_dynamic_state_management_tasks,
56 disable_clock_power_gatings_tasks,
57 cleanup_asic_tasks,
58 prepare_for_pnp_stop_tasks,
59 NULL
60 };
61
62 const struct action_chain uninitialize_action_chain = {
63 "Uninitialize",
64 uninitialize_event
65 };
66
67 static const pem_event_action * const power_source_change_event_pp_enabled[] = {
68 set_power_source_tasks,
69 set_power_saving_state_tasks,
70 adjust_power_state_tasks,
71 enable_disable_fps_tasks,
72 set_nbmcu_state_tasks,
73 broadcast_power_policy_tasks,
74 NULL
75 };
76
77 const struct action_chain power_source_change_action_chain_pp_enabled = {
78 "Power source change - PowerPlay enabled",
79 power_source_change_event_pp_enabled
80 };
81
82 static const pem_event_action * const power_source_change_event_pp_disabled[] = {
83 set_power_source_tasks,
84 set_nbmcu_state_tasks,
85 NULL
86 };
87
88 const struct action_chain power_source_changes_action_chain_pp_disabled = {
89 "Power source change - PowerPlay disabled",
90 power_source_change_event_pp_disabled
91 };
92
93 static const pem_event_action * const power_source_change_event_hardware_dc[] = {
94 set_power_source_tasks,
95 set_power_saving_state_tasks,
96 adjust_power_state_tasks,
97 enable_disable_fps_tasks,
98 reset_hardware_dc_notification_tasks,
99 set_nbmcu_state_tasks,
100 broadcast_power_policy_tasks,
101 NULL
102 };
103
104 const struct action_chain power_source_change_action_chain_hardware_dc = {
105 "Power source change - with Hardware DC switching",
106 power_source_change_event_hardware_dc
107 };
108
109 static const pem_event_action * const suspend_event[] = {
110 reset_display_phy_access_tasks,
111 unregister_interrupt_tasks,
112 disable_gfx_voltage_island_power_gating_tasks,
113 disable_gfx_clock_gating_tasks,
114 notify_smu_suspend_tasks,
115 disable_smc_firmware_ctf_tasks,
116 set_boot_state_tasks,
117 adjust_power_state_tasks,
118 disable_fps_tasks,
119 vari_bright_suspend_tasks,
120 reset_fan_speed_to_default_tasks,
121 power_down_asic_tasks,
122 disable_stutter_mode_tasks,
123 set_connected_standby_tasks,
124 block_hw_access_tasks,
125 NULL
126 };
127
128 const struct action_chain suspend_action_chain = {
129 "Suspend",
130 suspend_event
131 };
132
133 static const pem_event_action * const resume_event[] = {
134 unblock_hw_access_tasks,
135 resume_connected_standby_tasks,
136 notify_smu_resume_tasks,
137 reset_display_configCounter_tasks,
138 update_dal_configuration_tasks,
139 vari_bright_resume_tasks,
140 setup_asic_tasks,
141 enable_stutter_mode_tasks, /*must do this in boot state and before SMC is started */
142 enable_dynamic_state_management_tasks,
143 enable_disable_bapm_tasks,
144 initialize_thermal_controller_tasks,
145 get_2d_performance_state_tasks,
146 set_performance_state_tasks,
147 adjust_power_state_tasks,
148 enable_disable_fps_tasks,
149 notify_hw_power_source_tasks,
150 process_vbios_event_info_tasks,
151 enable_gfx_clock_gating_tasks,
152 enable_gfx_voltage_island_power_gating_tasks,
153 reset_clock_gating_tasks,
154 notify_smu_vpu_recovery_end_tasks,
155 disable_vpu_cap_tasks,
156 execute_escape_sequence_tasks,
157 NULL
158 };
159
160
161 const struct action_chain resume_action_chain = {
162 "resume",
163 resume_event
164 };
165
166 static const pem_event_action * const complete_init_event[] = {
167 unblock_adjust_power_state_tasks,
168 adjust_power_state_tasks,
169 enable_gfx_clock_gating_tasks,
170 enable_gfx_voltage_island_power_gating_tasks,
171 notify_power_state_change_tasks,
172 NULL
173 };
174
175 const struct action_chain complete_init_action_chain = {
176 "complete init",
177 complete_init_event
178 };
179
180 static const pem_event_action * const enable_gfx_clock_gating_event[] = {
181 enable_gfx_clock_gating_tasks,
182 NULL
183 };
184
185 const struct action_chain enable_gfx_clock_gating_action_chain = {
186 "enable gfx clock gate",
187 enable_gfx_clock_gating_event
188 };
189
190 static const pem_event_action * const disable_gfx_clock_gating_event[] = {
191 disable_gfx_clock_gating_tasks,
192 NULL
193 };
194
195 const struct action_chain disable_gfx_clock_gating_action_chain = {
196 "disable gfx clock gate",
197 disable_gfx_clock_gating_event
198 };
199
200 static const pem_event_action * const enable_cgpg_event[] = {
201 enable_cgpg_tasks,
202 NULL
203 };
204
205 const struct action_chain enable_cgpg_action_chain = {
206 "eable cg pg",
207 enable_cgpg_event
208 };
209
210 static const pem_event_action * const disable_cgpg_event[] = {
211 disable_cgpg_tasks,
212 NULL
213 };
214
215 const struct action_chain disable_cgpg_action_chain = {
216 "disable cg pg",
217 disable_cgpg_event
218 };
219
220
221 /* Enable user _2d performance and activate */
222
223 static const pem_event_action * const enable_user_state_event[] = {
224 create_new_user_performance_state_tasks,
225 adjust_power_state_tasks,
226 NULL
227 };
228
229 const struct action_chain enable_user_state_action_chain = {
230 "Enable user state",
231 enable_user_state_event
232 };
233
234 static const pem_event_action * const enable_user_2d_performance_event[] = {
235 enable_user_2d_performance_tasks,
236 add_user_2d_performance_state_tasks,
237 set_performance_state_tasks,
238 adjust_power_state_tasks,
239 delete_user_2d_performance_state_tasks,
240 NULL
241 };
242
243 const struct action_chain enable_user_2d_performance_action_chain = {
244 "enable_user_2d_performance_event_activate",
245 enable_user_2d_performance_event
246 };
247
248
249 static const pem_event_action * const disable_user_2d_performance_event[] = {
250 disable_user_2d_performance_tasks,
251 delete_user_2d_performance_state_tasks,
252 NULL
253 };
254
255 const struct action_chain disable_user_2d_performance_action_chain = {
256 "disable_user_2d_performance_event",
257 disable_user_2d_performance_event
258 };
259
260
261 static const pem_event_action * const display_config_change_event[] = {
262 /* countDisplayConfigurationChangeEventTasks, */
263 unblock_adjust_power_state_tasks,
264 set_cpu_power_state,
265 notify_hw_power_source_tasks,
266 get_2d_performance_state_tasks,
267 set_performance_state_tasks,
268 /* updateDALConfigurationTasks,
269 variBrightDisplayConfigurationChangeTasks, */
270 adjust_power_state_tasks,
271 /*enableDisableFPSTasks,
272 setNBMCUStateTasks,
273 notifyPCIEDeviceReadyTasks,*/
274 NULL
275 };
276
277 const struct action_chain display_config_change_action_chain = {
278 "Display configuration change",
279 display_config_change_event
280 };
281
282 static const pem_event_action * const readjust_power_state_event[] = {
283 adjust_power_state_tasks,
284 NULL
285 };
286
287 const struct action_chain readjust_power_state_action_chain = {
288 "re-adjust power state",
289 readjust_power_state_event
290 };
291