aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti/wl18xx/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ti/wl18xx/debugfs.c')
-rw-r--r--drivers/net/wireless/ti/wl18xx/debugfs.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c
index 7f1669cdea09..c93fae95baac 100644
--- a/drivers/net/wireless/ti/wl18xx/debugfs.c
+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
@@ -22,9 +22,12 @@
22 22
23#include "../wlcore/debugfs.h" 23#include "../wlcore/debugfs.h"
24#include "../wlcore/wlcore.h" 24#include "../wlcore/wlcore.h"
25#include "../wlcore/debug.h"
26#include "../wlcore/ps.h"
25 27
26#include "wl18xx.h" 28#include "wl18xx.h"
27#include "acx.h" 29#include "acx.h"
30#include "cmd.h"
28#include "debugfs.h" 31#include "debugfs.h"
29 32
30#define WL18XX_DEBUGFS_FWSTATS_FILE(a, b, c) \ 33#define WL18XX_DEBUGFS_FWSTATS_FILE(a, b, c) \
@@ -239,6 +242,45 @@ static const struct file_operations clear_fw_stats_ops = {
239 .llseek = default_llseek, 242 .llseek = default_llseek,
240}; 243};
241 244
245static ssize_t radar_detection_write(struct file *file,
246 const char __user *user_buf,
247 size_t count, loff_t *ppos)
248{
249 struct wl1271 *wl = file->private_data;
250 int ret;
251 u8 channel;
252
253 ret = kstrtou8_from_user(user_buf, count, 10, &channel);
254 if (ret < 0) {
255 wl1271_warning("illegal channel");
256 return -EINVAL;
257 }
258
259 mutex_lock(&wl->mutex);
260
261 if (unlikely(wl->state != WLCORE_STATE_ON))
262 goto out;
263
264 ret = wl1271_ps_elp_wakeup(wl);
265 if (ret < 0)
266 goto out;
267
268 ret = wl18xx_cmd_radar_detection_debug(wl, channel);
269 if (ret < 0)
270 count = ret;
271
272 wl1271_ps_elp_sleep(wl);
273out:
274 mutex_unlock(&wl->mutex);
275 return count;
276}
277
278static const struct file_operations radar_detection_ops = {
279 .write = radar_detection_write,
280 .open = simple_open,
281 .llseek = default_llseek,
282};
283
242int wl18xx_debugfs_add_files(struct wl1271 *wl, 284int wl18xx_debugfs_add_files(struct wl1271 *wl,
243 struct dentry *rootdir) 285 struct dentry *rootdir)
244{ 286{
@@ -390,6 +432,7 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
390 DEBUGFS_FWSTATS_ADD(mem, fw_gen_free_mem_blks); 432 DEBUGFS_FWSTATS_ADD(mem, fw_gen_free_mem_blks);
391 433
392 DEBUGFS_ADD(conf, moddir); 434 DEBUGFS_ADD(conf, moddir);
435 DEBUGFS_ADD(radar_detection, moddir);
393 436
394 return 0; 437 return 0;
395 438