]>
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 | ||
27 | static const pem_event_action *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 | enable_clock_power_gatings_tasks, | |
34 | get_2d_performance_state_tasks, | |
35 | set_performance_state_tasks, | |
2dfea9cd | 36 | initialize_thermal_controller_tasks, |
e92a0370 RZ |
37 | conditionally_force_3d_performance_state_tasks, |
38 | process_vbios_eventinfo_tasks, | |
39 | broadcast_power_policy_tasks, | |
40 | NULL | |
41 | }; | |
42 | ||
43 | const struct action_chain initialize_action_chain = { | |
44 | "Initialize", | |
45 | initialize_event | |
46 | }; | |
47 | ||
48 | static const pem_event_action *uninitialize_event[] = { | |
49 | ungate_all_display_phys_tasks, | |
50 | uninitialize_display_phy_access_tasks, | |
51 | disable_gfx_voltage_island_power_gating_tasks, | |
52 | disable_gfx_clock_gating_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 *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 *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 *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 *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 *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 | block_adjust_power_state_tasks, | |
141 | setup_asic_tasks, | |
142 | enable_stutter_mode_tasks, /*must do this in boot state and before SMC is started */ | |
143 | enable_dynamic_state_management_tasks, | |
144 | enable_clock_power_gatings_tasks, | |
145 | enable_disable_bapm_tasks, | |
f556c274 | 146 | initialize_thermal_controller_tasks, |
e92a0370 RZ |
147 | reset_boot_state_tasks, |
148 | adjust_power_state_tasks, | |
149 | enable_disable_fps_tasks, | |
150 | notify_hw_power_source_tasks, | |
151 | process_vbios_event_info_tasks, | |
152 | enable_gfx_clock_gating_tasks, | |
153 | enable_gfx_voltage_island_power_gating_tasks, | |
154 | reset_clock_gating_tasks, | |
155 | notify_smu_vpu_recovery_end_tasks, | |
156 | disable_vpu_cap_tasks, | |
157 | execute_escape_sequence_tasks, | |
158 | NULL | |
159 | }; | |
160 | ||
161 | ||
162 | const struct action_chain resume_action_chain = { | |
163 | "resume", | |
164 | resume_event | |
165 | }; | |
166 | ||
167 | static const pem_event_action *complete_init_event[] = { | |
dc26a2a2 | 168 | unblock_adjust_power_state_tasks, |
e92a0370 RZ |
169 | adjust_power_state_tasks, |
170 | enable_gfx_clock_gating_tasks, | |
171 | enable_gfx_voltage_island_power_gating_tasks, | |
172 | notify_power_state_change_tasks, | |
173 | NULL | |
174 | }; | |
175 | ||
176 | const struct action_chain complete_init_action_chain = { | |
177 | "complete init", | |
178 | complete_init_event | |
179 | }; | |
180 | ||
181 | static const pem_event_action *enable_gfx_clock_gating_event[] = { | |
182 | enable_gfx_clock_gating_tasks, | |
183 | NULL | |
184 | }; | |
185 | ||
186 | const struct action_chain enable_gfx_clock_gating_action_chain = { | |
187 | "enable gfx clock gate", | |
188 | enable_gfx_clock_gating_event | |
189 | }; | |
190 | ||
191 | static const pem_event_action *disable_gfx_clock_gating_event[] = { | |
192 | disable_gfx_clock_gating_tasks, | |
193 | NULL | |
194 | }; | |
195 | ||
196 | const struct action_chain disable_gfx_clock_gating_action_chain = { | |
197 | "disable gfx clock gate", | |
198 | disable_gfx_clock_gating_event | |
199 | }; | |
200 | ||
201 | static const pem_event_action *enable_cgpg_event[] = { | |
202 | enable_cgpg_tasks, | |
203 | NULL | |
204 | }; | |
205 | ||
206 | const struct action_chain enable_cgpg_action_chain = { | |
207 | "eable cg pg", | |
208 | enable_cgpg_event | |
209 | }; | |
210 | ||
211 | static const pem_event_action *disable_cgpg_event[] = { | |
212 | disable_cgpg_tasks, | |
213 | NULL | |
214 | }; | |
215 | ||
216 | const struct action_chain disable_cgpg_action_chain = { | |
217 | "disable cg pg", | |
218 | disable_cgpg_event | |
219 | }; | |
220 | ||
221 | ||
222 | /* Enable user _2d performance and activate */ | |
223 | ||
224 | static const pem_event_action *enable_user_state_event[] = { | |
225 | create_new_user_performance_state_tasks, | |
226 | adjust_power_state_tasks, | |
227 | NULL | |
228 | }; | |
229 | ||
230 | const struct action_chain enable_user_state_action_chain = { | |
231 | "Enable user state", | |
232 | enable_user_state_event | |
233 | }; | |
234 | ||
235 | static const pem_event_action *enable_user_2d_performance_event[] = { | |
236 | enable_user_2d_performance_tasks, | |
237 | add_user_2d_performance_state_tasks, | |
238 | set_performance_state_tasks, | |
239 | adjust_power_state_tasks, | |
240 | delete_user_2d_performance_state_tasks, | |
241 | NULL | |
242 | }; | |
243 | ||
244 | const struct action_chain enable_user_2d_performance_action_chain = { | |
245 | "enable_user_2d_performance_event_activate", | |
246 | enable_user_2d_performance_event | |
247 | }; | |
248 | ||
249 | ||
250 | static const pem_event_action *disable_user_2d_performance_event[] = { | |
251 | disable_user_2d_performance_tasks, | |
252 | delete_user_2d_performance_state_tasks, | |
253 | NULL | |
254 | }; | |
255 | ||
256 | const struct action_chain disable_user_2d_performance_action_chain = { | |
257 | "disable_user_2d_performance_event", | |
258 | disable_user_2d_performance_event | |
259 | }; | |
260 | ||
261 | ||
262 | static const pem_event_action *display_config_change_event[] = { | |
263 | /* countDisplayConfigurationChangeEventTasks, */ | |
264 | unblock_adjust_power_state_tasks, | |
73afe621 | 265 | set_cpu_power_state, |
e92a0370 RZ |
266 | notify_hw_power_source_tasks, |
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 | ||
281 | static const pem_event_action *readjust_power_state_event[] = { | |
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 |