2011-07-01 16:11:53 +00:00
|
|
|
--- a/drivers/net/wireless/ath/ath9k/debug.c
|
|
|
|
+++ b/drivers/net/wireless/ath/ath9k/debug.c
|
2023-11-07 00:02:11 +00:00
|
|
|
@@ -1413,6 +1413,52 @@ void ath9k_deinit_debug(struct ath_softc
|
|
|
|
ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
|
|
|
|
}
|
2011-11-19 16:56:44 +00:00
|
|
|
|
|
|
|
+
|
|
|
|
+static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf,
|
|
|
|
+ size_t count, loff_t *ppos)
|
|
|
|
+{
|
|
|
|
+ struct ath_softc *sc = file->private_data;
|
2013-10-10 14:31:22 +00:00
|
|
|
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
|
2011-11-19 16:56:44 +00:00
|
|
|
+ char buf[32];
|
|
|
|
+ unsigned int len;
|
|
|
|
+
|
2013-10-10 14:31:22 +00:00
|
|
|
+ len = sprintf(buf, "0x%08x\n", common->chan_bw);
|
2011-11-19 16:56:44 +00:00
|
|
|
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static ssize_t write_file_chan_bw(struct file *file, const char __user *user_buf,
|
|
|
|
+ size_t count, loff_t *ppos)
|
|
|
|
+{
|
|
|
|
+ struct ath_softc *sc = file->private_data;
|
2013-10-10 14:31:22 +00:00
|
|
|
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
|
2011-11-19 16:56:44 +00:00
|
|
|
+ unsigned long chan_bw;
|
|
|
|
+ char buf[32];
|
|
|
|
+ ssize_t len;
|
|
|
|
+
|
|
|
|
+ len = min(count, sizeof(buf) - 1);
|
|
|
|
+ if (copy_from_user(buf, user_buf, len))
|
|
|
|
+ return -EFAULT;
|
|
|
|
+
|
|
|
|
+ buf[len] = '\0';
|
2013-07-27 09:23:18 +00:00
|
|
|
+ if (kstrtoul(buf, 0, &chan_bw))
|
2011-11-19 16:56:44 +00:00
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
2013-10-10 14:31:22 +00:00
|
|
|
+ common->chan_bw = chan_bw;
|
2014-04-06 10:41:23 +00:00
|
|
|
+ if (!test_bit(ATH_OP_INVALID, &common->op_flags))
|
2013-09-08 09:38:38 +00:00
|
|
|
+ ath9k_ops.config(sc->hw, IEEE80211_CONF_CHANGE_CHANNEL);
|
2011-11-19 16:56:44 +00:00
|
|
|
+
|
|
|
|
+ return count;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static const struct file_operations fops_chanbw = {
|
|
|
|
+ .read = read_file_chan_bw,
|
|
|
|
+ .write = write_file_chan_bw,
|
2012-04-16 21:08:41 +00:00
|
|
|
+ .open = simple_open,
|
2011-11-19 16:56:44 +00:00
|
|
|
+ .owner = THIS_MODULE,
|
|
|
|
+ .llseek = default_llseek,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
int ath9k_init_debug(struct ath_hw *ah)
|
|
|
|
{
|
|
|
|
struct ath_common *common = ath9k_hw_common(ah);
|
2023-11-07 00:02:11 +00:00
|
|
|
@@ -1432,6 +1478,8 @@ int ath9k_init_debug(struct ath_hw *ah)
|
|
|
|
ath9k_tx99_init_debug(sc);
|
|
|
|
ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
|
2012-12-07 16:46:04 +00:00
|
|
|
|
2011-11-19 16:56:44 +00:00
|
|
|
+ debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
|
|
|
|
+ sc, &fops_chanbw);
|
2015-03-11 15:02:47 +00:00
|
|
|
debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy,
|
|
|
|
read_file_dma);
|
|
|
|
debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
|
2013-10-10 14:31:22 +00:00
|
|
|
--- a/drivers/net/wireless/ath/ath.h
|
|
|
|
+++ b/drivers/net/wireless/ath/ath.h
|
2023-11-07 00:02:11 +00:00
|
|
|
@@ -153,6 +153,7 @@ struct ath_common {
|
2013-10-10 14:31:22 +00:00
|
|
|
int debug_mask;
|
|
|
|
enum ath_device_state state;
|
2014-04-06 10:41:23 +00:00
|
|
|
unsigned long op_flags;
|
2013-10-10 14:31:22 +00:00
|
|
|
+ u32 chan_bw;
|
2013-09-08 09:38:32 +00:00
|
|
|
|
2013-10-10 14:31:22 +00:00
|
|
|
struct ath_ani ani;
|
2011-07-01 16:11:53 +00:00
|
|
|
|
2013-10-10 14:31:22 +00:00
|
|
|
--- a/drivers/net/wireless/ath/ath9k/common.c
|
|
|
|
+++ b/drivers/net/wireless/ath/ath9k/common.c
|
2017-08-22 21:59:48 +00:00
|
|
|
@@ -297,11 +297,13 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_ke
|
2013-10-10 14:31:22 +00:00
|
|
|
/*
|
|
|
|
* Update internal channel flags.
|
|
|
|
*/
|
|
|
|
-static void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
|
|
|
|
+static void ath9k_cmn_update_ichannel(struct ath_common *common,
|
|
|
|
+ struct ath9k_channel *ichan,
|
|
|
|
struct cfg80211_chan_def *chandef)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *chan = chandef->chan;
|
|
|
|
u16 flags = 0;
|
|
|
|
+ int width;
|
|
|
|
|
|
|
|
ichan->channel = chan->center_freq;
|
|
|
|
ichan->chan = chan;
|
2017-08-22 21:59:48 +00:00
|
|
|
@@ -309,7 +311,19 @@ static void ath9k_cmn_update_ichannel(st
|
2016-05-14 15:38:56 +00:00
|
|
|
if (chan->band == NL80211_BAND_5GHZ)
|
2013-10-10 14:31:22 +00:00
|
|
|
flags |= CHANNEL_5GHZ;
|
2011-08-28 18:38:24 +00:00
|
|
|
|
2013-10-10 14:31:22 +00:00
|
|
|
- switch (chandef->width) {
|
|
|
|
+ switch (common->chan_bw) {
|
|
|
|
+ case 5:
|
|
|
|
+ width = NL80211_CHAN_WIDTH_5;
|
|
|
|
+ break;
|
|
|
|
+ case 10:
|
|
|
|
+ width = NL80211_CHAN_WIDTH_10;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ width = chandef->width;
|
|
|
|
+ break;
|
|
|
|
+ }
|
2011-07-01 16:11:53 +00:00
|
|
|
+
|
2013-10-10 14:31:22 +00:00
|
|
|
+ switch (width) {
|
|
|
|
case NL80211_CHAN_WIDTH_5:
|
|
|
|
flags |= CHANNEL_QUARTER;
|
|
|
|
break;
|
2017-08-22 21:59:48 +00:00
|
|
|
@@ -342,10 +356,11 @@ struct ath9k_channel *ath9k_cmn_get_chan
|
2013-10-10 14:31:22 +00:00
|
|
|
struct cfg80211_chan_def *chandef)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *curchan = chandef->chan;
|
|
|
|
+ struct ath_common *common = ath9k_hw_common(ah);
|
|
|
|
struct ath9k_channel *channel;
|
|
|
|
|
2013-11-18 19:58:53 +00:00
|
|
|
channel = &ah->channels[curchan->hw_value];
|
2013-10-10 14:31:22 +00:00
|
|
|
- ath9k_cmn_update_ichannel(channel, chandef);
|
|
|
|
+ ath9k_cmn_update_ichannel(common, channel, chandef);
|
|
|
|
|
|
|
|
return channel;
|
|
|
|
}
|