Commit | Line | Data |
---|---|---|
e92a0370 RZ |
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 | ||
d3a84aa0 | 27 | static const pem_event_action * const initialize_event[] = { |
e92a0370 RZ |
28 | block_adjust_power_state_tasks, |
29 | power_budget_tasks, | |
30 | system_config_tasks, | |
31 | setup_asic_tasks, | |
32 | enable_dynamic_state_management_tasks, | |
e92a0370 RZ |
33 | get_2d_performance_state_tasks, |
34 | set_performance_state_tasks, | |
2dfea9cd | 35 | initialize_thermal_controller_tasks, |
e92a0370 RZ |
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 | ||
d3a84aa0 | 47 | static const pem_event_action * const uninitialize_event[] = { |
e92a0370 RZ |
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 | set_boot_state_tasks, | |
53 | adjust_power_state_tasks, | |
54 | disable_dynamic_state_management_tasks, | |
55 | disable_clock_power_gatings_tasks, | |
56 | cleanup_asic_tasks, | |
57 | prepare_for_pnp_stop_tasks, | |
58 | NULL | |
59 | }; | |
60 | ||
61 | const struct action_chain uninitialize_action_chain = { | |
62 | "Uninitialize", | |
63 | uninitialize_event | |
64 | }; | |
65 | ||
d3a84aa0 | 66 | static const pem_event_action * const power_source_change_event_pp_enabled[] = { |
e92a0370 RZ |
67 | set_power_source_tasks, |
68 | set_power_saving_state_tasks, | |
69 | adjust_power_state_tasks, | |
70 | enable_disable_fps_tasks, | |
71 | set_nbmcu_state_tasks, | |
72 | broadcast_power_policy_tasks, | |
73 | NULL | |
74 | }; | |
75 | ||
76 | const struct action_chain power_source_change_action_chain_pp_enabled = { | |
77 | "Power source change - PowerPlay enabled", | |
78 | power_source_change_event_pp_enabled | |
79 | }; | |
80 | ||
d3a84aa0 | 81 | static const pem_event_action * const power_source_change_event_pp_disabled[] = { |
e92a0370 RZ |
82 | set_power_source_tasks, |
83 | set_nbmcu_state_tasks, | |
84 | NULL | |
85 | }; | |
86 | ||
87 | const struct action_chain power_source_changes_action_chain_pp_disabled = { | |
88 | "Power source change - PowerPlay disabled", | |
89 | power_source_change_event_pp_disabled | |
90 | }; | |
91 | ||
d3a84aa0 | 92 | static const pem_event_action * const power_source_change_event_hardware_dc[] = { |
e92a0370 RZ |
93 | set_power_source_tasks, |
94 | set_power_saving_state_tasks, | |
95 | adjust_power_state_tasks, | |
96 | enable_disable_fps_tasks, | |
97 | reset_hardware_dc_notification_tasks, | |
98 | set_nbmcu_state_tasks, | |
99 | broadcast_power_policy_tasks, | |
100 | NULL | |
101 | }; | |
102 | ||
103 | const struct action_chain power_source_change_action_chain_hardware_dc = { | |
104 | "Power source change - with Hardware DC switching", | |
105 | power_source_change_event_hardware_dc | |
106 | }; | |
107 | ||
d3a84aa0 | 108 | static const pem_event_action * const suspend_event[] = { |
e92a0370 RZ |
109 | reset_display_phy_access_tasks, |
110 | unregister_interrupt_tasks, | |
111 | disable_gfx_voltage_island_power_gating_tasks, | |
112 | disable_gfx_clock_gating_tasks, | |
113 | notify_smu_suspend_tasks, | |
114 | disable_smc_firmware_ctf_tasks, | |
115 | set_boot_state_tasks, | |
116 | adjust_power_state_tasks, | |
117 | disable_fps_tasks, | |
118 | vari_bright_suspend_tasks, | |
119 | reset_fan_speed_to_default_tasks, | |
120 | power_down_asic_tasks, | |
121 | disable_stutter_mode_tasks, | |
122 | set_connected_standby_tasks, | |
123 | block_hw_access_tasks, | |
124 | NULL | |
125 | }; | |
126 | ||
127 | const struct action_chain suspend_action_chain = { | |
128 | "Suspend", | |
129 | suspend_event | |
130 | }; | |
131 | ||
d3a84aa0 | 132 | static const pem_event_action * const resume_event[] = { |
e92a0370 RZ |
133 | unblock_hw_access_tasks, |
134 | resume_connected_standby_tasks, | |
135 | notify_smu_resume_tasks, | |
136 | reset_display_configCounter_tasks, | |
137 | update_dal_configuration_tasks, | |
138 | vari_bright_resume_tasks, | |
e92a0370 RZ |
139 | setup_asic_tasks, |
140 | enable_stutter_mode_tasks, /*must do this in boot state and before SMC is started */ | |
141 | enable_dynamic_state_management_tasks, | |
e92a0370 | 142 | enable_disable_bapm_tasks, |
f556c274 | 143 | initialize_thermal_controller_tasks, |
e0c77163 RZ |
144 | get_2d_performance_state_tasks, |
145 | set_performance_state_tasks, | |
e92a0370 RZ |
146 | adjust_power_state_tasks, |
147 | enable_disable_fps_tasks, | |
148 | notify_hw_power_source_tasks, | |
149 | process_vbios_event_info_tasks, | |
150 | enable_gfx_clock_gating_tasks, | |
151 | enable_gfx_voltage_island_power_gating_tasks, | |
152 | reset_clock_gating_tasks, | |
153 | notify_smu_vpu_recovery_end_tasks, | |
154 | disable_vpu_cap_tasks, | |
155 | execute_escape_sequence_tasks, | |
156 | NULL | |
157 | }; | |
158 | ||
159 | ||
160 | const struct action_chain resume_action_chain = { | |
161 | "resume", | |
162 | resume_event | |
163 | }; | |
164 | ||
d3a84aa0 | 165 | static const pem_event_action * const complete_init_event[] = { |
dc26a2a2 | 166 | unblock_adjust_power_state_tasks, |
e92a0370 RZ |
167 | adjust_power_state_tasks, |
168 | enable_gfx_clock_gating_tasks, | |
169 | enable_gfx_voltage_island_power_gating_tasks, | |
170 | notify_power_state_change_tasks, | |
171 | NULL | |
172 | }; | |
173 | ||
174 | const struct action_chain complete_init_action_chain = { | |
175 | "complete init", | |
176 | complete_init_event | |
177 | }; | |
178 | ||
d3a84aa0 | 179 | static const pem_event_action * const enable_gfx_clock_gating_event[] = { |
e92a0370 RZ |
180 | enable_gfx_clock_gating_tasks, |
181 | NULL | |
182 | }; | |
183 | ||
184 | const struct action_chain enable_gfx_clock_gating_action_chain = { | |
185 | "enable gfx clock gate", | |
186 | enable_gfx_clock_gating_event | |
187 | }; | |
188 | ||
d3a84aa0 | 189 | static const pem_event_action * const disable_gfx_clock_gating_event[] = { |
e92a0370 RZ |
190 | disable_gfx_clock_gating_tasks, |
191 | NULL | |
192 | }; | |
193 | ||
194 | const struct action_chain disable_gfx_clock_gating_action_chain = { | |
195 | "disable gfx clock gate", | |
196 | disable_gfx_clock_gating_event | |
197 | }; | |
198 | ||
d3a84aa0 | 199 | static const pem_event_action * const enable_cgpg_event[] = { |
e92a0370 RZ |
200 | enable_cgpg_tasks, |
201 | NULL | |
202 | }; | |
203 | ||
204 | const struct action_chain enable_cgpg_action_chain = { | |
205 | "eable cg pg", | |
206 | enable_cgpg_event | |
207 | }; | |
208 | ||
d3a84aa0 | 209 | static const pem_event_action * const disable_cgpg_event[] = { |
e92a0370 RZ |
210 | disable_cgpg_tasks, |
211 | NULL | |
212 | }; | |
213 | ||
214 | const struct action_chain disable_cgpg_action_chain = { | |
215 | "disable cg pg", | |
216 | disable_cgpg_event | |
217 | }; | |
218 | ||
219 | ||
220 | /* Enable user _2d performance and activate */ | |
221 | ||
d3a84aa0 | 222 | static const pem_event_action * const enable_user_state_event[] = { |
e92a0370 RZ |
223 | create_new_user_performance_state_tasks, |
224 | adjust_power_state_tasks, | |
225 | NULL | |
226 | }; | |
227 | ||
228 | const struct action_chain enable_user_state_action_chain = { | |
229 | "Enable user state", | |
230 | enable_user_state_event | |
231 | }; | |
232 | ||
d3a84aa0 | 233 | static const pem_event_action * const enable_user_2d_performance_event[] = { |
e92a0370 RZ |
234 | enable_user_2d_performance_tasks, |
235 | add_user_2d_performance_state_tasks, | |
236 | set_performance_state_tasks, | |
237 | adjust_power_state_tasks, | |
238 | delete_user_2d_performance_state_tasks, | |
239 | NULL | |
240 | }; | |
241 | ||
242 | const struct action_chain enable_user_2d_performance_action_chain = { | |
243 | "enable_user_2d_performance_event_activate", | |
244 | enable_user_2d_performance_event | |
245 | }; | |
246 | ||
247 | ||
d3a84aa0 | 248 | static const pem_event_action * const disable_user_2d_performance_event[] = { |
e92a0370 RZ |
249 | disable_user_2d_performance_tasks, |
250 | delete_user_2d_performance_state_tasks, | |
251 | NULL | |
252 | }; | |
253 | ||
254 | const struct action_chain disable_user_2d_performance_action_chain = { | |
255 | "disable_user_2d_performance_event", | |
256 | disable_user_2d_performance_event | |
257 | }; | |
258 | ||
259 | ||
d3a84aa0 | 260 | static const pem_event_action * const display_config_change_event[] = { |
e92a0370 RZ |
261 | /* countDisplayConfigurationChangeEventTasks, */ |
262 | unblock_adjust_power_state_tasks, | |
73afe621 | 263 | set_cpu_power_state, |
e92a0370 | 264 | notify_hw_power_source_tasks, |
9716ebc3 RZ |
265 | get_2d_performance_state_tasks, |
266 | set_performance_state_tasks, | |
e92a0370 RZ |
267 | /* updateDALConfigurationTasks, |
268 | variBrightDisplayConfigurationChangeTasks, */ | |
269 | adjust_power_state_tasks, | |
270 | /*enableDisableFPSTasks, | |
271 | setNBMCUStateTasks, | |
272 | notifyPCIEDeviceReadyTasks,*/ | |
273 | NULL | |
274 | }; | |
275 | ||
276 | const struct action_chain display_config_change_action_chain = { | |
277 | "Display configuration change", | |
278 | display_config_change_event | |
279 | }; | |
280 | ||
d3a84aa0 | 281 | static const pem_event_action * const readjust_power_state_event[] = { |
e92a0370 RZ |
282 | adjust_power_state_tasks, |
283 | NULL | |
284 | }; | |
285 | ||
286 | const struct action_chain readjust_power_state_action_chain = { | |
287 | "re-adjust power state", | |
288 | readjust_power_state_event | |
289 | }; | |
290 |