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
,
52 uninitialize_thermal_controller_tasks
,
54 adjust_power_state_tasks
,
55 disable_dynamic_state_management_tasks
,
56 disable_clock_power_gatings_tasks
,
58 prepare_for_pnp_stop_tasks
,
62 const struct action_chain uninitialize_action_chain
= {
67 static const pem_event_action
* const 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
,
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
82 static const pem_event_action
* const power_source_change_event_pp_disabled
[] = {
83 set_power_source_tasks
,
84 set_nbmcu_state_tasks
,
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
93 static const pem_event_action
* const 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
,
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
109 static const pem_event_action
* const 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
,
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
,
128 const struct action_chain suspend_action_chain
= {
133 static const pem_event_action
* const 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
,
141 enable_stutter_mode_tasks
, /*must do this in boot state and before SMC is started */
142 enable_dynamic_state_management_tasks
,
143 enable_disable_bapm_tasks
,
144 initialize_thermal_controller_tasks
,
145 get_2d_performance_state_tasks
,
146 set_performance_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
,
161 const struct action_chain resume_action_chain
= {
166 static const pem_event_action
* const complete_init_event
[] = {
167 unblock_adjust_power_state_tasks
,
168 adjust_power_state_tasks
,
169 enable_gfx_clock_gating_tasks
,
170 enable_gfx_voltage_island_power_gating_tasks
,
171 notify_power_state_change_tasks
,
175 const struct action_chain complete_init_action_chain
= {
180 static const pem_event_action
* const enable_gfx_clock_gating_event
[] = {
181 enable_gfx_clock_gating_tasks
,
185 const struct action_chain enable_gfx_clock_gating_action_chain
= {
186 "enable gfx clock gate",
187 enable_gfx_clock_gating_event
190 static const pem_event_action
* const disable_gfx_clock_gating_event
[] = {
191 disable_gfx_clock_gating_tasks
,
195 const struct action_chain disable_gfx_clock_gating_action_chain
= {
196 "disable gfx clock gate",
197 disable_gfx_clock_gating_event
200 static const pem_event_action
* const enable_cgpg_event
[] = {
205 const struct action_chain enable_cgpg_action_chain
= {
210 static const pem_event_action
* const disable_cgpg_event
[] = {
215 const struct action_chain disable_cgpg_action_chain
= {
221 /* Enable user _2d performance and activate */
223 static const pem_event_action
* const enable_user_state_event
[] = {
224 create_new_user_performance_state_tasks
,
225 adjust_power_state_tasks
,
229 const struct action_chain enable_user_state_action_chain
= {
231 enable_user_state_event
234 static const pem_event_action
* const enable_user_2d_performance_event
[] = {
235 enable_user_2d_performance_tasks
,
236 add_user_2d_performance_state_tasks
,
237 set_performance_state_tasks
,
238 adjust_power_state_tasks
,
239 delete_user_2d_performance_state_tasks
,
243 const struct action_chain enable_user_2d_performance_action_chain
= {
244 "enable_user_2d_performance_event_activate",
245 enable_user_2d_performance_event
249 static const pem_event_action
* const disable_user_2d_performance_event
[] = {
250 disable_user_2d_performance_tasks
,
251 delete_user_2d_performance_state_tasks
,
255 const struct action_chain disable_user_2d_performance_action_chain
= {
256 "disable_user_2d_performance_event",
257 disable_user_2d_performance_event
261 static const pem_event_action
* const display_config_change_event
[] = {
262 /* countDisplayConfigurationChangeEventTasks, */
263 unblock_adjust_power_state_tasks
,
265 notify_hw_power_source_tasks
,
266 get_2d_performance_state_tasks
,
267 set_performance_state_tasks
,
268 /* updateDALConfigurationTasks,
269 variBrightDisplayConfigurationChangeTasks, */
270 adjust_power_state_tasks
,
271 /*enableDisableFPSTasks,
273 notifyPCIEDeviceReadyTasks,*/
277 const struct action_chain display_config_change_action_chain
= {
278 "Display configuration change",
279 display_config_change_event
282 static const pem_event_action
* const readjust_power_state_event
[] = {
283 adjust_power_state_tasks
,
287 const struct action_chain readjust_power_state_action_chain
= {
288 "re-adjust power state",
289 readjust_power_state_event