[OpenWrt-Devel] [PATCH 1/2] mac80211: 5/10 MHz channel width support for ath9k_htc
Tomislav Požega
pozega.tomislav at gmail.com
Thu Sep 6 10:20:12 EDT 2018
Add 5/10 MHz channel width support for ath9k_htc driver. Connection tested
between several devices and working.
Signed-off-by: Tomislav Požega <pozega.tomislav at gmail.com>
---
.../patches/512-ath9k_channelbw_debugfs.patch | 62 ++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
index 2ebb73d..9349c07 100644
--- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
+++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
@@ -123,3 +123,65 @@
return channel;
}
+--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
++++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+@@ -398,6 +398,50 @@ static const struct file_operations fops
+ .llseek = default_llseek,
+ };
+
++static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct ath9k_htc_priv *priv = file->private_data;
++ struct ath_common *common = ath9k_hw_common(priv->ah);
++ char buf[32];
++ unsigned int len;
++
++ len = sprintf(buf, "0x%08x\n", common->chan_bw);
++ 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 ath9k_htc_priv *priv = file->private_data;
++ struct ath_common *common = ath9k_hw_common(priv->ah);
++ 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';
++ if (kstrtoul(buf, 0, &chan_bw))
++ return -EINVAL;
++
++ common->chan_bw = chan_bw;
++ if (!test_bit(ATH_OP_INVALID, &common->op_flags))
++ ath9k_htc_ops.config(priv->hw, IEEE80211_CONF_CHANGE_CHANNEL);
++
++ return count;
++}
++
++static const struct file_operations fops_chanbw = {
++ .read = read_file_chan_bw,
++ .write = write_file_chan_bw,
++ .open = simple_open,
++ .owner = THIS_MODULE,
++ .llseek = default_llseek,
++};
++
+ /* Ethtool support for get-stats */
+ #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
+ static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = {
+@@ -520,5 +564,8 @@ int ath9k_htc_init_debug(struct ath_hw *
+ ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah);
+ ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah);
+
++ debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy,
++ priv, &fops_chanbw);
++
+ return 0;
+ }
--
1.7.0.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list