diff options
author | Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com> | 2011-10-04 18:11:41 +0200 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2011-12-06 11:00:34 +0100 |
commit | 8a2fe0ce9f2d7b236d9c3e9eab368daf1c07014a (patch) | |
tree | 948898021f6c02e12e966e4949aa400594f066c8 | |
parent | e946c1738cce44a90a12213b582f4ab45c423558 (diff) |
cw1200: New debugfs entry for 11n support
New R/W entry /sys/kernel/debug/ieee80211/phy0/cw1200/11n allows
to disable and reenable 11n support in run-time.
Disable 11n:
echo 0 > /sys/kernel/debug/ieee80211/phy0/cw1200/11n
Enable 11n:
echo 1 > /sys/kernel/debug/ieee80211/phy0/cw1200/11n
ST-Ericsson ID: 365735
Change-Id: Ie7b667308aa276e4ac0f4f365f86b2b103a21f7e
Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/33005
Reviewed-by: QATEST
Reviewed-by: Bartosz MARKOWSKI <bartosz.markowski@tieto.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/33538
Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
-rw-r--r-- | drivers/staging/cw1200/debug.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/staging/cw1200/debug.c b/drivers/staging/cw1200/debug.c index 3715678d522..6ec0d086d8b 100644 --- a/drivers/staging/cw1200/debug.c +++ b/drivers/staging/cw1200/debug.c @@ -367,6 +367,55 @@ static const struct file_operations fops_counters = { .owner = THIS_MODULE, }; +static int cw1200_generic_open(struct inode *inode, struct file *file) +{ + file->private_data = inode->i_private; + return 0; +} + +static ssize_t cw1200_11n_read(struct file *file, + char __user *user_buf, size_t count, loff_t *ppos) +{ + struct cw1200_common *priv = file->private_data; + struct ieee80211_supported_band *band = + priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ]; + return simple_read_from_buffer(user_buf, count, ppos, + band->ht_cap.ht_supported ? "1\n" : "0\n", 2); +} + +static ssize_t cw1200_11n_write(struct file *file, + char __user *user_buf, size_t count, loff_t *ppos) +{ + struct cw1200_common *priv = file->private_data; + struct ieee80211_supported_band *band[2] = { + priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ], + priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ], + }; + char buf[1]; + int ena = 0; + + if (!count) + return -EINVAL; + if (copy_from_user(buf, user_buf, 1)) + return -EFAULT; + if (buf[0] == 1) + ena = 1; + + band[0]->ht_cap.ht_supported = ena; +#ifdef CONFIG_CW1200_5GHZ_SUPPORT + band[1]->ht_cap.ht_supported = ena; +#endif /* CONFIG_CW1200_5GHZ_SUPPORT */ + + return count; +} + +static const struct file_operations fops_11n = { + .open = cw1200_generic_open, + .read = cw1200_11n_read, + .write = cw1200_11n_write, + .llseek = default_llseek, +}; + int cw1200_debug_init(struct cw1200_common *priv) { struct cw1200_debug_priv *d = kzalloc(sizeof(struct cw1200_debug_priv), @@ -388,6 +437,10 @@ int cw1200_debug_init(struct cw1200_common *priv) priv, &fops_counters)) goto err; + if (!debugfs_create_file("11n", S_IRUSR | S_IWUSR, + d->debugfs_phy, priv, &fops_11n)) + goto err; + return 0; err: |