diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2013-07-29 06:34:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-08-01 15:50:50 -0400 |
commit | 4eba10cc8086e3dde09f00e44b43ff4f8624d527 (patch) | |
tree | 3b0163f0a4b2a744d7eb8b03e951c33319e863aa /drivers/net/wireless/ath/ath9k | |
parent | c1de4a9557d9e25e41fc4ba034b9659152205539 (diff) |
ath9k: Add a debugfs file for antenna diversity
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 87454f6c7b4f..d8764ae3371e 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -321,6 +321,68 @@ static const struct file_operations fops_ant_diversity = { | |||
321 | .llseek = default_llseek, | 321 | .llseek = default_llseek, |
322 | }; | 322 | }; |
323 | 323 | ||
324 | static ssize_t read_file_antenna_diversity(struct file *file, | ||
325 | char __user *user_buf, | ||
326 | size_t count, loff_t *ppos) | ||
327 | { | ||
328 | struct ath_softc *sc = file->private_data; | ||
329 | struct ath_hw *ah = sc->sc_ah; | ||
330 | struct ath9k_hw_capabilities *pCap = &ah->caps; | ||
331 | struct ath_antenna_stats *as_main = &sc->debug.stats.ant_stats[ANT_MAIN]; | ||
332 | struct ath_antenna_stats *as_alt = &sc->debug.stats.ant_stats[ANT_ALT]; | ||
333 | unsigned int len = 0, size = 1024; | ||
334 | ssize_t retval = 0; | ||
335 | char *buf; | ||
336 | |||
337 | buf = kzalloc(size, GFP_KERNEL); | ||
338 | if (buf == NULL) | ||
339 | return -ENOMEM; | ||
340 | |||
341 | if (!(pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)) { | ||
342 | len += snprintf(buf + len, size - len, "%s\n", | ||
343 | "Antenna Diversity Combining is disabled"); | ||
344 | goto exit; | ||
345 | } | ||
346 | |||
347 | len += snprintf(buf + len, size - len, "%30s%15s\n", | ||
348 | "MAIN", "ALT"); | ||
349 | len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", | ||
350 | "RECV CNT", | ||
351 | as_main->recv_cnt, | ||
352 | as_alt->recv_cnt); | ||
353 | len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", | ||
354 | "LNA1", | ||
355 | as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1], | ||
356 | as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1]); | ||
357 | len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", | ||
358 | "LNA2", | ||
359 | as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA2], | ||
360 | as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA2]); | ||
361 | len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", | ||
362 | "LNA1 + LNA2", | ||
363 | as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2], | ||
364 | as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2]); | ||
365 | len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", | ||
366 | "LNA1 - LNA2", | ||
367 | as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2], | ||
368 | as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2]); | ||
369 | exit: | ||
370 | if (len > size) | ||
371 | len = size; | ||
372 | |||
373 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
374 | kfree(buf); | ||
375 | |||
376 | return retval; | ||
377 | } | ||
378 | |||
379 | static const struct file_operations fops_antenna_diversity = { | ||
380 | .read = read_file_antenna_diversity, | ||
381 | .open = simple_open, | ||
382 | .owner = THIS_MODULE, | ||
383 | .llseek = default_llseek, | ||
384 | }; | ||
385 | |||
324 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, | 386 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
325 | size_t count, loff_t *ppos) | 387 | size_t count, loff_t *ppos) |
326 | { | 388 | { |
@@ -1816,6 +1878,8 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1816 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); | 1878 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); |
1817 | debugfs_create_file("diversity", S_IRUSR | S_IWUSR, | 1879 | debugfs_create_file("diversity", S_IRUSR | S_IWUSR, |
1818 | sc->debug.debugfs_phy, sc, &fops_ant_diversity); | 1880 | sc->debug.debugfs_phy, sc, &fops_ant_diversity); |
1881 | debugfs_create_file("antenna_diversity", S_IRUSR, | ||
1882 | sc->debug.debugfs_phy, sc, &fops_antenna_diversity); | ||
1819 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT | 1883 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
1820 | debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, | 1884 | debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, |
1821 | &fops_btcoex); | 1885 | &fops_btcoex); |