blob: 9458394aec05c63fbe7d0b22fe5fdab2aa044451 [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,
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,
146 reset_boot_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
161const struct action_chain resume_action_chain = {
162 "resume",
163 resume_event
164};
165
166static const pem_event_action *complete_init_event[] = {
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
174const struct action_chain complete_init_action_chain = {
175 "complete init",
176 complete_init_event
177};
178
179static const pem_event_action *enable_gfx_clock_gating_event[] = {
180 enable_gfx_clock_gating_tasks,
181 NULL
182};
183
184const struct action_chain enable_gfx_clock_gating_action_chain = {
185 "enable gfx clock gate",
186 enable_gfx_clock_gating_event
187};
188
189static const pem_event_action *disable_gfx_clock_gating_event[] = {
190 disable_gfx_clock_gating_tasks,
191 NULL
192};
193
194const struct action_chain disable_gfx_clock_gating_action_chain = {
195 "disable gfx clock gate",
196 disable_gfx_clock_gating_event
197};
198
199static const pem_event_action *enable_cgpg_event[] = {
200 enable_cgpg_tasks,
201 NULL
202};
203
204const struct action_chain enable_cgpg_action_chain = {
205 "eable cg pg",
206 enable_cgpg_event
207};
208
209static const pem_event_action *disable_cgpg_event[] = {
210 disable_cgpg_tasks,
211 NULL
212};
213
214const 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
222static const pem_event_action *enable_user_state_event[] = {
223 create_new_user_performance_state_tasks,
224 adjust_power_state_tasks,
225 NULL
226};
227
228const struct action_chain enable_user_state_action_chain = {
229 "Enable user state",
230 enable_user_state_event
231};
232
233static const pem_event_action *enable_user_2d_performance_event[] = {
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
242const 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
248static const pem_event_action *disable_user_2d_performance_event[] = {
249 disable_user_2d_performance_tasks,
250 delete_user_2d_performance_state_tasks,
251 NULL
252};
253
254const struct action_chain disable_user_2d_performance_action_chain = {
255 "disable_user_2d_performance_event",
256 disable_user_2d_performance_event
257};
258
259
260static const pem_event_action *display_config_change_event[] = {
261 /* countDisplayConfigurationChangeEventTasks, */
262 unblock_adjust_power_state_tasks,
Rex Zhu73afe622015-11-19 13:47:02 +0800263 set_cpu_power_state,
Rex Zhue92a0372015-09-23 15:14:54 +0800264 notify_hw_power_source_tasks,
265 /* updateDALConfigurationTasks,
266 variBrightDisplayConfigurationChangeTasks, */
267 adjust_power_state_tasks,
268 /*enableDisableFPSTasks,
269 setNBMCUStateTasks,
270 notifyPCIEDeviceReadyTasks,*/
271 NULL
272};
273
274const struct action_chain display_config_change_action_chain = {
275 "Display configuration change",
276 display_config_change_event
277};
278
279static const pem_event_action *readjust_power_state_event[] = {
280 adjust_power_state_tasks,
281 NULL
282};
283
284const struct action_chain readjust_power_state_action_chain = {
285 "re-adjust power state",
286 readjust_power_state_event
287};
288