summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>2011-10-04 18:11:41 +0200
committerPhilippe LANGLAIS <philippe.langlais@stericsson.com>2011-10-13 10:21:57 +0200
commit9f9e9c3ff112d6ba5b1723a8ae1f67450d7091b1 (patch)
tree8f4212951836aeaa1191e7382ddf42be17781cf1
parenta84a4713de0500ab8feeea453bdb463e652dce91 (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.c53
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: