]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/wireless/ath/ath9k/eeprom_4k.c
ath9k_hw: clean up tx power handling
[mv-sheeva.git] / drivers / net / wireless / ath / ath9k / eeprom_4k.c
index 303560e49ac88f399f4a25f197bc7609d9e7065e..ab6811dc5debbea9dfa561935e9f5a2dede38a57 100644 (file)
@@ -350,6 +350,8 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah,
                return pModal->antdiv_ctl1;
        case EEP_TXGAIN_TYPE:
                return pBase->txGainType;
+       case EEP_ANTENNA_GAIN_2G:
+               return pModal->antennaGainCh[0];
        default:
                return 0;
        }
@@ -462,8 +464,7 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah,
                                                 struct ath9k_channel *chan,
                                                 int16_t *ratesArray,
                                                 u16 cfgCtl,
-                                                u16 AntennaReduction,
-                                                u16 twiceMaxRegulatoryPower,
+                                                u16 antenna_reduction,
                                                 u16 powerLimit)
 {
 #define CMP_TEST_GRP \
@@ -472,20 +473,16 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah,
        || (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \
            ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))
 
-       struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
        int i;
-       int16_t twiceLargestAntenna;
        u16 twiceMinEdgePower;
        u16 twiceMaxEdgePower = MAX_RATE_POWER;
-       u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
+       u16 scaledPower = 0, minCtlPower;
        u16 numCtlModes;
        const u16 *pCtlMode;
        u16 ctlMode, freq;
        struct chan_centers centers;
        struct cal_ctl_data_4k *rep;
        struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
-       static const u16 tpScaleReductionTable[5] =
-               { 0, 3, 6, 9, MAX_RATE_POWER };
        struct cal_target_power_leg targetPowerOfdm, targetPowerCck = {
                0, { 0, 0, 0, 0}
        };
@@ -503,19 +500,7 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah,
 
        ath9k_hw_get_channel_centers(ah, chan, &centers);
 
-       twiceLargestAntenna = pEepData->modalHeader.antennaGainCh[0];
-       twiceLargestAntenna = (int16_t)min(AntennaReduction -
-                                          twiceLargestAntenna, 0);
-
-       maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna;
-       if (regulatory->tp_scale != ATH9K_TP_SCALE_MAX) {
-               maxRegAllowedPower -=
-                       (tpScaleReductionTable[(regulatory->tp_scale)] * 2);
-       }
-
-       scaledPower = min(powerLimit, maxRegAllowedPower);
-       scaledPower = max((u16)0, scaledPower);
-
+       scaledPower = powerLimit - antenna_reduction;
        numCtlModes = ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40;
        pCtlMode = ctlModesFor11g;
 
@@ -671,7 +656,6 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah,
                                    struct ath9k_channel *chan,
                                    u16 cfgCtl,
                                    u8 twiceAntennaReduction,
-                                   u8 twiceMaxRegulatoryPower,
                                    u8 powerLimit, bool test)
 {
        struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
@@ -691,7 +675,6 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah,
        ath9k_hw_set_4k_power_per_rate_table(ah, chan,
                                             &ratesArray[0], cfgCtl,
                                             twiceAntennaReduction,
-                                            twiceMaxRegulatoryPower,
                                             powerLimit);
 
        ath9k_hw_set_4k_power_cal_table(ah, chan);