blob: 56856a2864d108c89cb2a961398f8f3613159fcc [file] [log] [blame]
Rex Zhue92a0372015-09-23 15:14:54 +08001/*
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
27static 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,
Rex Zhu2dfea9c2015-10-16 20:32:36 +080036 initialize_thermal_controller_tasks,
Rex Zhue92a0372015-09-23 15:14:54 +080037 conditionally_force_3d_performance_state_tasks,
38 process_vbios_eventinfo_tasks,
39 broadcast_power_policy_tasks,
40 NULL
41};
42
43const struct action_chain initialize_action_chain = {
44 "Initialize",
45 initialize_event
46};
47
48static 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
62const struct action_chain uninitialize_action_chain = {
63 "Uninitialize",
64 uninitialize_event
65};
66
67static 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
77const 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
82static const pem_event_action *power_source_change_event_pp_disabled[] = {
83 set_power_source_tasks,
84 set_nbmcu_state_tasks,
85 NULL
86};
87
88const 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
93static 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
104const 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
109static 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
128const struct action_chain suspend_action_chain = {
129 "Suspend",
130 suspend_event
131};
132
133static 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,
Rex Zhue92a0372015-09-23 15:14:54 +0800140 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_clock_power_gatings_tasks,
144 enable_disable_bapm_tasks,
Rex Zhuf556c272015-12-29 11:23:57 +0800145 initialize_thermal_controller_tasks,
Rex Zhue0c77162016-03-29 18:45:59 +0800146 get_2d_performance_state_tasks,
147 set_performance_state_tasks,
Rex Zhue92a0372015-09-23 15:14:54 +0800148 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
162const struct action_chain resume_action_chain = {
163 "resume",
164 resume_event
165};
166
167static const pem_event_action *complete_init_event[] = {
Rex Zhudc26a2a2016-02-25 17:16:52 +0800168 unblock_adjust_power_state_tasks,
Rex Zhue92a0372015-09-23 15:14:54 +0800169 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
176const struct action_chain complete_init_action_chain = {
177 "complete init",
178 complete_init_event
179};
180
181static const pem_event_action *enable_gfx_clock_gating_event[] = {
182 enable_gfx_clock_gating_tasks,
183 NULL
184};
185
186const struct action_chain enable_gfx_clock_gating_action_chain = {
187 "enable gfx clock gate",
188 enable_gfx_clock_gating_event
189};
190
191static const pem_event_action *disable_gfx_clock_gating_event[] = {
192 disable_gfx_clock_gating_tasks,
193 NULL
194};
195
196const struct action_chain disable_gfx_clock_gating_action_chain = {
197 "disable gfx clock gate",
198 disable_gfx_clock_gating_event
199};
200
201static const pem_event_action *enable_cgpg_event[] = {
202 enable_cgpg_tasks,
203 NULL
204};
205
206const struct action_chain enable_cgpg_action_chain = {
207 "eable cg pg",
208 enable_cgpg_event
209};
210
211static const pem_event_action *disable_cgpg_event[] = {
212 disable_cgpg_tasks,
213 NULL
214};
215
216const 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
224static const pem_event_action *enable_user_state_event[] = {
225 create_new_user_performance_state_tasks,
226 adjust_power_state_tasks,
227 NULL
228};
229
230const struct action_chain enable_user_state_action_chain = {
231 "Enable user state",
232 enable_user_state_event
233};
234
235static 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
244const 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
250static 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
256const struct action_chain disable_user_2d_performance_action_chain = {
257 "disable_user_2d_performance_event",
258 disable_user_2d_performance_event
259};
260
261
262static const pem_event_action *display_config_change_event[] = {
263 /* countDisplayConfigurationChangeEventTasks, */
264 unblock_adjust_power_state_tasks,
Rex Zhu73afe622015-11-19 13:47:02 +0800265 set_cpu_power_state,
Rex Zhue92a0372015-09-23 15:14:54 +0800266 notify_hw_power_source_tasks,
267 /* updateDALConfigurationTasks,
268 variBrightDisplayConfigurationChangeTasks, */
269 adjust_power_state_tasks,
270 /*enableDisableFPSTasks,
271 setNBMCUStateTasks,
272 notifyPCIEDeviceReadyTasks,*/
273 NULL
274};
275
276const struct action_chain display_config_change_action_chain = {
277 "Display configuration change",
278 display_config_change_event
279};
280
281static const pem_event_action *readjust_power_state_event[] = {
282 adjust_power_state_tasks,
283 NULL
284};
285
286const struct action_chain readjust_power_state_action_chain = {
287 "re-adjust power state",
288 readjust_power_state_event
289};
290