1 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
4 #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */
5 #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
7 +#define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6))
9 static int ar9003_hw_power_interpolate(int32_t x,
10 int32_t *px, int32_t *py, u_int16_t np);
11 static const struct ar9300_eeprom ar9300_default = {
12 @@ -296,21 +298,21 @@ static const struct ar9300_eeprom ar9300
16 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
17 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
18 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
20 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
21 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
22 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
24 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
25 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
26 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
28 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
29 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
30 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
31 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
32 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
33 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
35 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
36 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
37 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
39 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
40 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
41 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
43 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
44 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
45 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
48 /* 4 idle,t1,t2,b (4 bits per setting) */
49 @@ -582,56 +584,56 @@ static const struct ar9300_eeprom ar9300
53 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
54 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
55 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
56 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
61 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
62 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
63 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
64 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
69 - {60, 0}, {60, 1}, {60, 0}, {60, 1},
70 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
71 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
72 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
77 - {60, 0}, {60, 1}, {60, 1}, {60, 0},
78 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
79 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
80 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
85 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
86 - {60, 0}, {60, 0}, {60, 0}, {60, 0},
87 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
88 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
93 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
94 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
95 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
96 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
101 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
102 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
103 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
104 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
109 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
110 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
111 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
112 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
117 - {60, 1}, {60, 0}, {60, 1}, {60, 1},
118 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
119 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
120 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
124 @@ -873,21 +875,21 @@ static const struct ar9300_eeprom ar9300
128 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
129 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
130 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
132 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
133 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
134 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
136 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
137 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
138 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
140 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
141 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
142 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
143 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
144 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
145 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
147 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
148 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
149 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
151 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
152 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
153 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
155 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
156 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
157 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
160 /* 4 idle,t1,t2,b (4 bits per setting) */
161 @@ -1159,56 +1161,56 @@ static const struct ar9300_eeprom ar9300
165 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
166 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
167 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
168 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
173 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
174 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
175 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
176 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
181 - {60, 0}, {60, 1}, {60, 0}, {60, 1},
182 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
183 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
184 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
189 - {60, 0}, {60, 1}, {60, 1}, {60, 0},
190 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
191 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
192 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
197 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
198 - {60, 0}, {60, 0}, {60, 0}, {60, 0},
199 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
200 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
205 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
206 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
207 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
208 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
213 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
214 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
215 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
216 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
221 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
222 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
223 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
224 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
229 - {60, 1}, {60, 0}, {60, 1}, {60, 1},
230 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
231 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
232 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
236 @@ -1451,21 +1453,21 @@ static const struct ar9300_eeprom ar9300
240 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
241 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
242 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
244 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
245 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
246 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
248 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
249 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
250 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
252 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
253 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
254 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
255 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
256 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
257 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
259 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
260 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
261 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
263 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
264 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
265 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
267 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
268 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
269 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
272 /* 4 idle,t1,t2,b (4 bits per setting) */
273 @@ -1737,56 +1739,56 @@ static const struct ar9300_eeprom ar9300
277 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
278 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
279 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
280 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
285 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
286 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
287 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
288 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
293 - {60, 0}, {60, 1}, {60, 0}, {60, 1},
294 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
295 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
296 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
301 - {60, 0}, {60, 1}, {60, 1}, {60, 0},
302 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
303 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
304 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
309 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
310 - {60, 0}, {60, 0}, {60, 0}, {60, 0},
311 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
312 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
317 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
318 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
319 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
320 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
325 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
326 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
327 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
328 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
333 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
334 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
335 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
336 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
341 - {60, 1}, {60, 0}, {60, 1}, {60, 1},
342 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
343 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
344 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
348 @@ -2029,21 +2031,21 @@ static const struct ar9300_eeprom ar9300
352 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
353 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
354 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
356 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
357 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
358 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
360 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
361 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
362 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
364 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
365 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
366 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
367 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
368 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
369 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
371 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
372 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
373 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
375 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
376 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
377 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
379 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
380 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
381 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
384 /* 4 idle,t1,t2,b (4 bits per setting) */
385 @@ -2315,56 +2317,56 @@ static const struct ar9300_eeprom ar9300
389 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
390 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
391 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
392 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
397 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
398 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
399 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
400 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
405 - {60, 0}, {60, 1}, {60, 0}, {60, 1},
406 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
407 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
408 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
413 - {60, 0}, {60, 1}, {60, 1}, {60, 0},
414 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
415 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
416 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
421 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
422 - {60, 0}, {60, 0}, {60, 0}, {60, 0},
423 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
424 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
429 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
430 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
431 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
432 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
437 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
438 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
439 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
440 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
445 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
446 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
447 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
448 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
453 - {60, 1}, {60, 0}, {60, 1}, {60, 1},
454 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
455 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
456 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
460 @@ -2606,21 +2608,21 @@ static const struct ar9300_eeprom ar9300
464 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
465 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
466 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
468 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
469 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
470 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
472 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
473 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
474 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
476 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
477 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
478 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
479 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
480 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
481 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
483 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } },
484 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
485 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
487 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
488 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
489 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
491 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
492 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
493 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
496 /* 4 idle,t1,t2,b (4 bits per setting) */
497 @@ -2892,56 +2894,56 @@ static const struct ar9300_eeprom ar9300
501 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
502 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
503 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
504 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
509 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
510 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
511 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
512 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
517 - {60, 0}, {60, 1}, {60, 0}, {60, 1},
518 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
519 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
520 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
525 - {60, 0}, {60, 1}, {60, 1}, {60, 0},
526 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
527 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
528 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
533 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
534 - {60, 0}, {60, 0}, {60, 0}, {60, 0},
535 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
536 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
541 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
542 - {60, 1}, {60, 0}, {60, 0}, {60, 0},
543 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
544 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
549 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
550 - {60, 1}, {60, 1}, {60, 1}, {60, 1},
551 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
552 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
557 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
558 - {60, 1}, {60, 1}, {60, 1}, {60, 0},
559 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
560 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
565 - {60, 1}, {60, 0}, {60, 1}, {60, 1},
566 - {60, 1}, {60, 1}, {60, 0}, {60, 1},
567 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
568 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
572 @@ -4365,9 +4367,9 @@ static u16 ar9003_hw_get_direct_edge_pow
573 struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
576 - return ctl_2g[idx].ctlEdges[edge].tPower;
577 + return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]);
579 - return ctl_5g[idx].ctlEdges[edge].tPower;
580 + return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]);
583 static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
584 @@ -4385,12 +4387,12 @@ static u16 ar9003_hw_get_indirect_edge_p
587 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq &&
588 - ctl_2g[idx].ctlEdges[edge - 1].flag)
589 - return ctl_2g[idx].ctlEdges[edge - 1].tPower;
590 + CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1]))
591 + return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]);
593 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq &&
594 - ctl_5g[idx].ctlEdges[edge - 1].flag)
595 - return ctl_5g[idx].ctlEdges[edge - 1].tPower;
596 + CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1]))
597 + return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]);
600 return AR9300_MAX_RATE_POWER;
601 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
602 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
603 @@ -270,17 +270,12 @@ struct cal_tgt_pow_ht {
607 -struct cal_ctl_edge_pwr {
612 struct cal_ctl_data_2g {
613 - struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_2G];
614 + u8 ctlEdges[AR9300_NUM_BAND_EDGES_2G];
617 struct cal_ctl_data_5g {
618 - struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_5G];
619 + u8 ctlEdges[AR9300_NUM_BAND_EDGES_5G];
622 struct ar9300_BaseExtension_1 {
623 --- a/drivers/net/wireless/ath/ath9k/eeprom.c
624 +++ b/drivers/net/wireless/ath/ath9k/eeprom.c
625 @@ -240,16 +240,16 @@ u16 ath9k_hw_get_max_edge_power(u16 freq
626 for (i = 0; (i < num_band_edges) &&
627 (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
628 if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) {
629 - twiceMaxEdgePower = pRdEdgesPower[i].tPower;
630 + twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl);
632 } else if ((i > 0) &&
633 (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel,
635 if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel,
637 - pRdEdgesPower[i - 1].flag) {
638 + CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) {
640 - pRdEdgesPower[i - 1].tPower;
641 + CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl);
645 --- a/drivers/net/wireless/ath/ath9k/eeprom.h
646 +++ b/drivers/net/wireless/ath/ath9k/eeprom.h
649 #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1)
651 +#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f)
652 +#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03)
654 +#define LNA_CTL_BUF_MODE BIT(0)
655 +#define LNA_CTL_ISEL_LO BIT(1)
656 +#define LNA_CTL_ISEL_HI BIT(2)
657 +#define LNA_CTL_BUF_IN BIT(3)
658 +#define LNA_CTL_FEM_BAND BIT(4)
659 +#define LNA_CTL_LOCAL_BIAS BIT(5)
660 +#define LNA_CTL_FORCE_XPA BIT(6)
661 +#define LNA_CTL_USE_ANT1 BIT(7)
666 @@ -379,10 +391,7 @@ struct modal_eep_header {
667 u8 xatten2Margin[AR5416_MAX_CHAINS];
673 - femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
676 u16 xpaBiasLvlFreq[3];
678 @@ -536,18 +545,10 @@ struct cal_target_power_ht {
683 -#ifdef __BIG_ENDIAN_BITFIELD
684 struct cal_ctl_edges {
686 - u8 flag:2, tPower:6;
690 -struct cal_ctl_edges {
692 - u8 tPower:6, flag:2;
696 struct cal_data_op_loop_ar9287 {
698 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
699 +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
700 @@ -451,9 +451,10 @@ static void ath9k_hw_def_set_board_value
701 ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
702 AR_AN_TOP2_LOCALBIAS,
703 AR_AN_TOP2_LOCALBIAS_S,
704 - pModal->local_bias);
705 + !!(pModal->lna_ctl &
706 + LNA_CTL_LOCAL_BIAS));
707 REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
708 - pModal->force_xpaon);
709 + !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA));
712 REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
713 @@ -1435,9 +1436,9 @@ static u8 ath9k_hw_def_get_num_ant_confi
717 - if (pBase->version >= 0x0E0D)
718 - if (pModal->useAnt1)
719 - num_ant_config += 1;
720 + if (pBase->version >= 0x0E0D &&
721 + (pModal->lna_ctl & LNA_CTL_USE_ANT1))
722 + num_ant_config += 1;
724 return num_ant_config;