diff options
author | Sujith Manoharan <Sujith.Manoharan@atheros.com> | 2011-04-28 04:58:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-29 15:36:13 -0400 |
commit | 44368796b87d321e6ea84295a23b2e8eb415d300 (patch) | |
tree | 0906720c6b9e1f0dd79f34ec9e763eb0f35be86f | |
parent | 80d887c3b4566f4d14cd7cd5374eba30131d020f (diff) |
ath9k_htc: Dump modal eeprom header for UB91/94/95
Debugfs file location: <debugfs_mnt>/ieee80211/phy#/ath9k_htc/modal_eeprom
Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 283 |
1 files changed, 283 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c index cff2d217725f..aa48b3abbc48 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c | |||
@@ -644,6 +644,287 @@ static const struct file_operations fops_base_eeprom = { | |||
644 | .llseek = default_llseek, | 644 | .llseek = default_llseek, |
645 | }; | 645 | }; |
646 | 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 | |||
647 | int ath9k_htc_init_debug(struct ath_hw *ah) | 928 | int ath9k_htc_init_debug(struct ath_hw *ah) |
648 | { | 929 | { |
649 | struct ath_common *common = ath9k_hw_common(ah); | 930 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -672,6 +953,8 @@ int ath9k_htc_init_debug(struct ath_hw *ah) | |||
672 | priv, &fops_debug); | 953 | priv, &fops_debug); |
673 | debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, | 954 | debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, |
674 | priv, &fops_base_eeprom); | 955 | priv, &fops_base_eeprom); |
956 | debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy, | ||
957 | priv, &fops_modal_eeprom); | ||
675 | 958 | ||
676 | return 0; | 959 | return 0; |
677 | } | 960 | } |