diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/htc_drv_debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 477 |
1 files changed, 466 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c index eca777497fe5..aa48b3abbc48 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c | |||
@@ -33,9 +33,15 @@ static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, | |||
33 | 33 | ||
34 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); | 34 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); |
35 | 35 | ||
36 | ath9k_htc_ps_wakeup(priv); | ||
37 | |||
36 | WMI_CMD(WMI_INT_STATS_CMDID); | 38 | WMI_CMD(WMI_INT_STATS_CMDID); |
37 | if (ret) | 39 | if (ret) { |
40 | ath9k_htc_ps_restore(priv); | ||
38 | return -EINVAL; | 41 | return -EINVAL; |
42 | } | ||
43 | |||
44 | ath9k_htc_ps_restore(priv); | ||
39 | 45 | ||
40 | len += snprintf(buf + len, sizeof(buf) - len, | 46 | len += snprintf(buf + len, sizeof(buf) - len, |
41 | "%20s : %10u\n", "RX", | 47 | "%20s : %10u\n", "RX", |
@@ -85,9 +91,15 @@ static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf, | |||
85 | 91 | ||
86 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); | 92 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); |
87 | 93 | ||
94 | ath9k_htc_ps_wakeup(priv); | ||
95 | |||
88 | WMI_CMD(WMI_TX_STATS_CMDID); | 96 | WMI_CMD(WMI_TX_STATS_CMDID); |
89 | if (ret) | 97 | if (ret) { |
98 | ath9k_htc_ps_restore(priv); | ||
90 | return -EINVAL; | 99 | return -EINVAL; |
100 | } | ||
101 | |||
102 | ath9k_htc_ps_restore(priv); | ||
91 | 103 | ||
92 | len += snprintf(buf + len, sizeof(buf) - len, | 104 | len += snprintf(buf + len, sizeof(buf) - len, |
93 | "%20s : %10u\n", "Xretries", | 105 | "%20s : %10u\n", "Xretries", |
@@ -149,9 +161,15 @@ static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf, | |||
149 | 161 | ||
150 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); | 162 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); |
151 | 163 | ||
164 | ath9k_htc_ps_wakeup(priv); | ||
165 | |||
152 | WMI_CMD(WMI_RX_STATS_CMDID); | 166 | WMI_CMD(WMI_RX_STATS_CMDID); |
153 | if (ret) | 167 | if (ret) { |
168 | ath9k_htc_ps_restore(priv); | ||
154 | return -EINVAL; | 169 | return -EINVAL; |
170 | } | ||
171 | |||
172 | ath9k_htc_ps_restore(priv); | ||
155 | 173 | ||
156 | len += snprintf(buf + len, sizeof(buf) - len, | 174 | len += snprintf(buf + len, sizeof(buf) - len, |
157 | "%20s : %10u\n", "NoBuf", | 175 | "%20s : %10u\n", "NoBuf", |
@@ -474,6 +492,439 @@ static const struct file_operations fops_debug = { | |||
474 | .llseek = default_llseek, | 492 | .llseek = default_llseek, |
475 | }; | 493 | }; |
476 | 494 | ||
495 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | ||
496 | size_t count, loff_t *ppos) | ||
497 | { | ||
498 | struct ath9k_htc_priv *priv = file->private_data; | ||
499 | struct ath_common *common = ath9k_hw_common(priv->ah); | ||
500 | struct base_eep_header *pBase = NULL; | ||
501 | unsigned int len = 0, size = 1500; | ||
502 | ssize_t retval = 0; | ||
503 | char *buf; | ||
504 | |||
505 | /* | ||
506 | * This can be done since all the 3 EEPROM families have the | ||
507 | * same base header upto a certain point, and we are interested in | ||
508 | * the data only upto that point. | ||
509 | */ | ||
510 | |||
511 | if (AR_SREV_9271(priv->ah)) | ||
512 | pBase = (struct base_eep_header *) | ||
513 | &priv->ah->eeprom.map4k.baseEepHeader; | ||
514 | else if (priv->ah->hw_version.usbdev == AR9280_USB) | ||
515 | pBase = (struct base_eep_header *) | ||
516 | &priv->ah->eeprom.def.baseEepHeader; | ||
517 | else if (priv->ah->hw_version.usbdev == AR9287_USB) | ||
518 | pBase = (struct base_eep_header *) | ||
519 | &priv->ah->eeprom.map9287.baseEepHeader; | ||
520 | |||
521 | if (pBase == NULL) { | ||
522 | ath_err(common, "Unknown EEPROM type\n"); | ||
523 | return 0; | ||
524 | } | ||
525 | |||
526 | buf = kzalloc(size, GFP_KERNEL); | ||
527 | if (buf == NULL) | ||
528 | return -ENOMEM; | ||
529 | |||
530 | len += snprintf(buf + len, size - len, | ||
531 | "%20s : %10d\n", "Major Version", | ||
532 | pBase->version >> 12); | ||
533 | len += snprintf(buf + len, size - len, | ||
534 | "%20s : %10d\n", "Minor Version", | ||
535 | pBase->version & 0xFFF); | ||
536 | len += snprintf(buf + len, size - len, | ||
537 | "%20s : %10d\n", "Checksum", | ||
538 | pBase->checksum); | ||
539 | len += snprintf(buf + len, size - len, | ||
540 | "%20s : %10d\n", "Length", | ||
541 | pBase->length); | ||
542 | len += snprintf(buf + len, size - len, | ||
543 | "%20s : %10d\n", "RegDomain1", | ||
544 | pBase->regDmn[0]); | ||
545 | len += snprintf(buf + len, size - len, | ||
546 | "%20s : %10d\n", "RegDomain2", | ||
547 | pBase->regDmn[1]); | ||
548 | len += snprintf(buf + len, size - len, | ||
549 | "%20s : %10d\n", | ||
550 | "TX Mask", pBase->txMask); | ||
551 | len += snprintf(buf + len, size - len, | ||
552 | "%20s : %10d\n", | ||
553 | "RX Mask", pBase->rxMask); | ||
554 | len += snprintf(buf + len, size - len, | ||
555 | "%20s : %10d\n", | ||
556 | "Allow 5GHz", | ||
557 | !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); | ||
558 | len += snprintf(buf + len, size - len, | ||
559 | "%20s : %10d\n", | ||
560 | "Allow 2GHz", | ||
561 | !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); | ||
562 | len += snprintf(buf + len, size - len, | ||
563 | "%20s : %10d\n", | ||
564 | "Disable 2GHz HT20", | ||
565 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT20)); | ||
566 | len += snprintf(buf + len, size - len, | ||
567 | "%20s : %10d\n", | ||
568 | "Disable 2GHz HT40", | ||
569 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT40)); | ||
570 | len += snprintf(buf + len, size - len, | ||
571 | "%20s : %10d\n", | ||
572 | "Disable 5Ghz HT20", | ||
573 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT20)); | ||
574 | len += snprintf(buf + len, size - len, | ||
575 | "%20s : %10d\n", | ||
576 | "Disable 5Ghz HT40", | ||
577 | !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT40)); | ||
578 | len += snprintf(buf + len, size - len, | ||
579 | "%20s : %10d\n", | ||
580 | "Big Endian", | ||
581 | !!(pBase->eepMisc & 0x01)); | ||
582 | len += snprintf(buf + len, size - len, | ||
583 | "%20s : %10d\n", | ||
584 | "Cal Bin Major Ver", | ||
585 | (pBase->binBuildNumber >> 24) & 0xFF); | ||
586 | len += snprintf(buf + len, size - len, | ||
587 | "%20s : %10d\n", | ||
588 | "Cal Bin Minor Ver", | ||
589 | (pBase->binBuildNumber >> 16) & 0xFF); | ||
590 | len += snprintf(buf + len, size - len, | ||
591 | "%20s : %10d\n", | ||
592 | "Cal Bin Build", | ||
593 | (pBase->binBuildNumber >> 8) & 0xFF); | ||
594 | |||
595 | /* | ||
596 | * UB91 specific data. | ||
597 | */ | ||
598 | if (AR_SREV_9271(priv->ah)) { | ||
599 | struct base_eep_header_4k *pBase4k = | ||
600 | &priv->ah->eeprom.map4k.baseEepHeader; | ||
601 | |||
602 | len += snprintf(buf + len, size - len, | ||
603 | "%20s : %10d\n", | ||
604 | "TX Gain type", | ||
605 | pBase4k->txGainType); | ||
606 | } | ||
607 | |||
608 | /* | ||
609 | * UB95 specific data. | ||
610 | */ | ||
611 | if (priv->ah->hw_version.usbdev == AR9287_USB) { | ||
612 | struct base_eep_ar9287_header *pBase9287 = | ||
613 | &priv->ah->eeprom.map9287.baseEepHeader; | ||
614 | |||
615 | len += snprintf(buf + len, size - len, | ||
616 | "%20s : %10ddB\n", | ||
617 | "Power Table Offset", | ||
618 | pBase9287->pwrTableOffset); | ||
619 | |||
620 | len += snprintf(buf + len, size - len, | ||
621 | "%20s : %10d\n", | ||
622 | "OpenLoop Power Ctrl", | ||
623 | pBase9287->openLoopPwrCntl); | ||
624 | } | ||
625 | |||
626 | len += snprintf(buf + len, size - len, | ||
627 | "%20s : %02X:%02X:%02X:%02X:%02X:%02X\n", | ||
628 | "MacAddress", | ||
629 | pBase->macAddr[0], pBase->macAddr[1], pBase->macAddr[2], | ||
630 | pBase->macAddr[3], pBase->macAddr[4], pBase->macAddr[5]); | ||
631 | if (len > size) | ||
632 | len = size; | ||
633 | |||
634 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
635 | kfree(buf); | ||
636 | |||
637 | return retval; | ||
638 | } | ||
639 | |||
640 | static const struct file_operations fops_base_eeprom = { | ||
641 | .read = read_file_base_eeprom, | ||
642 | .open = ath9k_debugfs_open, | ||
643 | .owner = THIS_MODULE, | ||
644 | .llseek = default_llseek, | ||
645 | }; | ||
646 | |||
647 | static ssize_t read_4k_modal_eeprom(struct file *file, | ||
648 | char __user *user_buf, | ||
649 | size_t count, loff_t *ppos) | ||
650 | { | ||
651 | #define PR_EEP(_s, _val) \ | ||
652 | do { \ | ||
653 | len += snprintf(buf + len, size - len, "%20s : %10d\n", \ | ||
654 | _s, (_val)); \ | ||
655 | } while (0) | ||
656 | |||
657 | struct ath9k_htc_priv *priv = file->private_data; | ||
658 | struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader; | ||
659 | unsigned int len = 0, size = 2048; | ||
660 | ssize_t retval = 0; | ||
661 | char *buf; | ||
662 | |||
663 | buf = kzalloc(size, GFP_KERNEL); | ||
664 | if (buf == NULL) | ||
665 | return -ENOMEM; | ||
666 | |||
667 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
668 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
669 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
670 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
671 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
672 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
673 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
674 | PR_EEP("PGA Desired size", pModal->pgaDesiredSize); | ||
675 | PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); | ||
676 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
677 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
678 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
679 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
680 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
681 | PR_EEP("xpdGain", pModal->xpdGain); | ||
682 | PR_EEP("External PD", pModal->xpd); | ||
683 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
684 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
685 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
686 | PR_EEP("O/D Bias Version", pModal->version); | ||
687 | PR_EEP("CCK OutputBias", pModal->ob_0); | ||
688 | PR_EEP("BPSK OutputBias", pModal->ob_1); | ||
689 | PR_EEP("QPSK OutputBias", pModal->ob_2); | ||
690 | PR_EEP("16QAM OutputBias", pModal->ob_3); | ||
691 | PR_EEP("64QAM OutputBias", pModal->ob_4); | ||
692 | PR_EEP("CCK Driver1_Bias", pModal->db1_0); | ||
693 | PR_EEP("BPSK Driver1_Bias", pModal->db1_1); | ||
694 | PR_EEP("QPSK Driver1_Bias", pModal->db1_2); | ||
695 | PR_EEP("16QAM Driver1_Bias", pModal->db1_3); | ||
696 | PR_EEP("64QAM Driver1_Bias", pModal->db1_4); | ||
697 | PR_EEP("CCK Driver2_Bias", pModal->db2_0); | ||
698 | PR_EEP("BPSK Driver2_Bias", pModal->db2_1); | ||
699 | PR_EEP("QPSK Driver2_Bias", pModal->db2_2); | ||
700 | PR_EEP("16QAM Driver2_Bias", pModal->db2_3); | ||
701 | PR_EEP("64QAM Driver2_Bias", pModal->db2_4); | ||
702 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
703 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
704 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
705 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
706 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
707 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
708 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
709 | PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); | ||
710 | PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); | ||
711 | PR_EEP("Ant. Diversity ctl1", pModal->antdiv_ctl1); | ||
712 | PR_EEP("Ant. Diversity ctl2", pModal->antdiv_ctl2); | ||
713 | PR_EEP("TX Diversity", pModal->tx_diversity); | ||
714 | |||
715 | if (len > size) | ||
716 | len = size; | ||
717 | |||
718 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
719 | kfree(buf); | ||
720 | |||
721 | return retval; | ||
722 | |||
723 | #undef PR_EEP | ||
724 | } | ||
725 | |||
726 | static ssize_t read_def_modal_eeprom(struct file *file, | ||
727 | char __user *user_buf, | ||
728 | size_t count, loff_t *ppos) | ||
729 | { | ||
730 | #define PR_EEP(_s, _val) \ | ||
731 | do { \ | ||
732 | if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \ | ||
733 | pModal = &priv->ah->eeprom.def.modalHeader[1]; \ | ||
734 | len += snprintf(buf + len, size - len, "%20s : %8d%7s", \ | ||
735 | _s, (_val), "|"); \ | ||
736 | } \ | ||
737 | if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \ | ||
738 | pModal = &priv->ah->eeprom.def.modalHeader[0]; \ | ||
739 | len += snprintf(buf + len, size - len, "%9d\n", \ | ||
740 | (_val)); \ | ||
741 | } \ | ||
742 | } while (0) | ||
743 | |||
744 | struct ath9k_htc_priv *priv = file->private_data; | ||
745 | struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader; | ||
746 | struct modal_eep_header *pModal = NULL; | ||
747 | unsigned int len = 0, size = 3500; | ||
748 | ssize_t retval = 0; | ||
749 | char *buf; | ||
750 | |||
751 | buf = kzalloc(size, GFP_KERNEL); | ||
752 | if (buf == NULL) | ||
753 | return -ENOMEM; | ||
754 | |||
755 | len += snprintf(buf + len, size - len, | ||
756 | "%31s %15s\n", "2G", "5G"); | ||
757 | len += snprintf(buf + len, size - len, | ||
758 | "%32s %16s\n", "====", "====\n"); | ||
759 | |||
760 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
761 | PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); | ||
762 | PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]); | ||
763 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
764 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
765 | PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); | ||
766 | PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]); | ||
767 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
768 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
769 | PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); | ||
770 | PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]); | ||
771 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
772 | PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); | ||
773 | PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]); | ||
774 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
775 | PR_EEP("PGA Desired size", pModal->pgaDesiredSize); | ||
776 | PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); | ||
777 | PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]); | ||
778 | PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]); | ||
779 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
780 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
781 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
782 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
783 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
784 | PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); | ||
785 | PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]); | ||
786 | PR_EEP("xpdGain", pModal->xpdGain); | ||
787 | PR_EEP("External PD", pModal->xpd); | ||
788 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
789 | PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); | ||
790 | PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]); | ||
791 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
792 | PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); | ||
793 | PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]); | ||
794 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
795 | PR_EEP("Chain0 OutputBias", pModal->ob); | ||
796 | PR_EEP("Chain0 DriverBias", pModal->db); | ||
797 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
798 | PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain); | ||
799 | PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain); | ||
800 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
801 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
802 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
803 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
804 | PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); | ||
805 | PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]); | ||
806 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
807 | PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); | ||
808 | PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]); | ||
809 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
810 | PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); | ||
811 | PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]); | ||
812 | PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]); | ||
813 | PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); | ||
814 | PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]); | ||
815 | PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]); | ||
816 | PR_EEP("Chain1 OutputBias", pModal->ob_ch1); | ||
817 | PR_EEP("Chain1 DriverBias", pModal->db_ch1); | ||
818 | PR_EEP("LNA Control", pModal->lna_ctl); | ||
819 | PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]); | ||
820 | PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]); | ||
821 | PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]); | ||
822 | |||
823 | if (len > size) | ||
824 | len = size; | ||
825 | |||
826 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
827 | kfree(buf); | ||
828 | |||
829 | return retval; | ||
830 | |||
831 | #undef PR_EEP | ||
832 | } | ||
833 | |||
834 | static ssize_t read_9287_modal_eeprom(struct file *file, | ||
835 | char __user *user_buf, | ||
836 | size_t count, loff_t *ppos) | ||
837 | { | ||
838 | #define PR_EEP(_s, _val) \ | ||
839 | do { \ | ||
840 | len += snprintf(buf + len, size - len, "%20s : %10d\n", \ | ||
841 | _s, (_val)); \ | ||
842 | } while (0) | ||
843 | |||
844 | struct ath9k_htc_priv *priv = file->private_data; | ||
845 | struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader; | ||
846 | unsigned int len = 0, size = 3000; | ||
847 | ssize_t retval = 0; | ||
848 | char *buf; | ||
849 | |||
850 | buf = kzalloc(size, GFP_KERNEL); | ||
851 | if (buf == NULL) | ||
852 | return -ENOMEM; | ||
853 | |||
854 | PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); | ||
855 | PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); | ||
856 | PR_EEP("Ant. Common Control", pModal->antCtrlCommon); | ||
857 | PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); | ||
858 | PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); | ||
859 | PR_EEP("Switch Settle", pModal->switchSettling); | ||
860 | PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); | ||
861 | PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); | ||
862 | PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); | ||
863 | PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); | ||
864 | PR_EEP("ADC Desired size", pModal->adcDesiredSize); | ||
865 | PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); | ||
866 | PR_EEP("txEndToRxOn", pModal->txEndToRxOn); | ||
867 | PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); | ||
868 | PR_EEP("CCA Threshold)", pModal->thresh62); | ||
869 | PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); | ||
870 | PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); | ||
871 | PR_EEP("xpdGain", pModal->xpdGain); | ||
872 | PR_EEP("External PD", pModal->xpd); | ||
873 | PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); | ||
874 | PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); | ||
875 | PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); | ||
876 | PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); | ||
877 | PR_EEP("pdGainOverlap", pModal->pdGainOverlap); | ||
878 | PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); | ||
879 | PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); | ||
880 | PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); | ||
881 | PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); | ||
882 | PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); | ||
883 | PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); | ||
884 | PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); | ||
885 | PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); | ||
886 | PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); | ||
887 | PR_EEP("AR92x7 Version", pModal->version); | ||
888 | PR_EEP("DriverBias1", pModal->db1); | ||
889 | PR_EEP("DriverBias2", pModal->db1); | ||
890 | PR_EEP("CCK OutputBias", pModal->ob_cck); | ||
891 | PR_EEP("PSK OutputBias", pModal->ob_psk); | ||
892 | PR_EEP("QAM OutputBias", pModal->ob_qam); | ||
893 | PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off); | ||
894 | |||
895 | if (len > size) | ||
896 | len = size; | ||
897 | |||
898 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
899 | kfree(buf); | ||
900 | |||
901 | return retval; | ||
902 | |||
903 | #undef PR_EEP | ||
904 | } | ||
905 | |||
906 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | ||
907 | size_t count, loff_t *ppos) | ||
908 | { | ||
909 | struct ath9k_htc_priv *priv = file->private_data; | ||
910 | |||
911 | if (AR_SREV_9271(priv->ah)) | ||
912 | return read_4k_modal_eeprom(file, user_buf, count, ppos); | ||
913 | else if (priv->ah->hw_version.usbdev == AR9280_USB) | ||
914 | return read_def_modal_eeprom(file, user_buf, count, ppos); | ||
915 | else if (priv->ah->hw_version.usbdev == AR9287_USB) | ||
916 | return read_9287_modal_eeprom(file, user_buf, count, ppos); | ||
917 | |||
918 | return 0; | ||
919 | } | ||
920 | |||
921 | static const struct file_operations fops_modal_eeprom = { | ||
922 | .read = read_file_modal_eeprom, | ||
923 | .open = ath9k_debugfs_open, | ||
924 | .owner = THIS_MODULE, | ||
925 | .llseek = default_llseek, | ||
926 | }; | ||
927 | |||
477 | int ath9k_htc_init_debug(struct ath_hw *ah) | 928 | int ath9k_htc_init_debug(struct ath_hw *ah) |
478 | { | 929 | { |
479 | struct ath_common *common = ath9k_hw_common(ah); | 930 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -485,21 +936,25 @@ int ath9k_htc_init_debug(struct ath_hw *ah) | |||
485 | return -ENOMEM; | 936 | return -ENOMEM; |
486 | 937 | ||
487 | debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy, | 938 | debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy, |
488 | priv, &fops_tgt_int_stats); | 939 | priv, &fops_tgt_int_stats); |
489 | debugfs_create_file("tgt_tx_stats", S_IRUSR, priv->debug.debugfs_phy, | 940 | debugfs_create_file("tgt_tx_stats", S_IRUSR, priv->debug.debugfs_phy, |
490 | priv, &fops_tgt_tx_stats); | 941 | priv, &fops_tgt_tx_stats); |
491 | debugfs_create_file("tgt_rx_stats", S_IRUSR, priv->debug.debugfs_phy, | 942 | debugfs_create_file("tgt_rx_stats", S_IRUSR, priv->debug.debugfs_phy, |
492 | priv, &fops_tgt_rx_stats); | 943 | priv, &fops_tgt_rx_stats); |
493 | debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, | 944 | debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, |
494 | priv, &fops_xmit); | 945 | priv, &fops_xmit); |
495 | debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy, | 946 | debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy, |
496 | priv, &fops_recv); | 947 | priv, &fops_recv); |
497 | debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, | 948 | debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, |
498 | priv, &fops_slot); | 949 | priv, &fops_slot); |
499 | debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, | 950 | debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, |
500 | priv, &fops_queue); | 951 | priv, &fops_queue); |
501 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, | 952 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, |
502 | priv, &fops_debug); | 953 | priv, &fops_debug); |
954 | debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, | ||
955 | priv, &fops_base_eeprom); | ||
956 | debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy, | ||
957 | priv, &fops_modal_eeprom); | ||
503 | 958 | ||
504 | return 0; | 959 | return 0; |
505 | } | 960 | } |