Skip to contentSkip to conversation

b43: Support for turning the radio off from software.

PATCH New Michael Buesch 1 participant 1 message Sep 20, 2007 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43: Support for turning the radio off from software.

This adds support for turning the radio off in software. That's useful in environments, where you don't want the RF to radiate any signals, but don't want to bring the interface down.

drivers/net/wireless/b43/b43.h +10 -1
Index: wireless-dev/drivers/net/wireless/b43/b43.h
===================================================================
@@ -459,7 +459,6 @@ struct b43_phy {
 	u16 radio_ver;		/* Radio version */
 	u8 radio_rev;		/* Radio revision */
 
-	bool radio_on;		/* Radio switched on/off */
 	bool locked;		/* Only used in b43_phy_{un}lock() */
 	bool dyn_tssi_tbl;	/* tssi2dbm is kmalloc()ed. */
 
@@ -468,6 +467,16 @@ struct b43_phy {
 	bool aci_wlan_automatic;
 	bool aci_hw_rssi;
 
+	/* Radio switched on/off */
+	bool radio_on;
+	struct {
+		/* Values saved when turning the radio off.
+		 * They are needed when turning it on again. */
+		bool valid;
+		u16 rfover;
+		u16 rfoverval;
+	} radio_off_context;
+
 	u16 minlowsig[2];
 	u16 minlowsigpos[2];
 
drivers/net/wireless/b43/main.c +17 -0
Index: wireless-dev/drivers/net/wireless/b43/main.c
===================================================================
@@ -2874,6 +2874,21 @@ static int b43_dev_config(struct ieee802
 	if (b43_is_mode(wl, IEEE80211_IF_TYPE_AP))
 		b43_set_beacon_int(dev, conf->beacon_int);
 
+	if (!!conf->radio_enabled != phy->radio_on) {
+		if (conf->radio_enabled) {
+			b43_radio_turn_on(dev);
+			b43info(dev->wl, "Radio turned on by software\n");
+			if (!dev->radio_hw_enable) {
+				b43info(dev->wl, "The hardware RF-kill button "
+					"still turns the radio physically off. "
+					"Press the button to turn it on.\n");
+			}
+		} else {
+			b43_radio_turn_off(dev);
+			b43info(dev->wl, "Radio turned off by software\n");
+		}
+	}
+
 	spin_lock_irqsave(&wl->irq_lock, flags);
 	b43_interrupt_enable(dev, savedirqs);
 	mmiowb();
@@ -3217,6 +3232,8 @@ static void setup_struct_phy_for_init(st
 	phy->aci_wlan_automatic = 0;
 	phy->aci_hw_rssi = 0;
 
+	phy->radio_off_context.valid = 0;
+
 	lo = phy->lo_control;
 	if (lo) {
 		memset(lo, 0, sizeof(*(phy->lo_control)));
drivers/net/wireless/b43/phy.c +36 -12

92 lines not on this page · raw message