Search Linux Wireless

Re: [PATCH 2/3] d80211: Split antenna selection into TX and RX antenna

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

 



> > > Nope, this is conf->antenna_sel_rx
> > > ;)
> > 
> > On further inspection not even that. :P
> > The outcome of that switch is stored in the antenna variable, which is used with
> > 
> > 	bcm43xx_mgmtframe_txantenna(dev, antenna);
> > 	bcm43xx_set_rx_antenna(dev, antenna);
> > 
> > So I guess that needs to be fixed to create a switch statement for
> > the RX antenna and one for the TX antenna?
> 
> Ah, yeah. I didn't have the complete code for this in my head. :)
> 
> I'd rather like to have a helper function
> int bcm43xx_antenna_from_ieee80211(u8 antenna)
> which includes the switch statement and use it twice in the
> config callback. Wanna do that?

Fixed. This will make the bcm43xx driver make use of both
RX and TX antenna selection capabilities.

Signed-off-by: Ivo van Doorn<IvDoorn@xxxxxxxxx>

---

diff --git a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
index cdce227..1256549 100644
--- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
@@ -2606,22 +2606,12 @@ static int bcm43xx_dev_config(struct ieee80211_hw *hw,
 	struct bcm43xx_phy *phy;
 	unsigned long flags;
 	unsigned int new_phymode = 0xFFFF;
-	int antenna = -1;
+	int antenna_tx;
+	int antenna_rx;
 	int err = 0;
 
-	switch (conf->antenna_sel) {
-	case 0: /* default/diversity */
-		antenna = BCM43xx_ANTENNA_DEFAULT;
-		break;
-	case 1: /* Antenna 0 */
-		antenna = BCM43xx_ANTENNA0;
-		break;
-	case 2: /* Antenna 1 */
-		antenna = BCM43xx_ANTENNA1;
-		break;
-	default:
-		assert(0);
-	}
+	antenna_tx = bcm43xx_antenna_from_ieee80211(conf->antenna_sel_tx);
+	antenna_rx = bcm43xx_antenna_from_ieee80211(conf->antenna_sel_rx);
 
 	mutex_lock(&wl->mutex);
 
@@ -2682,8 +2672,8 @@ static int bcm43xx_dev_config(struct ieee80211_hw *hw,
 	}
 
 	/* Antennas for RX and management frame TX. */
-	bcm43xx_mgmtframe_txantenna(dev, antenna);
-	bcm43xx_set_rx_antenna(dev, antenna);
+	bcm43xx_mgmtframe_txantenna(dev, antenna_tx);
+	bcm43xx_set_rx_antenna(dev, antenna_rx);
 
 	/* Update templates for AP mode. */
 	if (bcm43xx_is_mode(wl, IEEE80211_IF_TYPE_AP))
diff --git a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.h b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.h
index e56efc1..bba6606 100644
--- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.h
+++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.h
@@ -110,6 +110,22 @@ int bcm43xx_is_ofdm_rate(int rate)
 }
 
 static inline
+int bcm43xx_antenna_from_ieee80211(u8 antenna)
+{
+	switch (antenna) {
+	case 0: /* default/diversity */
+		return BCM43xx_ANTENNA_DEFAULT;
+	case 1: /* Antenna 0 */
+		return BCM43xx_ANTENNA0;
+	case 2: /* Antenna 1 */
+		return BCM43xx_ANTENNA1;
+	default:
+		assert(0);
+		return -EINVAL;
+	}
+}
+
+static inline
 int bcm43xx_is_hw_radio_enabled(struct bcm43xx_wldev *dev)
 {
 	/* function to return state of hardware enable of radio
diff --git a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
index 71cba92..cfc84cd 100644
--- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
+++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
@@ -281,7 +281,7 @@ static void generate_txhdr_fw4(struct bcm43xx_wldev *dev,
 		phy_ctl |= BCM43xx_TX4_PHY_OFDM;
 	if (dev->short_preamble)
 		phy_ctl |= BCM43xx_TX4_PHY_SHORTPRMBL;
-	switch (txctl->antenna_sel) {
+	switch (txctl->antenna_sel_tx) {
 	case 0:
 		phy_ctl |= BCM43xx_TX4_PHY_ANTLAST;
 		break;
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux