• Felix Fietkau's avatar
    mt76: rework tx power handling · 80f28994
    Felix Fietkau authored
    There were a number of issues in the existing tx power handling code:
    
    1. The EEPROM target power for chain 0 refers to the actual output power
    after the channel and bandwidth delta have been added to the initial
    channel gain. This means the delta values should not be added/subtracted
    for the rate power calculation
    
    2. When power is reduced significantly, the initial channel gain
    underflows very quickly, while the per-rate power offsets are high.
    This miscalculation causes effective tx power to be increased when it
    should actually be lowered.
    
    Fix this by trying to adjust the channel gain to the lowest power from
    the rate table. In case of under- or overflow, compensate by adding an
    appropriate delta to the rate power values.
    
    This makes power configuration more accurate on a wider range of
    configurable values
    Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
    Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
    80f28994
mt76x2_phy.c 19.8 KB