nphy_txgains N PHY Get TX Gain
- Struct nphy_txgains {u16 txgm[2]; u16 pga[2]; u16 pad[2]; u16 ipa[2];}
- Establish 2 2-element u16 arrays called curr_gain and index
- Establish an nphy_txgains structure called target
- Set a u32 pointer table to NULL
If nphy_txpwrctrl is zero
If phyhang_avoid is TRUE
Call N PHY Stay In Carrier Search with TRUE as argument
- Read an N PHY Table with ID 7, length 2, offset 0x110, width 16, and curr_gain
If phyhang_avoid is TRUE
Call N PHY Stay In Carrier Search with FALSE as argument
- Loop 2 times with index i
If PHY Revision >= 3
Set target.ipa[i] to curr_gain[i] & 0x000F
Set target.pad[i] to (curr_gain[i] & 0x00F0) >> 4
Set target.pga[i] to (curr_gain[i] & 0x0F00) >> 8
Set target.txgm[i] to (curr_gain[i] & 0x7000) >> 12
- Otherwise
Set target.ipa[i] to curr_gain[i] & 0x0003
Set target.pad[i] to (curr_gain[i] & 0x000C) >> 2
Set target.pga[i] to (curr_gain[i] & 0x0070) >> 4
Set target.txgm[i] to (curr_gain[i] & 0x0380) >> 7
- Otherwise
Set index[0] to (PHY Register 0x1ED >> 8) & 0x7F
Set index[1] to (PHY Register 0x1EE >> 8) & 0x7F
- Loop 2 times with index i
If PHY Revision >= 3
If (nphy_ipa2g_on and band type is 2GHz) or (nphy_ipa5g_on and band type is 5 GHz)
Set the table pointer to the output of N PHY Get IPA GainTbl
- Otherwise
- If the current band is 5G
- If the PHY Revision is 3
Set table to N PHY TX Power Control - TX Gain Table Rev 3 (5 GHz)
- Else if PHY Revision is 4
Set table to N PHY TX Power Control - TX Gain Table Rev 4 (5 GHz)
- Otherwise
Set table to N PHY TX Power Control - TX Gain Table Rev 5 (5 GHz)
- If the PHY Revision is 3
- Otherwise
- If the current band is 5G
Set target.ipa[i] to (table[index[i]] >> 16) & 0xF
Set target.pad[i] to (table[index[i]] >> 20) & 0xF
Set target.pga[i] to (table[index[i]] >> 24) & 0xF
Set target.txgm[i] to (table[index[i]] >> 28) & 0xF
- Otherwise
Set table to N PHY TX Power Control - TX Gain Table Rev <= 2
Set target.ipa[i] to (table[index[i]] >> 16) & 0x3
Set target.pad[i] to (table[index[i]] >> 18) & 0x3
Set target.pga[i] to (table[index[i]] >> 20) & 0x7
Set target.txgm[i] to (table[index[i]] >> 23) & 0x7
- Return target