ath9k: add a small hack to make changing the channel bandwidth to 5/10 mhz available...
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 540-ath9k_channelbw_debugfs.patch
1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -586,6 +586,7 @@ struct ath_softc {
4 struct ieee80211_hw *hw;
5 struct device *dev;
6
7 + u32 chan_bw;
8 int chan_idx;
9 int chan_is_ht;
10 struct survey_info *cur_survey;
11 --- a/drivers/net/wireless/ath/ath9k/debug.c
12 +++ b/drivers/net/wireless/ath/ath9k/debug.c
13 @@ -1281,6 +1281,9 @@ int ath9k_init_debug(struct ath_hw *ah)
14 debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
15 &fops_eeprom);
16
17 + debugfs_create_u32("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
18 + &sc->chan_bw);
19 +
20 sc->debug.regidx = 0;
21 return 0;
22 }
23 --- a/drivers/net/wireless/ath/ath9k/main.c
24 +++ b/drivers/net/wireless/ath/ath9k/main.c
25 @@ -226,6 +226,7 @@ static int ath_set_channel(struct ath_so
26 bool fastcc = true, stopped;
27 struct ieee80211_channel *channel = hw->conf.channel;
28 struct ath9k_hw_cal_data *caldata = NULL;
29 + u32 oldflags;
30 int r;
31
32 if (sc->sc_flags & SC_OP_INVALID)
33 @@ -268,6 +269,21 @@ static int ath_set_channel(struct ath_so
34 if (!stopped || !(sc->sc_flags & SC_OP_OFFCHANNEL))
35 fastcc = false;
36
37 + oldflags = hchan->channelFlags;
38 + switch (sc->chan_bw) {
39 + case 5:
40 + hchan->channelFlags &= ~CHANNEL_HALF;
41 + hchan->channelFlags |= CHANNEL_QUARTER;
42 + break;
43 + case 10:
44 + hchan->channelFlags &= ~CHANNEL_QUARTER;
45 + hchan->channelFlags |= CHANNEL_HALF;
46 + break;
47 + }
48 +
49 + if (oldflags != hchan->channelFlags)
50 + fastcc = false;
51 +
52 if (!(sc->sc_flags & SC_OP_OFFCHANNEL))
53 caldata = &sc->caldata;
54