xref: /freebsd/sys/dev/rtwn/rtl8812a/r12a_priv.h (revision c9ccf3a32da427475985b85d7df023ccfb138c27)
1 /*-
2  * Copyright (c) 2016 Andriy Voskoboinyk <avos@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef R12A_PRIV_H
30 #define R12A_PRIV_H
31 
32 /*
33  * MAC initialization values.
34  */
35 #define RTL8812AU_MAC_PROG_START \
36 	{ 0x010, 0x0c },
37 
38 #define RTL8812AU_MAC_PROG_END \
39 	{ 0x025, 0x0f }, { 0x072, 0x00 }, { 0x420, 0x80 }, { 0x428, 0x0a }, \
40 	{ 0x429, 0x10 }, { 0x430, 0x00 }, { 0x431, 0x00 }, { 0x432, 0x00 }, \
41 	{ 0x433, 0x01 }, { 0x434, 0x04 }, { 0x435, 0x05 }, { 0x436, 0x07 }, \
42 	{ 0x437, 0x08 }, { 0x43c, 0x04 }, { 0x43d, 0x05 }, { 0x43e, 0x07 }, \
43 	{ 0x43f, 0x08 }, { 0x440, 0x5d }, { 0x441, 0x01 }, { 0x442, 0x00 }, \
44 	{ 0x444, 0x10 }, { 0x445, 0x00 }, { 0x446, 0x00 }, { 0x447, 0x00 }, \
45 	{ 0x448, 0x00 }, { 0x449, 0xf0 }, { 0x44a, 0x0f }, { 0x44b, 0x3e }, \
46 	{ 0x44c, 0x10 }, { 0x44d, 0x00 }, { 0x44e, 0x00 }, { 0x44f, 0x00 }, \
47 	{ 0x450, 0x00 }, { 0x451, 0xf0 }, { 0x452, 0x0f }, { 0x453, 0x00 }, \
48 	{ 0x45b, 0x80 }, { 0x460, 0x66 }, { 0x461, 0x66 }, { 0x4c8, 0xff }, \
49 	{ 0x4c9, 0x08 }, { 0x4cc, 0xff }, { 0x4cd, 0xff }, { 0x4ce, 0x01 }, \
50 	{ 0x500, 0x26 }, { 0x501, 0xa2 }, { 0x502, 0x2f }, { 0x503, 0x00 }, \
51 	{ 0x504, 0x28 }, { 0x505, 0xa3 }, { 0x506, 0x5e }, { 0x507, 0x00 }, \
52 	{ 0x508, 0x2b }, { 0x509, 0xa4 }, { 0x50a, 0x5e }, { 0x50b, 0x00 }, \
53 	{ 0x50c, 0x4f }, { 0x50d, 0xa4 }, { 0x50e, 0x00 }, { 0x50f, 0x00 }, \
54 	{ 0x512, 0x1c }, { 0x514, 0x0a }, { 0x516, 0x0a }, { 0x525, 0x4f }, \
55 	{ 0x550, 0x10 }, { 0x551, 0x10 }, { 0x559, 0x02 }, { 0x55c, 0x50 }, \
56 	{ 0x55d, 0xff }, { 0x604, 0x09 }, { 0x605, 0x30 }, { 0x607, 0x03 }, \
57 	{ 0x608, 0x0e }, { 0x609, 0x2a }, { 0x620, 0xff }, { 0x621, 0xff }, \
58 	{ 0x622, 0xff }, { 0x623, 0xff }, { 0x624, 0xff }, { 0x625, 0xff }, \
59 	{ 0x626, 0xff }, { 0x627, 0xff }, { 0x638, 0x50 }, { 0x63c, 0x0a }, \
60 	{ 0x63d, 0x0a }, { 0x63e, 0x0e }, { 0x63f, 0x0e }, { 0x640, 0x80 }, \
61 	{ 0x642, 0x40 }, { 0x643, 0x00 }, { 0x652, 0xc8 }, { 0x66e, 0x05 }, \
62 	{ 0x700, 0x21 }, { 0x701, 0x43 }, { 0x702, 0x65 }, { 0x703, 0x87 }, \
63 	{ 0x708, 0x21 }, { 0x709, 0x43 }, { 0x70a, 0x65 }, { 0x70b, 0x87 }, \
64 	{ 0x718, 0x40 }
65 
66 static const struct rtwn_mac_prog rtl8812au_mac_no_ext_pa_lna[] = {
67 	RTL8812AU_MAC_PROG_START
68 	{ 0x11, 0x66 },
69 	RTL8812AU_MAC_PROG_END
70 }, rtl8812au_mac[] = {
71 	RTL8812AU_MAC_PROG_START
72 	{ 0x11, 0x5a },
73 	RTL8812AU_MAC_PROG_END
74 };
75 
76 /*
77  * Baseband initialization values.
78  */
79 #define R12A_COND_GPA		0x01
80 #define R12A_COND_APA		0x02
81 #define R12A_COND_GLNA		0x04
82 #define R12A_COND_ALNA		0x08
83 #define R12A_COND_TYPE(t)	((t) << 4)
84 
85 static const uint16_t rtl8812au_bb_regs0[] = {
86 	0x800, 0x804, 0x808, 0x80c, 0x810, 0x814, 0x818, 0x820, 0x824,
87 	0x828, 0x82c, 0x830, 0x834, 0x838, 0x83c, 0x840, 0x844, 0x848,
88 	0x84c, 0x850, 0x854, 0x858, 0x85c, 0x860, 0x864, 0x868, 0x86c,
89 	0x870, 0x874, 0x878, 0x87c, 0x8a0, 0x8a4, 0x8a8, 0x8ac, 0x8b0,
90 	0x8b4, 0x8b8, 0x8bc, 0x8c0, 0x8c4, 0x8c8, 0x8cc, 0x8d0, 0x8dc,
91 	0x8d4, 0x8d8, 0x8f8, 0x8fc, 0x900, 0x90c, 0x910, 0x914, 0x918,
92 	0x91c, 0x920, 0x924, 0x928, 0x92c, 0x930, 0x934, 0x960, 0x964,
93 	0x968, 0x96c, 0x970, 0x978, 0x97c, 0x980, 0x984, 0x988, 0x990,
94 	0x994, 0x998, 0x99c, 0x9a0, 0x9a4, 0x9a8, 0x9ac, 0x9b0, 0x9b4,
95 	0x9b8, 0x9bc, 0x9d0, 0x9d4, 0x9d8, 0x9dc, 0x9e4, 0x9e8, 0xa00,
96 	0xa04, 0xa08, 0xa0c, 0xa10, 0xa14, 0xa18, 0xa1c, 0xa20, 0xa24,
97 	0xa28, 0xa2c, 0xa70, 0xa74, 0xa78, 0xa7c, 0xa80, 0xa84, 0xb00,
98 	0xb04, 0xb08, 0xb0c, 0xb10, 0xb14, 0xb18, 0xb1c, 0xb20, 0xb24,
99 	0xb28, 0xb2c, 0xb30, 0xb34, 0xb38, 0xb3c, 0xb40, 0xb44, 0xb48,
100 	0xb4c, 0xb50, 0xb54, 0xb58, 0xb5c, 0xc00, 0xc04, 0xc08, 0xc0c,
101 	0xc10, 0xc14, 0xc1c, 0xc20, 0xc24, 0xc28, 0xc2c, 0xc30, 0xc34,
102 	0xc38, 0xc3c, 0xc40, 0xc44, 0xc48, 0xc4c, 0xc50, 0xc54, 0xc58,
103 	0xc5c, 0xc60, 0xc64
104 }, rtl8812au_bb_regs1[] = {
105 	0xc68
106 }, rtl8812au_bb_regs2[] = {
107 	0xc6c, 0xc70, 0xc74, 0xc78, 0xc7c, 0xc80, 0xc84, 0xc94, 0xc98,
108 	0xc9c, 0xca0, 0xca4, 0xca8, 0xcb0, 0xcb4, 0xcb8, 0xe00, 0xe04,
109 	0xe08, 0xe0c, 0xe10, 0xe14, 0xe1c, 0xe20, 0xe24, 0xe28, 0xe2c,
110 	0xe30, 0xe34, 0xe38, 0xe3c, 0xe40, 0xe44, 0xe48, 0xe4c, 0xe50,
111 	0xe54, 0xe58, 0xe5c, 0xe60, 0xe64, 0xe68, 0xe6c, 0xe70, 0xe74,
112 	0xe78, 0xe7c, 0xe80, 0xe84, 0xe94, 0xe98, 0xe9c, 0xea0, 0xea4,
113 	0xea8, 0xeb0, 0xeb4, 0xeb8
114 };
115 
116 static const uint32_t rtl8812au_bb_vals0[] = {
117 	0x8020d010, 0x080112e0, 0x0e028233, 0x12131113, 0x20101263,
118 	0x020c3d10, 0x03a00385, 0x00000000, 0x00030fe0, 0x00000000,
119 	0x002083dd, 0x2eaaeeb8, 0x0037a706, 0x06c89b44, 0x0000095b,
120 	0xc0000001, 0x40003cde, 0x6210ff8b, 0x6cfdffb8, 0x28874706,
121 	0x0001520c, 0x8060e000, 0x74210168, 0x6929c321, 0x79727432,
122 	0x8ca7a314, 0x338c2878, 0x03333333, 0x31602c2e, 0x00003152,
123 	0x000fc000, 0x00000013, 0x7f7f7f7f, 0xa202033e, 0x0ff0fa0a,
124 	0x00000600, 0x000fc080, 0x6c0057ff, 0x4ca520a3, 0x27f00020,
125 	0x00000000, 0x00012d69, 0x08248492, 0x0000b800, 0x00000000,
126 	0x940008a0, 0x290b5612, 0x400002c0, 0x00000000, 0x00000701,
127 	0x00000000, 0x0000fc00, 0x00000404, 0x1c1028c0, 0x64b11a1c,
128 	0xe0767233, 0x055aa500, 0x00000004, 0xfffe0000, 0xfffffffe,
129 	0x001fffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
130 	0x801fffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
131 	0x00000000, 0x27100000, 0xffff0100, 0xffffff5c, 0xffffffff,
132 	0x000000ff, 0x00080080, 0x00000000, 0x00000000, 0x81081008,
133 	0x00000000, 0x01081008, 0x01081008, 0x00000000, 0x00000000,
134 	0x00000000, 0x00000000, 0x00000003, 0x000002d5, 0x00d047c8,
135 	0x01ff000c, 0x8c838300, 0x2e7f000f, 0x9500bb78, 0x11144028,
136 	0x00881117, 0x89140f00, 0x1a1b0000, 0x090e1217, 0x00000305,
137 	0x00900000, 0x101fff00, 0x00000008, 0x00000900, 0x225b0606,
138 	0x218075b2, 0x001f8c80, 0x03100000, 0x0000b000, 0xae0201eb,
139 	0x01003207, 0x00009807, 0x01000000, 0x00000002, 0x00000002,
140 	0x0000001f, 0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c,
141 	0x13121110, 0x17161514, 0x0000003a, 0x00000000, 0x00000000,
142 	0x13000032, 0x48080000, 0x00000000, 0x00000000, 0x00000000,
143 	0x00000000, 0x00000007, 0x00042020, 0x80410231, 0x00000000,
144 	0x00000100, 0x01000000, 0x40000003, 0x12121212, 0x12121212,
145 	0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
146 	0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
147 	0x00000020, 0x0008121c, 0x30000c1c, 0x00000058, 0x34344443,
148 	0x07003333
149 }, rtl8812au_bb_vals1_ext_pa_lna[] = {
150 	0x59791979
151 }, rtl8812au_bb_vals1[] = {
152 	0x59799979
153 }, rtl8812au_bb_vals2[] = {
154 	0x59795979, 0x19795979, 0x19795979, 0x19791979, 0x19791979,
155 	0x19791979, 0x19791979, 0x0100005c, 0x00000000, 0x00000000,
156 	0x00000029, 0x08040201, 0x80402010, 0x77547777, 0x00000077,
157 	0x00508242, 0x00000007, 0x00042020, 0x80410231, 0x00000000,
158 	0x00000100, 0x01000000, 0x40000003, 0x12121212, 0x12121212,
159 	0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
160 	0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
161 	0x00000020, 0x0008121c, 0x30000c1c, 0x00000058, 0x34344443,
162 	0x07003333, 0x59791979, 0x59795979, 0x19795979, 0x19795979,
163 	0x19791979, 0x19791979, 0x19791979, 0x19791979, 0x0100005c,
164 	0x00000000, 0x00000000, 0x00000029, 0x08040201, 0x80402010,
165 	0x77547777, 0x00000077, 0x00508242
166 };
167 
168 static const struct rtwn_bb_prog rtl8812au_bb[] = {
169 	{
170 		nitems(rtl8812au_bb_regs0),
171 		rtl8812au_bb_regs0,
172 		rtl8812au_bb_vals0,
173 		{ 0 },
174 		NULL
175 	},
176 	/*
177 	 * Devices with:
178 	 * * External 2GHz PA, type 0;
179 	 * * External 5GHz PA, type 0 or 5;
180 	 * * External 2GHz LNA, type 0 or 5;
181 	 * * External 5GHz LNA, type 0;
182 	 */
183 	{
184 		nitems(rtl8812au_bb_regs1),
185 		rtl8812au_bb_regs1,
186 		rtl8812au_bb_vals1_ext_pa_lna,
187 		{
188 			R12A_COND_GPA | R12A_COND_GLNA |
189 			R12A_COND_APA | R12A_COND_ALNA |
190 			R12A_COND_TYPE(0x0),
191 			R12A_COND_APA | R12A_COND_GLNA |
192 			R12A_COND_TYPE(0x5), 0
193 		},
194 		/*
195 		 * Others.
196 		 */
197 		&(const struct rtwn_bb_prog){
198 			nitems(rtl8812au_bb_regs1),
199 			rtl8812au_bb_regs1,
200 			rtl8812au_bb_vals1,
201 			{ 0 },
202 			NULL
203 		}
204 	},
205 	{
206 		nitems(rtl8812au_bb_regs2),
207 		rtl8812au_bb_regs2,
208 		rtl8812au_bb_vals2,
209 		{ 0 },
210 		NULL
211 	}
212 };
213 
214 static const uint32_t rtl8812au_agc_vals0_lna_g0[] = {
215 	0xfc000001, 0xfb020001, 0xfa040001, 0xf9060001, 0xf8080001,
216 	0xf70a0001, 0xf60c0001, 0xf50e0001, 0xf4100001, 0xf3120001,
217 	0xf2140001, 0xf1160001, 0xf0180001, 0xef1a0001, 0xee1c0001,
218 	0xed1e0001, 0xec200001, 0xeb220001, 0xea240001, 0xcd260001,
219 	0xcc280001, 0xcb2a0001, 0xca2c0001, 0xc92e0001, 0xc8300001,
220 	0xa6320001, 0xa5340001, 0xa4360001, 0xa3380001, 0xa23a0001,
221 	0x883c0001, 0x873e0001, 0x86400001, 0x85420001, 0x84440001,
222 	0x83460001, 0x82480001, 0x814a0001, 0x484c0001, 0x474e0001,
223 	0x46500001, 0x45520001, 0x44540001, 0x43560001, 0x42580001,
224 	0x415a0001, 0x255c0001, 0x245e0001, 0x23600001, 0x22620001,
225 	0x21640001, 0x21660001, 0x21680001, 0x216a0001, 0x216c0001,
226 	0x216e0001, 0x21700001, 0x21720001, 0x21740001, 0x21760001,
227 	0x21780001, 0x217a0001, 0x217c0001, 0x217e0001
228 }, rtl8812au_agc_vals0_lna_g5[] = {
229 	0xf9000001, 0xf8020001, 0xf7040001, 0xf6060001, 0xf5080001,
230 	0xf40a0001, 0xf30c0001, 0xf20e0001, 0xf1100001, 0xf0120001,
231 	0xef140001, 0xee160001, 0xed180001, 0xec1a0001, 0xeb1c0001,
232 	0xea1e0001, 0xcd200001, 0xcc220001, 0xcb240001, 0xca260001,
233 	0xc9280001, 0xc82a0001, 0xc72c0001, 0xc62e0001, 0xa5300001,
234 	0xa4320001, 0xa3340001, 0xa2360001, 0x88380001, 0x873a0001,
235 	0x863c0001, 0x853e0001, 0x84400001, 0x83420001, 0x82440001,
236 	0x81460001, 0x48480001, 0x474a0001, 0x464c0001, 0x454e0001,
237 	0x44500001, 0x43520001, 0x42540001, 0x41560001, 0x25580001,
238 	0x245a0001, 0x235c0001, 0x225e0001, 0x21600001, 0x21620001,
239 	0x21640001, 0x21660001, 0x21680001, 0x216a0001, 0x236c0001,
240 	0x226e0001, 0x21700001, 0x21720001, 0x21740001, 0x21760001,
241 	0x21780001, 0x217a0001, 0x217c0001, 0x217e0001
242 }, rtl8812au_agc_vals0[] = {
243 	0xff000001, 0xff020001, 0xff040001, 0xff060001, 0xff080001,
244 	0xfe0a0001, 0xfd0c0001, 0xfc0e0001, 0xfb100001, 0xfa120001,
245 	0xf9140001, 0xf8160001, 0xf7180001, 0xf61a0001, 0xf51c0001,
246 	0xf41e0001, 0xf3200001, 0xf2220001, 0xf1240001, 0xf0260001,
247 	0xef280001, 0xee2a0001, 0xed2c0001, 0xec2e0001, 0xeb300001,
248 	0xea320001, 0xe9340001, 0xe8360001, 0xe7380001, 0xe63a0001,
249 	0xe53c0001, 0xc73e0001, 0xc6400001, 0xc5420001, 0xc4440001,
250 	0xc3460001, 0xc2480001, 0xc14a0001, 0xa74c0001, 0xa64e0001,
251 	0xa5500001, 0xa4520001, 0xa3540001, 0xa2560001, 0xa1580001,
252 	0x675a0001, 0x665c0001, 0x655e0001, 0x64600001, 0x63620001,
253 	0x48640001, 0x47660001, 0x46680001, 0x456a0001, 0x446c0001,
254 	0x436e0001, 0x42700001, 0x41720001, 0x41740001, 0x41760001,
255 	0x41780001, 0x417a0001, 0x417c0001, 0x417e0001
256 }, rtl8812au_agc_vals1_lna_a0[] = {
257 	0xfc800001, 0xfb820001, 0xfa840001, 0xf9860001, 0xf8880001,
258 	0xf78a0001, 0xf68c0001, 0xf58e0001, 0xf4900001, 0xf3920001,
259 	0xf2940001, 0xf1960001, 0xf0980001, 0xef9a0001, 0xee9c0001,
260 	0xed9e0001, 0xeca00001, 0xeba20001, 0xeaa40001, 0xe9a60001,
261 	0xe8a80001, 0xe7aa0001, 0xe6ac0001, 0xe5ae0001, 0xe4b00001,
262 	0xe3b20001, 0xa8b40001, 0xa7b60001, 0xa6b80001, 0xa5ba0001,
263 	0xa4bc0001, 0xa3be0001, 0xa2c00001, 0xa1c20001, 0x68c40001,
264 	0x67c60001, 0x66c80001, 0x65ca0001, 0x64cc0001, 0x47ce0001,
265 	0x46d00001, 0x45d20001, 0x44d40001, 0x43d60001, 0x42d80001,
266 	0x08da0001, 0x07dc0001, 0x06de0001, 0x05e00001, 0x04e20001,
267 	0x03e40001, 0x02e60001, 0x01e80001, 0x01ea0001, 0x01ec0001,
268 	0x01ee0001, 0x01f00001, 0x01f20001, 0x01f40001, 0x01f60001,
269 	0x01f80001, 0x01fa0001, 0x01fc0001, 0x01fe0001
270 }, rtl8812au_agc_vals1[] = {
271 	0xff800001, 0xff820001, 0xff840001, 0xfe860001, 0xfd880001,
272 	0xfc8a0001, 0xfb8c0001, 0xfa8e0001, 0xf9900001, 0xf8920001,
273 	0xf7940001, 0xf6960001, 0xf5980001, 0xf49a0001, 0xf39c0001,
274 	0xf29e0001, 0xf1a00001, 0xf0a20001, 0xefa40001, 0xeea60001,
275 	0xeda80001, 0xecaa0001, 0xebac0001, 0xeaae0001, 0xe9b00001,
276 	0xe8b20001, 0xe7b40001, 0xe6b60001, 0xe5b80001, 0xe4ba0001,
277 	0xe3bc0001, 0xa8be0001, 0xa7c00001, 0xa6c20001, 0xa5c40001,
278 	0xa4c60001, 0xa3c80001, 0xa2ca0001, 0xa1cc0001, 0x68ce0001,
279 	0x67d00001, 0x66d20001, 0x65d40001, 0x64d60001, 0x47d80001,
280 	0x46da0001, 0x45dc0001, 0x44de0001, 0x43e00001, 0x42e20001,
281 	0x08e40001, 0x07e60001, 0x06e80001, 0x05ea0001, 0x04ec0001,
282 	0x03ee0001, 0x02f00001, 0x01f20001, 0x01f40001, 0x01f60001,
283 	0x01f80001, 0x01fa0001, 0x01fc0001, 0x01fe0001
284 };
285 
286 static const struct rtwn_agc_prog rtl8812au_agc[] = {
287 	/*
288 	 * External 2GHz LNA (type 0).
289 	 */
290 	{
291 		nitems(rtl8812au_agc_vals0_lna_g0),
292 		rtl8812au_agc_vals0_lna_g0,
293 		{ R12A_COND_GLNA | R12A_COND_TYPE(0x0), 0 },
294 		/*
295 		 * External 2GHz LNA (type 5).
296 		 */
297 		&(const struct rtwn_agc_prog){
298 			nitems(rtl8812au_agc_vals0_lna_g5),
299 			rtl8812au_agc_vals0_lna_g5,
300 			{ R12A_COND_GLNA | R12A_COND_TYPE(0x5), 0 },
301 			/*
302 			 * Others.
303 			 */
304 			&(const struct rtwn_agc_prog){
305 				nitems(rtl8812au_agc_vals0),
306 				rtl8812au_agc_vals0,
307 				{ 0 },
308 				NULL
309 			}
310 		}
311 	},
312 	/*
313 	 * External 5GHz LNA (type 0).
314 	 */
315 	{
316 		nitems(rtl8812au_agc_vals1_lna_a0),
317 		rtl8812au_agc_vals1_lna_a0,
318 		{ R12A_COND_ALNA | R12A_COND_TYPE(0x0), 0 },
319 		/*
320 		 * Others.
321 		 */
322 		&(const struct rtwn_agc_prog){
323 			nitems(rtl8812au_agc_vals1),
324 			rtl8812au_agc_vals1,
325 			{ 0 },
326 			NULL
327 		}
328 	}
329 };
330 
331 /*
332  * RF initialization values.
333  */
334 static const uint8_t rtl8812au_rf0_regs0[] = {
335 	0x00, 0x18, 0x56, 0x66, 0x1e, 0x89
336 }, rtl8812au_rf0_regs1[] = {
337 	0x86
338 }, rtl8812au_rf0_regs2[] = {
339 	0x8b
340 }, rtl8812au_rf0_regs3[] = {
341 	0xb1, 0xb3, 0xb4, 0xba,	0x18, 0xef
342 }, rtl8812au_rf0_regs4[] = {
343 	0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b
344 }, rtl8812au_rf0_regs5[] = {
345 	0xef, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
346 	0x34
347 }, rtl8812au_rf0_regs6[] = {
348 	0xef, 0xef, 0xdf, 0x35, 0x35, 0x35, 0x36, 0x36, 0x36, 0x36, 0xef,
349 	0x51, 0x52, 0x53, 0x54, 0xef, 0x08, 0x18, 0xef, 0x3a, 0x3b, 0x3c,
350 	0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b,
351 	0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a,
352 	0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c,
353 	0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b,
354 	0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a,
355 	0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c, 0x3a, 0x3b, 0x3c,
356 	0x3a, 0x3b, 0x3c, 0xef
357 }, rtl8812au_rf0_regs7[] = {
358 	0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
359 	0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
360 	0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34
361 }, rtl8812au_rf0_regs8[] = {
362 	0xef, 0x18, 0xef, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
363 	0x35, 0xef, 0x18, 0xef, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
364 	0x36, 0x36, 0x36, 0x36, 0x36, 0xef, 0xef, 0x3c, 0x3c, 0x3c,
365 }, rtl8812au_rf0_regs9[] = {
366 	0xef, 0x18, 0xef, 0xdf, 0x1f
367 }, rtl8812au_rf0_regs10[] = {
368 	0x61, 0x62, 0x63, 0x64, 0x65
369 }, rtl8812au_rf0_regs11[] = {
370 	0x08, 0x1c, 0xb4, 0x18, 0xfe, 0xfe, 0xfe, 0xfe, 0xb4, 0x18
371 }, rtl8812au_rf1_regs0[] = {
372 	0x56, 0x66, 0x89
373 }, rtl8812au_rf1_regs3[] = {
374 	0xb1, 0xb3, 0xb4, 0xba, 0x18, 0xef
375 };
376 
377 static const uint32_t rtl8812au_rf0_vals0[] = {
378 	0x10000, 0x1712a, 0x51cf2, 0x40000, 0x80000, 0x00080
379 }, rtl8812au_rf0_vals1_lna_g0_g5[] = {
380 	0x14b3a
381 }, rtl8812au_rf0_vals1[] = {
382 	0x14b38
383 }, rtl8812au_rf0_vals2_lna_a0[] = {
384 	0x80180
385 }, rtl8812au_rf0_vals2[] = {
386 	0x87180
387 }, rtl8812au_rf0_vals3[] = {
388 	0x1fc1a, 0xf0810, 0x1a78d, 0x86180, 0x00006, 0x02000
389 }, rtl8812au_rf0_vals4_lna_g0_g5[] = {
390 	0x3f218, 0x30a58, 0x2fa58, 0x22590, 0x1fa50, 0x10248, 0x08240
391 }, rtl8812au_rf0_vals4[] = {
392 	0x38a58, 0x37a58, 0x2a590, 0x27a50, 0x18248, 0x10240, 0x08240
393 }, rtl8812au_rf0_vals5_pa_g0[] = {
394 	0x00100, 0x0a4ee, 0x09076, 0x08073, 0x07070, 0x0606d, 0x0506a,
395 	0x04049, 0x03046, 0x02028, 0x01025, 0x00022
396 }, rtl8812au_rf0_vals5[] = {
397 	0x00100, 0x0adf4, 0x09df1, 0x08dee, 0x07deb, 0x06de8, 0x05de5,
398 	0x04de2, 0x03ce6, 0x024e7, 0x014e4, 0x004e1
399 }, rtl8812au_rf0_vals6[] = {
400 	0x00000, 0x020a2, 0x00080, 0x00192, 0x08192, 0x10192, 0x00024,
401 	0x08024, 0x10024, 0x18024, 0x00000, 0x00c21, 0x006d9, 0xfc649,
402 	0x0017e, 0x00002, 0x08400, 0x1712a, 0x01000, 0x00080, 0x3a02c,
403 	0x04000, 0x00400, 0x3202c, 0x10000, 0x000a0, 0x2b064, 0x04000,
404 	0x000d8, 0x23070, 0x04000, 0x00468, 0x1b870, 0x10000, 0x00098,
405 	0x12085, 0xe4000, 0x00418, 0x0a080, 0xf0000, 0x00418, 0x02080,
406 	0x10000, 0x00080, 0x7a02c, 0x04000, 0x00400, 0x7202c, 0x10000,
407 	0x000a0, 0x6b064, 0x04000, 0x000d8, 0x63070, 0x04000, 0x00468,
408 	0x5b870, 0x10000, 0x00098, 0x52085, 0xe4000, 0x00418, 0x4a080,
409 	0xf0000, 0x00418, 0x42080, 0x10000, 0x00080, 0xba02c, 0x04000,
410 	0x00400, 0xb202c, 0x10000, 0x000a0, 0xab064, 0x04000, 0x000d8,
411 	0xa3070, 0x04000, 0x00468, 0x9b870, 0x10000, 0x00098, 0x92085,
412 	0xe4000, 0x00418, 0x8a080, 0xf0000, 0x00418, 0x82080, 0x10000,
413 	0x01100
414 }, rtl8812au_rf0_vals7_pa_a0[] = {
415 	0x4a0b2, 0x490af, 0x48070, 0x4706d, 0x46050, 0x4504d, 0x4404a,
416 	0x43047, 0x4200a, 0x41007, 0x40004, 0x2a0b2, 0x290af, 0x28070,
417 	0x2706d, 0x26050, 0x2504d, 0x2404a, 0x23047, 0x2200a, 0x21007,
418 	0x20004, 0x0a0b2, 0x090af, 0x08070, 0x0706d, 0x06050, 0x0504d,
419 	0x0404a, 0x03047, 0x0200a, 0x01007, 0x00004
420 }, rtl8812au_rf0_vals7_pa_a5[] = {
421 	0x4a0b2, 0x490af, 0x48070, 0x4706d, 0x4604d, 0x4504a, 0x44047,
422 	0x43044, 0x42007, 0x41004, 0x40001, 0x2a0b4, 0x290b1, 0x28072,
423 	0x2706f, 0x2604f, 0x2504c, 0x24049, 0x23046, 0x22009, 0x21006,
424 	0x20003, 0x0a0b2, 0x090af, 0x08070, 0x0706d, 0x0604d, 0x0504a,
425 	0x04047, 0x03044, 0x02007, 0x01004, 0x00001
426 }, rtl8812au_rf0_vals7[] = {
427 	0x4adf5, 0x49df2, 0x48def, 0x47dec, 0x46de9, 0x45de6, 0x44de3,
428 	0x438c8, 0x428c5, 0x418c2, 0x408c0, 0x2adf5, 0x29df2, 0x28def,
429 	0x27dec, 0x26de9, 0x25de6, 0x24de3, 0x238c8, 0x228c5, 0x218c2,
430 	0x208c0, 0x0aff7, 0x09df7, 0x08df4, 0x07df1, 0x06dee, 0x05deb,
431 	0x04de8, 0x038cc, 0x028c9, 0x018c6, 0x008c3
432 }, rtl8812au_rf0_vals8_pa_a0_a5[] = {
433 	0x00000, 0x1712a, 0x00040, 0x001d4, 0x081d4, 0x101d4, 0x201b4,
434 	0x281b4, 0x301b4, 0x401b4, 0x481b4, 0x501b4, 0x00000, 0x1712a,
435 	0x00010, 0x04bfb, 0x0cbfb, 0x14bfb, 0x1cbfb, 0x24f4b, 0x2cf4b,
436 	0x34f4b, 0x3cf4b, 0x44f4b, 0x4cf4b, 0x54f4b, 0x5cf4b, 0x00000,
437 	0x00008, 0x002cc, 0x00522, 0x00902
438 }, rtl8812au_rf0_vals8[] = {
439 	0x00000, 0x1712a, 0x00040, 0x00188, 0x08147, 0x10147, 0x201d7,
440 	0x281d7, 0x301d7, 0x401d8, 0x481d8, 0x501d8, 0x00000, 0x1712a,
441 	0x00010, 0x84eb4, 0x8cc35, 0x94c35, 0x9cc35, 0xa4c35, 0xacc35,
442 	0xb4c35, 0xbcc35, 0xc4c34, 0xccc35, 0xd4c35, 0xdcc35, 0x00000,
443 	0x00008, 0x002a8, 0x005a2, 0x00880
444 }, rtl8812au_rf0_vals9[] = {
445 	0x00000, 0x1712a, 0x00002, 0x00080, 0x00064
446 }, rtl8812au_rf0_vals10_pa_a0[] = {
447 	0xfdd43, 0x38f4b, 0x32117, 0x194ac, 0x931d1
448 }, rtl8812au_rf0_vals10_pa_a5[] = {
449 	0xfdd43, 0x38f4b, 0x32117, 0x194ac, 0x931d2
450 }, rtl8812au_rf0_vals10[] = {
451 	0xe5d53, 0x38fcd, 0x114eb, 0x196ac, 0x911d7
452 }, rtl8812au_rf0_vals11[] = {
453 	0x08400, 0x739d2, 0x1e78d, 0x1f12a, 0x0c350, 0x0c350, 0x0c350,
454 	0x0c350, 0x1a78d, 0x1712a
455 }, rtl8812au_rf1_vals0[] = {
456 	0x51cf2, 0x40000, 0x00080
457 }, rtl8812au_rf1_vals3[] = {
458 	0x1fc1a, 0xf0810, 0x1a78d, 0x86180, 0x00006, 0x02000
459 }, rtl8812au_rf1_vals6[] = {
460 	0x00000, 0x020a2, 0x00080, 0x00192, 0x08192, 0x10192, 0x00024,
461 	0x08024, 0x10024, 0x18024, 0x00000, 0x00c21, 0x006d9, 0xfc649,
462 	0x0017e, 0x00002, 0x08400, 0x1712a, 0x01000, 0x00080, 0x3a02c,
463 	0x04000, 0x00400, 0x3202c, 0x10000, 0x000a0, 0x2b064, 0x04000,
464 	0x000d8, 0x23070, 0x04000, 0x00468, 0x1b870, 0x10000, 0x00098,
465 	0x12085, 0xe4000, 0x00418, 0x0a080, 0xf0000, 0x00418, 0x02080,
466 	0x10000, 0x00080, 0x7a02c, 0x04000, 0x00400, 0x7202c, 0x10000,
467 	0x000a0, 0x6b064, 0x04000, 0x000d8, 0x63070, 0x04000, 0x00468,
468 	0x5b870, 0x10000, 0x00098, 0x52085, 0xe4000, 0x00418, 0x4a080,
469 	0xf0000, 0x00418, 0x42080, 0x10000, 0x00080, 0xba02c, 0x04000,
470 	0x00400, 0xb202c, 0x10000, 0x000a0, 0xab064, 0x04000, 0x000d8,
471 	0xa3070, 0x04000, 0x00468, 0x9b870, 0x10000, 0x00098, 0x92085,
472 	0xe4000, 0x00418, 0x8a080, 0xf0000, 0x00418, 0x82080, 0x10000,
473 	0x01100
474 }, rtl8812au_rf1_vals7_pa_a5[] = {
475 	0x4a0b1, 0x490ae, 0x4806f, 0x4706c, 0x4604c, 0x45049, 0x44046,
476 	0x43043, 0x42006, 0x41003, 0x40000, 0x2a0b3, 0x290b0, 0x28071,
477 	0x2706e, 0x2604e, 0x2504b, 0x24048, 0x23045, 0x22008, 0x21005,
478 	0x20002, 0x0a0b3, 0x090b0, 0x08070, 0x0706d, 0x0604d, 0x0504a,
479 	0x04047, 0x03044, 0x02007, 0x01004, 0x00001
480 }, rtl8812au_rf1_vals8_pa_a0_a5[] = {
481 	0x00000, 0x1712a, 0x00040, 0x001c5, 0x081c5, 0x101c5, 0x20174,
482 	0x28174, 0x30174, 0x40185, 0x48185, 0x50185, 0x00000, 0x1712a,
483 	0x00010, 0x05b8b, 0x0db8b, 0x15b8b, 0x1db8b, 0x262db, 0x2e2db,
484 	0x362db, 0x3e2db, 0x4553b, 0x4d53b, 0x5553b, 0x5d53b, 0x00000,
485 	0x00008, 0x002dc, 0x00524, 0x00902
486 }, rtl8812au_rf1_vals10_pa_g0_a0[] = {
487 	0xeac43, 0x38f47, 0x31157, 0x1c4ac, 0x931d1
488 }, rtl8812au_rf1_vals10_pa_a5[] = {
489 	0xeac43, 0x38f47, 0x31157, 0x1c4ac, 0x931d2
490 };
491 
492 static const struct rtwn_rf_prog rtl8812au_rf[] = {
493 	/* RF chain 0. */
494 	{
495 		nitems(rtl8812au_rf0_regs0),
496 		rtl8812au_rf0_regs0,
497 		rtl8812au_rf0_vals0,
498 		{ 0 },
499 		NULL
500 	},
501 	/* External 2GHz LNA, type 0 or 5. */
502 	{
503 		nitems(rtl8812au_rf0_regs1),
504 		rtl8812au_rf0_regs1,
505 		rtl8812au_rf0_vals1_lna_g0_g5,
506 		{
507 			R12A_COND_GLNA | R12A_COND_TYPE(0x0),
508 			R12A_COND_GLNA | R12A_COND_TYPE(0x5), 0
509 		},
510 		/* Others. */
511 		&(const struct rtwn_rf_prog){
512 			nitems(rtl8812au_rf0_regs1),
513 			rtl8812au_rf0_regs1,
514 			rtl8812au_rf0_vals1,
515 			{ 0 },
516 			NULL
517 		}
518 	},
519 	/* External 5GHz LNA, type 0. */
520 	{
521 		nitems(rtl8812au_rf0_regs2),
522 		rtl8812au_rf0_regs2,
523 		rtl8812au_rf0_vals2_lna_a0,
524 		{ R12A_COND_ALNA | R12A_COND_TYPE(0x0), 0 },
525 		/* Others. */
526 		&(const struct rtwn_rf_prog){
527 			nitems(rtl8812au_rf0_regs2),
528 			rtl8812au_rf0_regs2,
529 			rtl8812au_rf0_vals2,
530 			{ 0 },
531 			NULL
532 		}
533 	},
534 	{
535 		nitems(rtl8812au_rf0_regs3),
536 		rtl8812au_rf0_regs3,
537 		rtl8812au_rf0_vals3,
538 		{ 0 },
539 		NULL
540 	},
541 	/* External 2GHz LNA, type 0 or 5. */
542 	{
543 		nitems(rtl8812au_rf0_regs4),
544 		rtl8812au_rf0_regs4,
545 		rtl8812au_rf0_vals4_lna_g0_g5,
546 		{
547 			R12A_COND_GLNA | R12A_COND_TYPE(0x0),
548 			R12A_COND_GLNA | R12A_COND_TYPE(0x5), 0
549 		},
550 		/* Others */
551 		&(const struct rtwn_rf_prog){
552 			nitems(rtl8812au_rf0_regs4),
553 			rtl8812au_rf0_regs4,
554 			rtl8812au_rf0_vals4,
555 			{ 0 },
556 			NULL
557 		}
558 	},
559 	/* External 2GHz PA, type 0. */
560 	{
561 		nitems(rtl8812au_rf0_regs5),
562 		rtl8812au_rf0_regs5,
563 		rtl8812au_rf0_vals5_pa_g0,
564 		{ R12A_COND_GPA | R12A_COND_TYPE(0x0), 0 },
565 		/* Others. */
566 		&(const struct rtwn_rf_prog){
567 			nitems(rtl8812au_rf0_regs5),
568 			rtl8812au_rf0_regs5,
569 			rtl8812au_rf0_vals5,
570 			{ 0 },
571 			NULL
572 		}
573 	},
574 	{
575 		nitems(rtl8812au_rf0_regs6),
576 		rtl8812au_rf0_regs6,
577 		rtl8812au_rf0_vals6,
578 		{ 0 },
579 		NULL
580 	},
581 	/* External 5GHz PA, type 0. */
582 	{
583 		nitems(rtl8812au_rf0_regs7),
584 		rtl8812au_rf0_regs7,
585 		rtl8812au_rf0_vals7_pa_a0,
586 		{ R12A_COND_APA | R12A_COND_TYPE(0x0), 0 },
587 		/* External 5GHz PA, type 5. */
588 		&(const struct rtwn_rf_prog){
589 			nitems(rtl8812au_rf0_regs7),
590 			rtl8812au_rf0_regs7,
591 			rtl8812au_rf0_vals7_pa_a5,
592 			{ R12A_COND_APA | R12A_COND_TYPE(0x5), 0 },
593 			/* Others. */
594 			&(const struct rtwn_rf_prog){
595 				nitems(rtl8812au_rf0_regs7),
596 				rtl8812au_rf0_regs7,
597 				rtl8812au_rf0_vals7,
598 				{ 0 },
599 				NULL
600 			}
601 		}
602 	},
603 	/* External 5GHz PA, type 0 or 5. */
604 	{
605 		nitems(rtl8812au_rf0_regs8),
606 		rtl8812au_rf0_regs8,
607 		rtl8812au_rf0_vals8_pa_a0_a5,
608 		{
609 			R12A_COND_APA | R12A_COND_TYPE(0x0),
610 			R12A_COND_APA | R12A_COND_TYPE(0x5), 0
611 		},
612 		/* Others. */
613 		&(const struct rtwn_rf_prog){
614 			nitems(rtl8812au_rf0_regs8),
615 			rtl8812au_rf0_regs8,
616 			rtl8812au_rf0_vals8,
617 			{ 0 },
618 			NULL
619 		}
620 	},
621 	{
622 		nitems(rtl8812au_rf0_regs9),
623 		rtl8812au_rf0_regs9,
624 		rtl8812au_rf0_vals9,
625 		{ 0 },
626 		NULL
627 	},
628 	/* External 5GHz PA, type 0. */
629 	{
630 		nitems(rtl8812au_rf0_regs10),
631 		rtl8812au_rf0_regs10,
632 		rtl8812au_rf0_vals10_pa_a0,
633 		{ R12A_COND_APA | R12A_COND_TYPE(0x0), 0 },
634 		/* External 5GHz PA, type 5. */
635 		&(const struct rtwn_rf_prog){
636 			nitems(rtl8812au_rf0_regs10),
637 			rtl8812au_rf0_regs10,
638 			rtl8812au_rf0_vals10_pa_a5,
639 			{ R12A_COND_APA | R12A_COND_TYPE(0x5), 0 },
640 			/* Others. */
641 			&(const struct rtwn_rf_prog){
642 				nitems(rtl8812au_rf0_regs10),
643 				rtl8812au_rf0_regs10,
644 				rtl8812au_rf0_vals10,
645 				{ 0 },
646 				NULL
647 			}
648 		}
649 	},
650 	{
651 		nitems(rtl8812au_rf0_regs11),
652 		rtl8812au_rf0_regs11,
653 		rtl8812au_rf0_vals11,
654 		{ 0 },
655 		NULL
656 	},
657 	{ 0, NULL, NULL, { 0 },	NULL },
658 	/* RF chain 1. */
659 	{
660 		nitems(rtl8812au_rf1_regs0),
661 		rtl8812au_rf1_regs0,
662 		rtl8812au_rf1_vals0,
663 		{ 0 },
664 		NULL
665 	},
666 	/* rtl8812au_rf[1] */
667 	/* External 2GHz LNA, type 0 or 5. */
668 	{
669 		nitems(rtl8812au_rf0_regs1),
670 		rtl8812au_rf0_regs1,
671 		rtl8812au_rf0_vals1_lna_g0_g5,
672 		{
673 			R12A_COND_GLNA | R12A_COND_TYPE(0x0),
674 			R12A_COND_GLNA | R12A_COND_TYPE(0x5), 0
675 		},
676 		/* Others. */
677 		&(const struct rtwn_rf_prog){
678 			nitems(rtl8812au_rf0_regs1),
679 			rtl8812au_rf0_regs1,
680 			rtl8812au_rf0_vals1,
681 			{ 0 },
682 			NULL
683 		}
684 	},
685 	/* rtl8812au_rf[2] */
686 	/* External 5GHz LNA, type 0. */
687 	{
688 		nitems(rtl8812au_rf0_regs2),
689 		rtl8812au_rf0_regs2,
690 		rtl8812au_rf0_vals2_lna_a0,
691 		{ R12A_COND_ALNA | R12A_COND_TYPE(0x0), 0 },
692 		/* Others. */
693 		&(const struct rtwn_rf_prog){
694 			nitems(rtl8812au_rf0_regs2),
695 			rtl8812au_rf0_regs2,
696 			rtl8812au_rf0_vals2,
697 			{ 0 },
698 			NULL
699 		}
700 	},
701 	{
702 		nitems(rtl8812au_rf1_regs3),
703 		rtl8812au_rf1_regs3,
704 		rtl8812au_rf1_vals3,
705 		{ 0 },
706 		NULL
707 	},
708 	/* rtl8812au_rf[4] */
709 	/* External 2GHz LNA, type 0 or 5. */
710 	{
711 		nitems(rtl8812au_rf0_regs4),
712 		rtl8812au_rf0_regs4,
713 		rtl8812au_rf0_vals4_lna_g0_g5,
714 		{
715 			R12A_COND_GLNA | R12A_COND_TYPE(0x0),
716 			R12A_COND_GLNA | R12A_COND_TYPE(0x5), 0
717 		},
718 		/* Others */
719 		&(const struct rtwn_rf_prog){
720 			nitems(rtl8812au_rf0_regs4),
721 			rtl8812au_rf0_regs4,
722 			rtl8812au_rf0_vals4,
723 			{ 0 },
724 			NULL
725 		}
726 	},
727 	/* rtl8812au_rf[5] */
728 	/* External 2GHz PA, type 0. */
729 	{
730 		nitems(rtl8812au_rf0_regs5),
731 		rtl8812au_rf0_regs5,
732 		rtl8812au_rf0_vals5_pa_g0,
733 		{ R12A_COND_GPA | R12A_COND_TYPE(0x0), 0 },
734 		/* Others. */
735 		&(const struct rtwn_rf_prog){
736 			nitems(rtl8812au_rf0_regs5),
737 			rtl8812au_rf0_regs5,
738 			rtl8812au_rf0_vals5,
739 			{ 0 },
740 			NULL
741 		}
742 	},
743 	{
744 		nitems(rtl8812au_rf0_regs6),
745 		rtl8812au_rf0_regs6,
746 		rtl8812au_rf1_vals6,
747 		{ 0 },
748 		NULL
749 	},
750 	/* External 5GHz PA, type 0. */
751 	{
752 		nitems(rtl8812au_rf0_regs7),
753 		rtl8812au_rf0_regs7,
754 		rtl8812au_rf0_vals7_pa_a0,
755 		{ R12A_COND_APA | R12A_COND_TYPE(0x0), 0 },
756 		/* External 5GHz PA, type 5. */
757 		&(const struct rtwn_rf_prog){
758 			nitems(rtl8812au_rf0_regs7),
759 			rtl8812au_rf0_regs7,
760 			rtl8812au_rf1_vals7_pa_a5,
761 			{ R12A_COND_APA | R12A_COND_TYPE(0x5), 0 },
762 			/* Others. */
763 			&(const struct rtwn_rf_prog){
764 				nitems(rtl8812au_rf0_regs7),
765 				rtl8812au_rf0_regs7,
766 				rtl8812au_rf0_vals7,
767 				{ 0 },
768 				NULL
769 			}
770 		}
771 	},
772 	/* External 5GHz PA, type 0 or 5. */
773 	{
774 		nitems(rtl8812au_rf0_regs8),
775 		rtl8812au_rf0_regs8,
776 		rtl8812au_rf1_vals8_pa_a0_a5,
777 		{
778 			R12A_COND_APA | R12A_COND_TYPE(0x0),
779 			R12A_COND_APA | R12A_COND_TYPE(0x5), 0
780 		},
781 		/* Others. */
782 		&(const struct rtwn_rf_prog){
783 			nitems(rtl8812au_rf0_regs8),
784 			rtl8812au_rf0_regs8,
785 			rtl8812au_rf0_vals8,
786 			{ 0 },
787 			NULL
788 		}
789 	},
790 	{
791 		nitems(rtl8812au_rf0_regs9) - 1,
792 		rtl8812au_rf0_regs9,
793 		rtl8812au_rf0_vals9,
794 		{ 0 },
795 		NULL
796 	},
797 
798 	/* External 2GHz or 5GHz PA, type 0. */
799 	{
800 		nitems(rtl8812au_rf0_regs10),
801 		rtl8812au_rf0_regs10,
802 		rtl8812au_rf1_vals10_pa_g0_a0,
803 		{
804 			R12A_COND_GPA | R12A_COND_TYPE(0x0),
805 			R12A_COND_APA | R12A_COND_TYPE(0x0), 0
806 		},
807 		/* External 5GHz PA, type 5. */
808 		&(const struct rtwn_rf_prog){
809 			nitems(rtl8812au_rf0_regs10),
810 			rtl8812au_rf0_regs10,
811 			rtl8812au_rf1_vals10_pa_a5,
812 			{ R12A_COND_APA | R12A_COND_TYPE(0x5), 0 },
813 			/* Others. */
814 			&(const struct rtwn_rf_prog){
815 				nitems(rtl8812au_rf0_regs10),
816 				rtl8812au_rf0_regs10,
817 				rtl8812au_rf0_vals10,
818 				{ 0 },
819 				NULL
820 			}
821 		}
822 	},
823 	{
824 		1,
825 		rtl8812au_rf0_regs11,
826 		rtl8812au_rf0_vals11,
827 		{ 0 },
828 		NULL
829 	},
830 	{ 0, NULL, NULL, { 0 }, NULL }
831 };
832 
833 /*
834  * Registers to save before IQ calibration.
835  */
836 static const uint16_t r12a_iq_bb_regs[] = {
837 	0x520, 0x550, 0x808, 0xa04, 0x90c, 0xc00, 0xe00, 0x838, 0x82c
838 };
839 
840 static const uint16_t r12a_iq_afe_regs[] = {
841 	0xc5c, 0xc60, 0xc64, 0xc68, 0xcb0, 0xcb4, 0xe5c, 0xe60, 0xe64,
842 	0xe68, 0xeb0, 0xeb4
843 };
844 
845 static const uint8_t r12a_iq_rf_regs[] = {
846 	0x65, 0x8f, 0x0
847 };
848 
849 #endif	/* R12A_PRIV_H */
850