On Wednesday, September 14, 2011 15:16:31 Daniel Golle wrote:
> +--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
> ++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
> +@@ -564,7 +564,7 @@ static inline void ar9285_hw_pa_cal(stru
> +
> +     /* PA CAL is not needed for high power solution */
> +     if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) ==
> +-        AR5416_EEP_TXGAIN_HIGH_POWER)
> ++        AR5416_EEP_TXGAIN_HIGH_POWER && ! ah->has_external_pa)
> +             return;

This is not necessary as I found out in my tests.


> +     } else if (AR_SREV_9285_12_OR_LATER(ah)) {
> +-            u32 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
> ++            u32 txgain_type;
> ++            if (ah->has_external_pa) {
> ++                    txgain_type = AR5416_EEP_TXGAIN_HIGH_POWER;
> ++            } else {
> ++                    txgain_type = ah->eep_ops->get_eeprom(ah, 
> EEP_TXGAIN_TYPE);
> ++            }

This is actually a bug in the ath9k eeprom handling. I submitted a proper fix 
a while ago: 
http://www.mailrepository.com/ath9k-devel.lists.ath9k.org/msg/4034958/



> +-    scaledPower = min(powerLimit, maxRegAllowedPower);
> +-    scaledPower = max((u16)0, scaledPower);
> ++    if ( ah->has_external_pa ) {
> ++            scaledPower = max((u16)0, powerLimit);
> ++    } else {
> ++            scaledPower = min(powerLimit, maxRegAllowedPower);
> ++            scaledPower = max((u16)0, scaledPower);
> ++    }
> +
> +     numCtlModes = ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40;
> +     pCtlMode = ctlModesFor11g;
> +@@ -594,7 +598,11 @@ static void ath9k_hw_set_4k_power_per_ra
> +                     }
> +             }
> +
> +-            minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
> ++            if ( ah->has_external_pa ) {
> ++                    minCtlPower = scaledPower;
> ++            } else {
> ++                    minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
> ++            }

That one still is on my todo list. Actually, I have no idea what 
twiceMaxEdgePower actually is good for. Felix, can you shed some light on the 
matter ? The interesting thing is that the driver reads this value from the 
eeprom too. Therefore it would be interesting to know, why this 
twiceMaxEdgePower / twiceMinEdgePower check exists and whether it is correct.

Cheers,
Marek
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to