diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-08-07 00:15:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:13:35 -0400 |
commit | bf466fb67c8e0559ba1875232b03ee8dee32ae09 (patch) | |
tree | f41603b2a78dee89d2d12ba42505f0687d68f86b /drivers/net/wireless/ath | |
parent | 7f63845f2a5f54c64968a4221561c619468b8a54 (diff) |
ath9k: Cleanup TX power calculation for 4K chips
Write CCK power-per-rate array always and report
correct TX power to regulatory.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_4k.c | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c index c9636159b8f4..29878e0789b1 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c | |||
@@ -703,11 +703,11 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, | |||
703 | } | 703 | } |
704 | 704 | ||
705 | static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, | 705 | static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, |
706 | struct ath9k_channel *chan, | 706 | struct ath9k_channel *chan, |
707 | u16 cfgCtl, | 707 | u16 cfgCtl, |
708 | u8 twiceAntennaReduction, | 708 | u8 twiceAntennaReduction, |
709 | u8 twiceMaxRegulatoryPower, | 709 | u8 twiceMaxRegulatoryPower, |
710 | u8 powerLimit) | 710 | u8 powerLimit) |
711 | { | 711 | { |
712 | struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; | 712 | struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; |
713 | struct modal_eep_4k_header *pModal = &pEepData->modalHeader; | 713 | struct modal_eep_4k_header *pModal = &pEepData->modalHeader; |
@@ -724,10 +724,10 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, | |||
724 | } | 724 | } |
725 | 725 | ||
726 | ath9k_hw_set_4k_power_per_rate_table(ah, chan, | 726 | ath9k_hw_set_4k_power_per_rate_table(ah, chan, |
727 | &ratesArray[0], cfgCtl, | 727 | &ratesArray[0], cfgCtl, |
728 | twiceAntennaReduction, | 728 | twiceAntennaReduction, |
729 | twiceMaxRegulatoryPower, | 729 | twiceMaxRegulatoryPower, |
730 | powerLimit); | 730 | powerLimit); |
731 | 731 | ||
732 | ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset); | 732 | ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset); |
733 | 733 | ||
@@ -737,11 +737,23 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, | |||
737 | ratesArray[i] = AR5416_MAX_RATE_POWER; | 737 | ratesArray[i] = AR5416_MAX_RATE_POWER; |
738 | } | 738 | } |
739 | 739 | ||
740 | |||
741 | /* Update regulatory */ | ||
742 | |||
743 | i = rate6mb; | ||
744 | if (IS_CHAN_HT40(chan)) | ||
745 | i = rateHt40_0; | ||
746 | else if (IS_CHAN_HT20(chan)) | ||
747 | i = rateHt20_0; | ||
748 | |||
749 | ah->regulatory.max_power_level = ratesArray[i]; | ||
750 | |||
740 | if (AR_SREV_9280_10_OR_LATER(ah)) { | 751 | if (AR_SREV_9280_10_OR_LATER(ah)) { |
741 | for (i = 0; i < Ar5416RateSize; i++) | 752 | for (i = 0; i < Ar5416RateSize; i++) |
742 | ratesArray[i] -= AR5416_PWR_TABLE_OFFSET * 2; | 753 | ratesArray[i] -= AR5416_PWR_TABLE_OFFSET * 2; |
743 | } | 754 | } |
744 | 755 | ||
756 | /* OFDM power per rate */ | ||
745 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE1, | 757 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE1, |
746 | ATH9K_POW_SM(ratesArray[rate18mb], 24) | 758 | ATH9K_POW_SM(ratesArray[rate18mb], 24) |
747 | | ATH9K_POW_SM(ratesArray[rate12mb], 16) | 759 | | ATH9K_POW_SM(ratesArray[rate12mb], 16) |
@@ -753,19 +765,19 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, | |||
753 | | ATH9K_POW_SM(ratesArray[rate36mb], 8) | 765 | | ATH9K_POW_SM(ratesArray[rate36mb], 8) |
754 | | ATH9K_POW_SM(ratesArray[rate24mb], 0)); | 766 | | ATH9K_POW_SM(ratesArray[rate24mb], 0)); |
755 | 767 | ||
756 | if (IS_CHAN_2GHZ(chan)) { | 768 | /* CCK power per rate */ |
757 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE3, | 769 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE3, |
758 | ATH9K_POW_SM(ratesArray[rate2s], 24) | 770 | ATH9K_POW_SM(ratesArray[rate2s], 24) |
759 | | ATH9K_POW_SM(ratesArray[rate2l], 16) | 771 | | ATH9K_POW_SM(ratesArray[rate2l], 16) |
760 | | ATH9K_POW_SM(ratesArray[rateXr], 8) | 772 | | ATH9K_POW_SM(ratesArray[rateXr], 8) |
761 | | ATH9K_POW_SM(ratesArray[rate1l], 0)); | 773 | | ATH9K_POW_SM(ratesArray[rate1l], 0)); |
762 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE4, | 774 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE4, |
763 | ATH9K_POW_SM(ratesArray[rate11s], 24) | 775 | ATH9K_POW_SM(ratesArray[rate11s], 24) |
764 | | ATH9K_POW_SM(ratesArray[rate11l], 16) | 776 | | ATH9K_POW_SM(ratesArray[rate11l], 16) |
765 | | ATH9K_POW_SM(ratesArray[rate5_5s], 8) | 777 | | ATH9K_POW_SM(ratesArray[rate5_5s], 8) |
766 | | ATH9K_POW_SM(ratesArray[rate5_5l], 0)); | 778 | | ATH9K_POW_SM(ratesArray[rate5_5l], 0)); |
767 | } | 779 | |
768 | 780 | /* HT20 power per rate */ | |
769 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE5, | 781 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE5, |
770 | ATH9K_POW_SM(ratesArray[rateHt20_3], 24) | 782 | ATH9K_POW_SM(ratesArray[rateHt20_3], 24) |
771 | | ATH9K_POW_SM(ratesArray[rateHt20_2], 16) | 783 | | ATH9K_POW_SM(ratesArray[rateHt20_2], 16) |
@@ -777,6 +789,7 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, | |||
777 | | ATH9K_POW_SM(ratesArray[rateHt20_5], 8) | 789 | | ATH9K_POW_SM(ratesArray[rateHt20_5], 8) |
778 | | ATH9K_POW_SM(ratesArray[rateHt20_4], 0)); | 790 | | ATH9K_POW_SM(ratesArray[rateHt20_4], 0)); |
779 | 791 | ||
792 | /* HT40 power per rate */ | ||
780 | if (IS_CHAN_HT40(chan)) { | 793 | if (IS_CHAN_HT40(chan)) { |
781 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE7, | 794 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE7, |
782 | ATH9K_POW_SM(ratesArray[rateHt40_3] + | 795 | ATH9K_POW_SM(ratesArray[rateHt40_3] + |
@@ -796,27 +809,12 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, | |||
796 | ht40PowerIncForPdadc, 8) | 809 | ht40PowerIncForPdadc, 8) |
797 | | ATH9K_POW_SM(ratesArray[rateHt40_4] + | 810 | | ATH9K_POW_SM(ratesArray[rateHt40_4] + |
798 | ht40PowerIncForPdadc, 0)); | 811 | ht40PowerIncForPdadc, 0)); |
799 | |||
800 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE9, | 812 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE9, |
801 | ATH9K_POW_SM(ratesArray[rateExtOfdm], 24) | 813 | ATH9K_POW_SM(ratesArray[rateExtOfdm], 24) |
802 | | ATH9K_POW_SM(ratesArray[rateExtCck], 16) | 814 | | ATH9K_POW_SM(ratesArray[rateExtCck], 16) |
803 | | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8) | 815 | | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8) |
804 | | ATH9K_POW_SM(ratesArray[rateDupCck], 0)); | 816 | | ATH9K_POW_SM(ratesArray[rateDupCck], 0)); |
805 | } | 817 | } |
806 | |||
807 | i = rate6mb; | ||
808 | |||
809 | if (IS_CHAN_HT40(chan)) | ||
810 | i = rateHt40_0; | ||
811 | else if (IS_CHAN_HT20(chan)) | ||
812 | i = rateHt20_0; | ||
813 | |||
814 | if (AR_SREV_9280_10_OR_LATER(ah)) | ||
815 | ah->regulatory.max_power_level = | ||
816 | ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2; | ||
817 | else | ||
818 | ah->regulatory.max_power_level = ratesArray[i]; | ||
819 | |||
820 | } | 818 | } |
821 | 819 | ||
822 | static void ath9k_hw_4k_set_addac(struct ath_hw *ah, | 820 | static void ath9k_hw_4k_set_addac(struct ath_hw *ah, |