Search Linux Wireless

[PATCH 2/5] rt2x00: rework channel config function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enable LNAs only for the current operating band. Change power
amplifiers enabling style to the one in vco calibration routine
and drop redundant cap_bt_coexist enable of PA0.

Signed-off-by: Tomislav Požega <pozega.tomislav@xxxxxxxxx>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c |   75 ++++++++++++------------
 1 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 33968ab..5546bd8 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -3723,49 +3723,48 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 	else
 		tx_pin = 0;
 
-	switch (rt2x00dev->default_ant.tx_chain_num) {
-	case 3:
-		/* Turn on tertiary PAs */
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A2_EN,
-				   rf->channel > 14);
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G2_EN,
-				   rf->channel <= 14);
-		/* fall-through */
-	case 2:
-		/* Turn on secondary PAs */
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN,
-				   rf->channel > 14);
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN,
-				   rf->channel <= 14);
-		/* fall-through */
-	case 1:
-		/* Turn on primary PAs */
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN,
-				   rf->channel > 14);
-		if (rt2x00_has_cap_bt_coexist(rt2x00dev))
+	if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
+		switch (rt2x00dev->default_ant.tx_chain_num) {
+		case 3:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A2_EN, 1);
+		case 2:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 1);
+		case 1:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, 1);
+		break;
+		}
+	} else {
+		switch (rt2x00dev->default_ant.tx_chain_num) {
+		case 3:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G2_EN, 1);
+		case 2:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1);
+		case 1:
 			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1);
-		else
-			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN,
-					   rf->channel <= 14);
 		break;
+		}
 	}
 
-	switch (rt2x00dev->default_ant.rx_chain_num) {
-	case 3:
-		/* Turn on tertiary LNAs */
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1);
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1);
-		/* fall-through */
-	case 2:
-		/* Turn on secondary LNAs */
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
-		/* fall-through */
-	case 1:
-		/* Turn on primary LNAs */
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
-		rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
+	if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
+		switch (rt2x00dev->default_ant.rx_chain_num) {
+		case 3:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1);
+		case 2:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
+		case 1:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
+		break;
+		}
+	} else {
+		switch (rt2x00dev->default_ant.rx_chain_num) {
+		case 3:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1);
+		case 2:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
+		case 1:
+			rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
 		break;
+		}
 	}
 
 	rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
-- 
1.7.0.4




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux