aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
diff options
context:
space:
mode:
authorOleksij Rempel <linux@rempel-privat.de>2014-05-11 04:04:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-05-13 15:56:37 -0400
commit7e9bed7125760748648be539240d1191227b7bb7 (patch)
treeddd1c18e9dedefcbb67bb478a507144f76a8bdad /drivers/net/wireless/ath/ath9k/htc_drv_debug.c
parentf2c3c952a5966e734f600e772ed65b5d34033891 (diff)
ath9k_htc: use ath9k_cmn_debug_modal_eeprom
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/htc_drv_debug.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c286
1 files changed, 2 insertions, 284 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index fb071ee4fcfb..a5732394ddf5 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -621,288 +621,6 @@ static const struct file_operations fops_base_eeprom = {
621 .llseek = default_llseek, 621 .llseek = default_llseek,
622}; 622};
623 623
624static ssize_t read_4k_modal_eeprom(struct file *file,
625 char __user *user_buf,
626 size_t count, loff_t *ppos)
627{
628#define PR_EEP(_s, _val) \
629 do { \
630 len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
631 _s, (_val)); \
632 } while (0)
633
634 struct ath9k_htc_priv *priv = file->private_data;
635 struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader;
636 unsigned int len = 0, size = 2048;
637 ssize_t retval = 0;
638 char *buf;
639
640 buf = kzalloc(size, GFP_KERNEL);
641 if (buf == NULL)
642 return -ENOMEM;
643
644 PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]);
645 PR_EEP("Ant. Common Control", pModal->antCtrlCommon);
646 PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]);
647 PR_EEP("Switch Settle", pModal->switchSettling);
648 PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]);
649 PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]);
650 PR_EEP("ADC Desired size", pModal->adcDesiredSize);
651 PR_EEP("PGA Desired size", pModal->pgaDesiredSize);
652 PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]);
653 PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff);
654 PR_EEP("txEndToRxOn", pModal->txEndToRxOn);
655 PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn);
656 PR_EEP("CCA Threshold)", pModal->thresh62);
657 PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]);
658 PR_EEP("xpdGain", pModal->xpdGain);
659 PR_EEP("External PD", pModal->xpd);
660 PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]);
661 PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]);
662 PR_EEP("pdGainOverlap", pModal->pdGainOverlap);
663 PR_EEP("O/D Bias Version", pModal->version);
664 PR_EEP("CCK OutputBias", pModal->ob_0);
665 PR_EEP("BPSK OutputBias", pModal->ob_1);
666 PR_EEP("QPSK OutputBias", pModal->ob_2);
667 PR_EEP("16QAM OutputBias", pModal->ob_3);
668 PR_EEP("64QAM OutputBias", pModal->ob_4);
669 PR_EEP("CCK Driver1_Bias", pModal->db1_0);
670 PR_EEP("BPSK Driver1_Bias", pModal->db1_1);
671 PR_EEP("QPSK Driver1_Bias", pModal->db1_2);
672 PR_EEP("16QAM Driver1_Bias", pModal->db1_3);
673 PR_EEP("64QAM Driver1_Bias", pModal->db1_4);
674 PR_EEP("CCK Driver2_Bias", pModal->db2_0);
675 PR_EEP("BPSK Driver2_Bias", pModal->db2_1);
676 PR_EEP("QPSK Driver2_Bias", pModal->db2_2);
677 PR_EEP("16QAM Driver2_Bias", pModal->db2_3);
678 PR_EEP("64QAM Driver2_Bias", pModal->db2_4);
679 PR_EEP("xPA Bias Level", pModal->xpaBiasLvl);
680 PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart);
681 PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn);
682 PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc);
683 PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]);
684 PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]);
685 PR_EEP("HT40 Switch Settle", pModal->swSettleHt40);
686 PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]);
687 PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]);
688 PR_EEP("Ant. Diversity ctl1", pModal->antdiv_ctl1);
689 PR_EEP("Ant. Diversity ctl2", pModal->antdiv_ctl2);
690 PR_EEP("TX Diversity", pModal->tx_diversity);
691
692 if (len > size)
693 len = size;
694
695 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
696 kfree(buf);
697
698 return retval;
699
700#undef PR_EEP
701}
702
703static ssize_t read_def_modal_eeprom(struct file *file,
704 char __user *user_buf,
705 size_t count, loff_t *ppos)
706{
707#define PR_EEP(_s, _val) \
708 do { \
709 if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \
710 pModal = &priv->ah->eeprom.def.modalHeader[1]; \
711 len += scnprintf(buf + len, size - len, "%20s : %8d%7s", \
712 _s, (_val), "|"); \
713 } \
714 if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \
715 pModal = &priv->ah->eeprom.def.modalHeader[0]; \
716 len += scnprintf(buf + len, size - len, "%9d\n",\
717 (_val)); \
718 } \
719 } while (0)
720
721 struct ath9k_htc_priv *priv = file->private_data;
722 struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader;
723 struct modal_eep_header *pModal = NULL;
724 unsigned int len = 0, size = 3500;
725 ssize_t retval = 0;
726 char *buf;
727
728 buf = kzalloc(size, GFP_KERNEL);
729 if (buf == NULL)
730 return -ENOMEM;
731
732 len += scnprintf(buf + len, size - len,
733 "%31s %15s\n", "2G", "5G");
734 len += scnprintf(buf + len, size - len,
735 "%32s %16s\n", "====", "====\n");
736
737 PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]);
738 PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]);
739 PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]);
740 PR_EEP("Ant. Common Control", pModal->antCtrlCommon);
741 PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]);
742 PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]);
743 PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]);
744 PR_EEP("Switch Settle", pModal->switchSettling);
745 PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]);
746 PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]);
747 PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]);
748 PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]);
749 PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]);
750 PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]);
751 PR_EEP("ADC Desired size", pModal->adcDesiredSize);
752 PR_EEP("PGA Desired size", pModal->pgaDesiredSize);
753 PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]);
754 PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]);
755 PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]);
756 PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff);
757 PR_EEP("txEndToRxOn", pModal->txEndToRxOn);
758 PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn);
759 PR_EEP("CCA Threshold)", pModal->thresh62);
760 PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]);
761 PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]);
762 PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]);
763 PR_EEP("xpdGain", pModal->xpdGain);
764 PR_EEP("External PD", pModal->xpd);
765 PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]);
766 PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]);
767 PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]);
768 PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]);
769 PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]);
770 PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]);
771 PR_EEP("pdGainOverlap", pModal->pdGainOverlap);
772 PR_EEP("Chain0 OutputBias", pModal->ob);
773 PR_EEP("Chain0 DriverBias", pModal->db);
774 PR_EEP("xPA Bias Level", pModal->xpaBiasLvl);
775 PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain);
776 PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain);
777 PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart);
778 PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn);
779 PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc);
780 PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]);
781 PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]);
782 PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]);
783 PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]);
784 PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]);
785 PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]);
786 PR_EEP("HT40 Switch Settle", pModal->swSettleHt40);
787 PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]);
788 PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]);
789 PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]);
790 PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]);
791 PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]);
792 PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]);
793 PR_EEP("Chain1 OutputBias", pModal->ob_ch1);
794 PR_EEP("Chain1 DriverBias", pModal->db_ch1);
795 PR_EEP("LNA Control", pModal->lna_ctl);
796 PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]);
797 PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]);
798 PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]);
799
800 if (len > size)
801 len = size;
802
803 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
804 kfree(buf);
805
806 return retval;
807
808#undef PR_EEP
809}
810
811static ssize_t read_9287_modal_eeprom(struct file *file,
812 char __user *user_buf,
813 size_t count, loff_t *ppos)
814{
815#define PR_EEP(_s, _val) \
816 do { \
817 len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
818 _s, (_val)); \
819 } while (0)
820
821 struct ath9k_htc_priv *priv = file->private_data;
822 struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader;
823 unsigned int len = 0, size = 3000;
824 ssize_t retval = 0;
825 char *buf;
826
827 buf = kzalloc(size, GFP_KERNEL);
828 if (buf == NULL)
829 return -ENOMEM;
830
831 PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]);
832 PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]);
833 PR_EEP("Ant. Common Control", pModal->antCtrlCommon);
834 PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]);
835 PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]);
836 PR_EEP("Switch Settle", pModal->switchSettling);
837 PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]);
838 PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]);
839 PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]);
840 PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]);
841 PR_EEP("ADC Desired size", pModal->adcDesiredSize);
842 PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff);
843 PR_EEP("txEndToRxOn", pModal->txEndToRxOn);
844 PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn);
845 PR_EEP("CCA Threshold)", pModal->thresh62);
846 PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]);
847 PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]);
848 PR_EEP("xpdGain", pModal->xpdGain);
849 PR_EEP("External PD", pModal->xpd);
850 PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]);
851 PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]);
852 PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]);
853 PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]);
854 PR_EEP("pdGainOverlap", pModal->pdGainOverlap);
855 PR_EEP("xPA Bias Level", pModal->xpaBiasLvl);
856 PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart);
857 PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn);
858 PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc);
859 PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]);
860 PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]);
861 PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]);
862 PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]);
863 PR_EEP("HT40 Switch Settle", pModal->swSettleHt40);
864 PR_EEP("AR92x7 Version", pModal->version);
865 PR_EEP("DriverBias1", pModal->db1);
866 PR_EEP("DriverBias2", pModal->db1);
867 PR_EEP("CCK OutputBias", pModal->ob_cck);
868 PR_EEP("PSK OutputBias", pModal->ob_psk);
869 PR_EEP("QAM OutputBias", pModal->ob_qam);
870 PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off);
871
872 if (len > size)
873 len = size;
874
875 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
876 kfree(buf);
877
878 return retval;
879
880#undef PR_EEP
881}
882
883static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf,
884 size_t count, loff_t *ppos)
885{
886 struct ath9k_htc_priv *priv = file->private_data;
887
888 if (AR_SREV_9271(priv->ah))
889 return read_4k_modal_eeprom(file, user_buf, count, ppos);
890 else if (priv->ah->hw_version.usbdev == AR9280_USB)
891 return read_def_modal_eeprom(file, user_buf, count, ppos);
892 else if (priv->ah->hw_version.usbdev == AR9287_USB)
893 return read_9287_modal_eeprom(file, user_buf, count, ppos);
894
895 return 0;
896}
897
898static const struct file_operations fops_modal_eeprom = {
899 .read = read_file_modal_eeprom,
900 .open = simple_open,
901 .owner = THIS_MODULE,
902 .llseek = default_llseek,
903};
904
905
906/* Ethtool support for get-stats */ 624/* Ethtool support for get-stats */
907#define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" 625#define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
908static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = { 626static const char ath9k_htc_gstrings_stats[][ETH_GSTRING_LEN] = {
@@ -1011,8 +729,8 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
1011 priv, &fops_debug); 729 priv, &fops_debug);
1012 debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, 730 debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy,
1013 priv, &fops_base_eeprom); 731 priv, &fops_base_eeprom);
1014 debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy, 732
1015 priv, &fops_modal_eeprom); 733 ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah);
1016 734
1017 return 0; 735 return 0;
1018} 736}