## LP PHY Set TX Gain (lpphy_txgains_t *target)

- If the PHY revision is less than 2
- Calculate the rf_gain as the pad_gain (from target) left shifted by 7, bitwise ORed with the pga_gain (from target) left shifted by 3 and bitwise ORed with the gm_gain (from target)
MaskSet PHY Register 0x4B5 with mask 0xF800 and set with the rf_gain calculated above

- Otherwise
Call LP PHY Get PA Gain and save the result as pa_gain

Write the gm_gain (from target) bitwise ORed with the pga_gain (from target) left-shifted by 8 to PHY Register 0x4B5

MaskSet PHY Register 0x4FB with mask 0x8000 and set with the pad_gain (from target) bitwise ORed with pa_gain left shifted by 8

Write the pga_gain (from target) left shifted by 8 and bitwise ORed with the gm_gain (from target) to PHY Register 0x4FC

MaskSet PHY Register 0x4FD with mask 0x8000 and set with the pad_gain (from target) bitwise ORed with pa_gain left shifted by 8

Call LP PHY Set DAC Gain with dac_gain (from target) as the argument

Call LP PHY Set TX Gain Override with argument 1