1 --- a/drivers/net/wireless/ath/ath9k/debug.c
2 +++ b/drivers/net/wireless/ath/ath9k/debug.c
3 @@ -1411,6 +1411,52 @@ static const struct file_operations fops
8 +static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf,
9 + size_t count, loff_t *ppos)
11 + struct ath_softc *sc = file->private_data;
12 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
16 + len = sprintf(buf, "0x%08x\n", common->chan_bw);
17 + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
20 +static ssize_t write_file_chan_bw(struct file *file, const char __user *user_buf,
21 + size_t count, loff_t *ppos)
23 + struct ath_softc *sc = file->private_data;
24 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
25 + unsigned long chan_bw;
29 + len = min(count, sizeof(buf) - 1);
30 + if (copy_from_user(buf, user_buf, len))
34 + if (kstrtoul(buf, 0, &chan_bw))
37 + common->chan_bw = chan_bw;
38 + if (!test_bit(ATH_OP_INVALID, &common->op_flags))
39 + ath9k_ops.config(sc->hw, IEEE80211_CONF_CHANGE_CHANNEL);
44 +static const struct file_operations fops_chanbw = {
45 + .read = read_file_chan_bw,
46 + .write = write_file_chan_bw,
47 + .open = simple_open,
48 + .owner = THIS_MODULE,
49 + .llseek = default_llseek,
53 int ath9k_init_debug(struct ath_hw *ah)
55 struct ath_common *common = ath9k_hw_common(ah);
56 @@ -1432,6 +1478,8 @@ int ath9k_init_debug(struct ath_hw *ah)
58 debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
60 + debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
62 debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy,
64 debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
65 --- a/drivers/net/wireless/ath/ath.h
66 +++ b/drivers/net/wireless/ath/ath.h
67 @@ -149,6 +149,7 @@ struct ath_common {
69 enum ath_device_state state;
70 unsigned long op_flags;
75 --- a/drivers/net/wireless/ath/ath9k/common.c
76 +++ b/drivers/net/wireless/ath/ath9k/common.c
77 @@ -297,11 +297,13 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_ke
79 * Update internal channel flags.
81 -static void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
82 +static void ath9k_cmn_update_ichannel(struct ath_common *common,
83 + struct ath9k_channel *ichan,
84 struct cfg80211_chan_def *chandef)
86 struct ieee80211_channel *chan = chandef->chan;
90 ichan->channel = chan->center_freq;
92 @@ -309,7 +311,19 @@ static void ath9k_cmn_update_ichannel(st
93 if (chan->band == NL80211_BAND_5GHZ)
94 flags |= CHANNEL_5GHZ;
96 - switch (chandef->width) {
97 + switch (common->chan_bw) {
99 + width = NL80211_CHAN_WIDTH_5;
102 + width = NL80211_CHAN_WIDTH_10;
105 + width = chandef->width;
110 case NL80211_CHAN_WIDTH_5:
111 flags |= CHANNEL_QUARTER;
113 @@ -342,10 +356,11 @@ struct ath9k_channel *ath9k_cmn_get_chan
114 struct cfg80211_chan_def *chandef)
116 struct ieee80211_channel *curchan = chandef->chan;
117 + struct ath_common *common = ath9k_hw_common(ah);
118 struct ath9k_channel *channel;
120 channel = &ah->channels[curchan->hw_value];
121 - ath9k_cmn_update_ichannel(channel, chandef);
122 + ath9k_cmn_update_ichannel(common, channel, chandef);