mac80211: add initial support for AR9330
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 565-ath9k-add-fast_div_bias-configuration-for-diversity-.patch
1 diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
2 index 99f55b3..80bb04f 100644
3 --- a/drivers/net/wireless/ath/ath9k/recv.c
4 +++ b/drivers/net/wireless/ath/ath9k/recv.c
5 @@ -1364,6 +1364,89 @@ static void ath_ant_div_conf_fast_divbias(struct ath_hw_antcomb_conf *ant_conf,
6 default:
7 break;
8 }
9 + } else if (ant_conf->div_group == 1) {
10 + /* Adjust the fast_div_bias based on main and alt_lna_conf */
11 + switch ((ant_conf->main_lna_conf << 4) |
12 + ant_conf->alt_lna_conf) {
13 + case 0x01: /* A-B LNA2 */
14 + ant_conf->fast_div_bias = 0x1;
15 + ant_conf->main_gaintb = 0;
16 + ant_conf->alt_gaintb = 0;
17 + break;
18 + case 0x02: /* A-B LNA1 */
19 + ant_conf->fast_div_bias = 0x1;
20 + ant_conf->main_gaintb = 0;
21 + ant_conf->alt_gaintb = 0;
22 + break;
23 + case 0x03: /* A-B A+B */
24 + ant_conf->fast_div_bias = 0x1;
25 + ant_conf->main_gaintb = 0;
26 + ant_conf->alt_gaintb = 0;
27 + break;
28 + case 0x10: /* LNA2 A-B */
29 + if (!(antcomb->scan) &&
30 + (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO))
31 + ant_conf->fast_div_bias = 0x3f;
32 + else
33 + ant_conf->fast_div_bias = 0x1;
34 + ant_conf->main_gaintb = 0;
35 + ant_conf->alt_gaintb = 0;
36 + break;
37 + case 0x12: /* LNA2 LNA1 */
38 + ant_conf->fast_div_bias = 0x1;
39 + ant_conf->main_gaintb = 0;
40 + ant_conf->alt_gaintb = 0;
41 + break;
42 + case 0x13: /* LNA2 A+B */
43 + if (!(antcomb->scan) &&
44 + (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO))
45 + ant_conf->fast_div_bias = 0x3f;
46 + else
47 + ant_conf->fast_div_bias = 0x1;
48 + ant_conf->main_gaintb = 0;
49 + ant_conf->alt_gaintb = 0;
50 + break;
51 + case 0x20: /* LNA1 A-B */
52 + if (!(antcomb->scan) &&
53 + (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO))
54 + ant_conf->fast_div_bias = 0x3f;
55 + else
56 + ant_conf->fast_div_bias = 0x1;
57 + ant_conf->main_gaintb = 0;
58 + ant_conf->alt_gaintb = 0;
59 + break;
60 + case 0x21: /* LNA1 LNA2 */
61 + ant_conf->fast_div_bias = 0x1;
62 + ant_conf->main_gaintb = 0;
63 + ant_conf->alt_gaintb = 0;
64 + break;
65 + case 0x23: /* LNA1 A+B */
66 + if (!(antcomb->scan) &&
67 + (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO))
68 + ant_conf->fast_div_bias = 0x3f;
69 + else
70 + ant_conf->fast_div_bias = 0x1;
71 + ant_conf->main_gaintb = 0;
72 + ant_conf->alt_gaintb = 0;
73 + break;
74 + case 0x30: /* A+B A-B */
75 + ant_conf->fast_div_bias = 0x1;
76 + ant_conf->main_gaintb = 0;
77 + ant_conf->alt_gaintb = 0;
78 + break;
79 + case 0x31: /* A+B LNA2 */
80 + ant_conf->fast_div_bias = 0x1;
81 + ant_conf->main_gaintb = 0;
82 + ant_conf->alt_gaintb = 0;
83 + break;
84 + case 0x32: /* A+B LNA1 */
85 + ant_conf->fast_div_bias = 0x1;
86 + ant_conf->main_gaintb = 0;
87 + ant_conf->alt_gaintb = 0;
88 + break;
89 + default:
90 + break;
91 + }
92 } else if (ant_conf->div_group == 2) {
93 /* Adjust the fast_div_bias based on main and alt_lna_conf */
94 switch ((ant_conf->main_lna_conf << 4) |