aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2012-11-19 03:54:46 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-11-19 10:45:40 -0500
commitac46ba4384d2c44c56702d0da591696045fba682 (patch)
treed96d638823d533c9154bfbbe03af834a25518089
parent57527f8d4d71b5167a02fb6713857f55d3974748 (diff)
ath9k: Fix BTCOEX debugfs file usage
The debugfs file for dumping btcoex parameters unconditionally assumes a MCI-based device. This will not work for older btcoex chips. Fix this by branching out the routine into separate functions. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h11
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/gpio.c51
3 files changed, 50 insertions, 20 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 4e125d8904a0..9a93d2bb8f66 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -461,6 +461,12 @@ void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type);
461/* BTCOEX */ 461/* BTCOEX */
462/**********/ 462/**********/
463 463
464#define ATH_DUMP_BTCOEX(_s, _val) \
465 do { \
466 len += snprintf(buf + len, size - len, \
467 "%20s : %10d\n", _s, (_val)); \
468 } while (0)
469
464enum bt_op_flags { 470enum bt_op_flags {
465 BT_OP_PRIORITY_DETECTED, 471 BT_OP_PRIORITY_DETECTED,
466 BT_OP_SCAN, 472 BT_OP_SCAN,
@@ -494,7 +500,7 @@ void ath9k_btcoex_timer_pause(struct ath_softc *sc);
494void ath9k_btcoex_handle_interrupt(struct ath_softc *sc, u32 status); 500void ath9k_btcoex_handle_interrupt(struct ath_softc *sc, u32 status);
495u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen); 501u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen);
496void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc); 502void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc);
497int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 len, u32 size); 503int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 size);
498#else 504#else
499static inline int ath9k_init_btcoex(struct ath_softc *sc) 505static inline int ath9k_init_btcoex(struct ath_softc *sc)
500{ 506{
@@ -521,8 +527,7 @@ static inline u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc,
521static inline void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc) 527static inline void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc)
522{ 528{
523} 529}
524static inline int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, 530static inline int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 size)
525 u32 len, u32 size)
526{ 531{
527 return 0; 532 return 0;
528} 533}
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index a8be94b2a53a..585aee47860c 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1599,8 +1599,14 @@ static ssize_t read_file_btcoex(struct file *file, char __user *user_buf,
1599 if (buf == NULL) 1599 if (buf == NULL)
1600 return -ENOMEM; 1600 return -ENOMEM;
1601 1601
1602 len = ath9k_dump_btcoex(sc, buf, len, size); 1602 if (!sc->sc_ah->common.btcoex_enabled) {
1603 len = snprintf(buf, size, "%s\n",
1604 "BTCOEX is disabled");
1605 goto exit;
1606 }
1603 1607
1608 len = ath9k_dump_btcoex(sc, buf, size);
1609exit:
1604 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 1610 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
1605 kfree(buf); 1611 kfree(buf);
1606 1612
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c
index a8ea57b9f49c..4236df8ffe67 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -494,35 +494,31 @@ int ath9k_init_btcoex(struct ath_softc *sc)
494 return 0; 494 return 0;
495} 495}
496 496
497int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 len, u32 size) 497static int ath9k_dump_mci_btcoex(struct ath_softc *sc, u8 *buf, u32 size)
498{ 498{
499#define ATH_DUMP_BTCOEX(_s, _val) \
500 do { \
501 len += snprintf(buf + len, size - len, \
502 "%20s : %10d\n", _s, (_val)); \
503 } while (0)
504
505 struct ath_btcoex *btcoex = &sc->btcoex; 499 struct ath_btcoex *btcoex = &sc->btcoex;
506 struct ath_mci_profile *mci = &btcoex->mci; 500 struct ath_mci_profile *mci = &btcoex->mci;
507 struct ath_hw *ah = sc->sc_ah; 501 struct ath_hw *ah = sc->sc_ah;
508 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 502 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
503 u32 len = 0;
509 int i; 504 int i;
510 505
511 ATH_DUMP_BTCOEX("Total BT profiles", NUM_PROF(mci)); 506 ATH_DUMP_BTCOEX("Total BT profiles", NUM_PROF(mci));
512 ATH_DUMP_BTCOEX("Number of MGMT", mci->num_mgmt); 507 ATH_DUMP_BTCOEX("MGMT", mci->num_mgmt);
513 ATH_DUMP_BTCOEX("Number of SCO", mci->num_sco); 508 ATH_DUMP_BTCOEX("SCO", mci->num_sco);
514 ATH_DUMP_BTCOEX("Number of A2DP", mci->num_a2dp); 509 ATH_DUMP_BTCOEX("A2DP", mci->num_a2dp);
515 ATH_DUMP_BTCOEX("Number of HID", mci->num_hid); 510 ATH_DUMP_BTCOEX("HID", mci->num_hid);
516 ATH_DUMP_BTCOEX("Number of PAN", mci->num_pan); 511 ATH_DUMP_BTCOEX("PAN", mci->num_pan);
517 ATH_DUMP_BTCOEX("Number of ACL", mci->num_other_acl); 512 ATH_DUMP_BTCOEX("ACL", mci->num_other_acl);
518 ATH_DUMP_BTCOEX("Number of BDR", mci->num_bdr); 513 ATH_DUMP_BTCOEX("BDR", mci->num_bdr);
519 ATH_DUMP_BTCOEX("Aggr. Limit", mci->aggr_limit); 514 ATH_DUMP_BTCOEX("Aggr. Limit", mci->aggr_limit);
520 ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type); 515 ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type);
521 ATH_DUMP_BTCOEX("BTCoex Period (msec)", btcoex->btcoex_period); 516 ATH_DUMP_BTCOEX("BTCoex Period (msec)", btcoex->btcoex_period);
522 ATH_DUMP_BTCOEX("Duty Cycle", btcoex->duty_cycle); 517 ATH_DUMP_BTCOEX("Duty Cycle", btcoex->duty_cycle);
523 ATH_DUMP_BTCOEX("BT Wait time", btcoex->bt_wait_time); 518 ATH_DUMP_BTCOEX("BT Wait time", btcoex->bt_wait_time);
524 ATH_DUMP_BTCOEX("Concurrent Tx", btcoex_hw->mci.concur_tx); 519 ATH_DUMP_BTCOEX("Concurrent Tx", btcoex_hw->mci.concur_tx);
525 ATH_DUMP_BTCOEX("Concur RSSI count", btcoex->rssi_count); 520 ATH_DUMP_BTCOEX("Concurrent RSSI cnt", btcoex->rssi_count);
521
526 len += snprintf(buf + len, size - len, "BT Weights: "); 522 len += snprintf(buf + len, size - len, "BT Weights: ");
527 for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 523 for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++)
528 len += snprintf(buf + len, size - len, "%08x ", 524 len += snprintf(buf + len, size - len, "%08x ",
@@ -537,9 +533,32 @@ int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 len, u32 size)
537 for (i = 0; i < ATH_BTCOEX_STOMP_MAX; i++) 533 for (i = 0; i < ATH_BTCOEX_STOMP_MAX; i++)
538 len += snprintf(buf + len, size - len, "%08x ", 534 len += snprintf(buf + len, size - len, "%08x ",
539 btcoex_hw->tx_prio[i]); 535 btcoex_hw->tx_prio[i]);
536
540 len += snprintf(buf + len, size - len, "\n"); 537 len += snprintf(buf + len, size - len, "\n");
541#undef ATH_DUMP_BTCOEX
542 538
543 return len; 539 return len;
544} 540}
541
542static int ath9k_dump_legacy_btcoex(struct ath_softc *sc, u8 *buf, u32 size)
543{
544
545 struct ath_btcoex *btcoex = &sc->btcoex;
546 u32 len = 0;
547
548 ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type);
549 ATH_DUMP_BTCOEX("BTCoex Period (msec)", btcoex->btcoex_period);
550 ATH_DUMP_BTCOEX("Duty Cycle", btcoex->duty_cycle);
551 ATH_DUMP_BTCOEX("BT Wait time", btcoex->bt_wait_time);
552
553 return len;
554}
555
556int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 size)
557{
558 if (ath9k_hw_mci_is_enabled(sc->sc_ah))
559 return ath9k_dump_mci_btcoex(sc, buf, size);
560 else
561 return ath9k_dump_legacy_btcoex(sc, buf, size);
562}
563
545#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ 564#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */