xref: /linux/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.c (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 /******************************************************************************
2  *
3  * Copyright(c) 2009-2010  Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25 
26 #include "../pwrseqcmd.h"
27 #include "pwrseq.h"
28 
29 /* drivers should parse below arrays and do the corresponding actions */
30 /* 3 Power on  Array */
31 struct wlan_pwr_cfg rtl8812_power_on_flow[RTL8812_TRANS_CARDEMU_TO_ACT_STEPS +
32 					RTL8812_TRANS_END_STEPS] = {
33 	RTL8812_TRANS_CARDEMU_TO_ACT
34 	RTL8812_TRANS_END
35 };
36 
37 /* 3Radio off GPIO Array */
38 struct wlan_pwr_cfg rtl8812_radio_off_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
39 						RTL8812_TRANS_END_STEPS] = {
40 	RTL8812_TRANS_ACT_TO_CARDEMU
41 	RTL8812_TRANS_END
42 };
43 
44 /* 3Card Disable Array */
45 struct wlan_pwr_cfg rtl8812_card_disable_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS
46 	+ RTL8812_TRANS_CARDEMU_TO_PDN_STEPS
47 	+ RTL8812_TRANS_END_STEPS] = {
48 	RTL8812_TRANS_ACT_TO_CARDEMU
49 	RTL8812_TRANS_CARDEMU_TO_CARDDIS
50 	RTL8812_TRANS_END
51 };
52 
53 /* 3 Card Enable Array */
54 struct wlan_pwr_cfg rtl8812_card_enable_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS
55 	+ RTL8812_TRANS_CARDEMU_TO_PDN_STEPS
56 	+ RTL8812_TRANS_END_STEPS] = {
57 	RTL8812_TRANS_CARDDIS_TO_CARDEMU
58 	RTL8812_TRANS_CARDEMU_TO_ACT
59 	RTL8812_TRANS_END
60 };
61 
62 /* 3Suspend Array */
63 struct wlan_pwr_cfg rtl8812_suspend_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
64 					RTL8812_TRANS_CARDEMU_TO_SUS_STEPS +
65 					RTL8812_TRANS_END_STEPS] = {
66 	RTL8812_TRANS_ACT_TO_CARDEMU
67 	RTL8812_TRANS_CARDEMU_TO_SUS
68 	RTL8812_TRANS_END
69 };
70 
71 /* 3 Resume Array */
72 struct wlan_pwr_cfg rtl8812_resume_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
73 					RTL8812_TRANS_CARDEMU_TO_SUS_STEPS +
74 					RTL8812_TRANS_END_STEPS] = {
75 	RTL8812_TRANS_SUS_TO_CARDEMU
76 	RTL8812_TRANS_CARDEMU_TO_ACT
77 	RTL8812_TRANS_END
78 };
79 
80 /* 3HWPDN Array */
81 struct wlan_pwr_cfg rtl8812_hwpdn_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS +
82 					RTL8812_TRANS_CARDEMU_TO_PDN_STEPS +
83 					RTL8812_TRANS_END_STEPS] = {
84 	RTL8812_TRANS_ACT_TO_CARDEMU
85 	RTL8812_TRANS_CARDEMU_TO_PDN
86 	RTL8812_TRANS_END
87 };
88 
89 /* 3 Enter LPS */
90 struct wlan_pwr_cfg rtl8812_enter_lps_flow[RTL8812_TRANS_ACT_TO_LPS_STEPS +
91 						RTL8812_TRANS_END_STEPS] = {
92 	/* FW behavior */
93 	RTL8812_TRANS_ACT_TO_LPS
94 	RTL8812_TRANS_END
95 };
96 
97 /* 3 Leave LPS */
98 struct wlan_pwr_cfg rtl8812_leave_lps_flow[RTL8812_TRANS_LPS_TO_ACT_STEPS +
99 						RTL8812_TRANS_END_STEPS] = {
100 	/* FW behavior */
101 	RTL8812_TRANS_LPS_TO_ACT
102 	RTL8812_TRANS_END
103 };
104 
105 /* drivers should parse below arrays and do the corresponding actions */
106 /*3 Power on  Array*/
107 struct wlan_pwr_cfg rtl8821A_power_on_flow[RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS
108 					+ RTL8821A_TRANS_END_STEPS] = {
109 	RTL8821A_TRANS_CARDEMU_TO_ACT
110 	RTL8821A_TRANS_END
111 };
112 
113 /*3Radio off GPIO Array */
114 struct wlan_pwr_cfg rtl8821A_radio_off_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS
115 					+ RTL8821A_TRANS_END_STEPS] = {
116 	RTL8821A_TRANS_ACT_TO_CARDEMU
117 	RTL8821A_TRANS_END
118 };
119 
120 /*3Card Disable Array*/
121 struct wlan_pwr_cfg rtl8821A_card_disable_flow
122 					[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS
123 					+ RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS
124 					+ RTL8821A_TRANS_END_STEPS] = {
125 	RTL8821A_TRANS_ACT_TO_CARDEMU
126 	RTL8821A_TRANS_CARDEMU_TO_CARDDIS
127 	RTL8821A_TRANS_END
128 };
129 
130 /*3 Card Enable Array*/
131 /*RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS*/
132 struct wlan_pwr_cfg rtl8821A_card_enable_flow
133 					[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS
134 					+ RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS
135 					+ RTL8821A_TRANS_END_STEPS] = {
136 	RTL8821A_TRANS_CARDDIS_TO_CARDEMU
137 	RTL8821A_TRANS_CARDEMU_TO_ACT
138 	RTL8821A_TRANS_END
139 };
140 
141 /*3Suspend Array*/
142 struct wlan_pwr_cfg rtl8821A_suspend_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS
143 					+ RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS
144 					+ RTL8821A_TRANS_END_STEPS] = {
145 	RTL8821A_TRANS_ACT_TO_CARDEMU
146 	RTL8821A_TRANS_CARDEMU_TO_SUS
147 	RTL8821A_TRANS_END
148 };
149 
150 /*3 Resume Array*/
151 struct wlan_pwr_cfg rtl8821A_resume_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS
152 					+ RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS
153 					+ RTL8821A_TRANS_END_STEPS] = {
154 	RTL8821A_TRANS_SUS_TO_CARDEMU
155 	RTL8821A_TRANS_CARDEMU_TO_ACT
156 	RTL8821A_TRANS_END
157 };
158 
159 /*3HWPDN Array*/
160 struct wlan_pwr_cfg rtl8821A_hwpdn_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS
161 				+ RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS
162 				+ RTL8821A_TRANS_END_STEPS] = {
163 	RTL8821A_TRANS_ACT_TO_CARDEMU
164 	RTL8821A_TRANS_CARDEMU_TO_PDN
165 	RTL8821A_TRANS_END
166 };
167 
168 /*3 Enter LPS */
169 struct wlan_pwr_cfg rtl8821A_enter_lps_flow[RTL8821A_TRANS_ACT_TO_LPS_STEPS
170 					+ RTL8821A_TRANS_END_STEPS] = {
171 	/*FW behavior*/
172 	RTL8821A_TRANS_ACT_TO_LPS
173 	RTL8821A_TRANS_END
174 };
175 
176 /*3 Leave LPS */
177 struct wlan_pwr_cfg rtl8821A_leave_lps_flow[RTL8821A_TRANS_LPS_TO_ACT_STEPS
178 					+ RTL8821A_TRANS_END_STEPS] = {
179 	/*FW behavior*/
180 	RTL8821A_TRANS_LPS_TO_ACT
181 	RTL8821A_TRANS_END
182 };
183