2 * Copyright 2015 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
24 #include "eventactionchains.h"
25 #include "eventsubchains.h"
27 static const pem_event_action
* const initialize_event
[] = {
28 block_adjust_power_state_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
,
42 const struct action_chain initialize_action_chain
= {
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
,
53 adjust_power_state_tasks
,
54 disable_dynamic_state_management_tasks
,
55 disable_clock_power_gatings_tasks
,
57 prepare_for_pnp_stop_tasks
,
61 const struct action_chain uninitialize_action_chain
= {
66 static const pem_event_action
* const power_source_change_event_pp_enabled
[] = {
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
,
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
81 static const pem_event_action
* const power_source_change_event_pp_disabled
[] = {
82 set_power_source_tasks
,
83 set_nbmcu_state_tasks
,
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
92 static const pem_event_action
* const power_source_change_event_hardware_dc
[] = {
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
,
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
108 static const pem_event_action
* const suspend_event
[] = {
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
,
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
,
127 const struct action_chain suspend_action_chain
= {
132 static const pem_event_action
* const resume_event
[] = {
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
,
140 enable_stutter_mode_tasks
, /*must do this in boot state and before SMC is started */
141 enable_dynamic_state_management_tasks
,
142 enable_disable_bapm_tasks
,
143 initialize_thermal_controller_tasks
,
144 get_2d_performance_state_tasks
,
145 set_performance_state_tasks
,
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
,
160 const struct action_chain resume_action_chain
= {
165 static const pem_event_action
* const complete_init_event
[] = {
166 unblock_adjust_power_state_tasks
,
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
,
174 const struct action_chain complete_init_action_chain
= {
179 static const pem_event_action
* const enable_gfx_clock_gating_event
[] = {
180 enable_gfx_clock_gating_tasks
,
184 const struct action_chain enable_gfx_clock_gating_action_chain
= {
185 "enable gfx clock gate",
186 enable_gfx_clock_gating_event
189 static const pem_event_action
* const disable_gfx_clock_gating_event
[] = {
190 disable_gfx_clock_gating_tasks
,
194 const struct action_chain disable_gfx_clock_gating_action_chain
= {
195 "disable gfx clock gate",
196 disable_gfx_clock_gating_event
199 static const pem_event_action
* const enable_cgpg_event
[] = {
204 const struct action_chain enable_cgpg_action_chain
= {
209 static const pem_event_action
* const disable_cgpg_event
[] = {
214 const struct action_chain disable_cgpg_action_chain
= {
220 /* Enable user _2d performance and activate */
222 static const pem_event_action
* const enable_user_state_event
[] = {
223 create_new_user_performance_state_tasks
,
224 adjust_power_state_tasks
,
228 const struct action_chain enable_user_state_action_chain
= {
230 enable_user_state_event
233 static const pem_event_action
* const 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
,
242 const struct action_chain enable_user_2d_performance_action_chain
= {
243 "enable_user_2d_performance_event_activate",
244 enable_user_2d_performance_event
248 static const pem_event_action
* const disable_user_2d_performance_event
[] = {
249 disable_user_2d_performance_tasks
,
250 delete_user_2d_performance_state_tasks
,
254 const struct action_chain disable_user_2d_performance_action_chain
= {
255 "disable_user_2d_performance_event",
256 disable_user_2d_performance_event
260 static const pem_event_action
* const display_config_change_event
[] = {
261 /* countDisplayConfigurationChangeEventTasks, */
262 unblock_adjust_power_state_tasks
,
264 notify_hw_power_source_tasks
,
265 get_2d_performance_state_tasks
,
266 set_performance_state_tasks
,
267 /* updateDALConfigurationTasks,
268 variBrightDisplayConfigurationChangeTasks, */
269 adjust_power_state_tasks
,
270 /*enableDisableFPSTasks,
272 notifyPCIEDeviceReadyTasks,*/
276 const struct action_chain display_config_change_action_chain
= {
277 "Display configuration change",
278 display_config_change_event
281 static const pem_event_action
* const readjust_power_state_event
[] = {
282 adjust_power_state_tasks
,
286 const struct action_chain readjust_power_state_action_chain
= {
287 "re-adjust power state",
288 readjust_power_state_event