NPHY Adjust LNA Gain Table
- Establish a 2-element s16 named gain
- Establish a 2-element u16 named minmax
- Establish a 4-element u16 array named lna_gain and initialize to -2, 10, 19, 25
If phyhang_avoid
N PHY Stay in Carrier Search with argument 1
If nphy_gain_boost
- If current band is 2 GHz
- Set both elements of gain to 6
- Otherwise
Extract the current channel from radio_chanspec
- Set tmp to 40370 - 315 * channel
Set gain[0] to ((tmp >> 13) + ((tmp >> 12) & 1))
- Set tmp to 23242 - 224 * channel
Set gain[1] to ((tmp >> 13) + ((tmp >> 12) & 1))
- If current band is 2 GHz
- Otherwise
- Set both elements of gain to 0
- Loop 2 times with i as index
Write ((i << 10) | 8) to PHY Register 0x72
If nphy_elna_gain_config
Write 19 + gain[i] to PHY Register 0x73
Write 25 + gain[i] to PHY Register 0x73
Write 25 + gain[i] to PHY Register 0x73
Write 25 + gain[i] to PHY Register 0x73
- Otherwise
- Loop 4 times with j as index
Write lna_gain[j] + gain[i] to PHY Register 0x73
- Loop 4 times with j as index
- Set minmax[i] to 23 + gain[i]
MaskSet PHY Register 0x1E with mask 0xFF00 and set with minmax[0]
MaskSet PHY Register 0x34 with mask 0xFF00 and set with minmax[1]
If phyhang_avoid
N PHY Stay in Carrier Search with argument 0