Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e9f7529 authored by Michael Buesch's avatar Michael Buesch Committed by David S. Miller
Browse files

[B43]: RF-kill support



This adds full support for the RFKILL button and
the RFKILL LED trigger.

Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 21954c36
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -64,7 +64,13 @@ config B43_PCMCIA
# LED support
config B43_LEDS
	bool
	depends on MAC80211_LEDS
	depends on B43 && MAC80211_LEDS
	default y

# RFKILL support
config B43_RFKILL
	bool
	depends on B43 && RFKILL
	default y

config B43_DEBUG
+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@ b43-y += phy.o
b43-y				+= sysfs.o
b43-y				+= xmit.o
b43-y				+= lo.o
# b43 RFKILL button support
b43-$(CONFIG_B43_RFKILL)	+= rfkill.o
# b43 LED support
b43-$(CONFIG_B43_LEDS)		+= leds.o
# b43 PCMCIA support
+5 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@

#include "debugfs.h"
#include "leds.h"
#include "rfkill.h"
#include "lo.h"
#include "phy.h"

@@ -625,6 +626,9 @@ struct b43_wl {
	u8 rng_initialized;
	char rng_name[30 + 1];

	/* The RF-kill button */
	struct b43_rfkill rfkill;

	/* List of all wireless devices on this chip */
	struct list_head devlist;
	u8 nr_devs;
@@ -700,6 +704,7 @@ struct b43_wldev {
	struct b43_led led_tx;
	struct b43_led led_rx;
	struct b43_led led_assoc;
	struct b43_led led_radio;

	/* Reason code of the last interrupt. */
	u32 irq_reason;
+6 −2
Original line number Diff line number Diff line
@@ -154,12 +154,16 @@ static void b43_map_led(struct b43_wldev *dev,
				 ieee80211_get_rx_led_name(hw),
				 led_index, activelow);
		break;
	/*FIXME: We need another trigger for the "radio-on" LEDs below.
	 *       Wiggle that somehow into the rfkill subsystem. */
	case B43_LED_RADIO_ALL:
	case B43_LED_RADIO_A:
	case B43_LED_RADIO_B:
	case B43_LED_MODE_BG:
		snprintf(name, sizeof(name),
			 "b43-%s:radio", wiphy_name(hw->wiphy));
		b43_register_led(dev, &dev->led_radio, name,
				 b43_rfkill_led_name(dev),
				 led_index, activelow);
		break;
	case B43_LED_WEIRD:
	case B43_LED_ASSOC:
		snprintf(name, sizeof(name),
+11 −7
Original line number Diff line number Diff line
@@ -2161,7 +2161,7 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
/* This is the opposite of b43_chip_init() */
static void b43_chip_exit(struct b43_wldev *dev)
{
	b43_radio_turn_off(dev);
	b43_radio_turn_off(dev, 1);
	b43_leds_exit(dev);
	b43_gpio_cleanup(dev);
	/* firmware is released later */
@@ -2269,7 +2269,7 @@ static int b43_chip_init(struct b43_wldev *dev)
	return err;

err_radio_off:
	b43_radio_turn_off(dev);
	b43_radio_turn_off(dev, 1);
err_leds_exit:
	b43_leds_exit(dev);
	b43_gpio_cleanup(dev);
@@ -2358,8 +2358,7 @@ static void b43_periodic_every1sec(struct b43_wldev *dev)
	radio_hw_enable = b43_is_hw_radio_enabled(dev);
	if (unlikely(dev->radio_hw_enable != radio_hw_enable)) {
		dev->radio_hw_enable = radio_hw_enable;
		b43info(dev->wl, "Radio hardware status changed to %s\n",
			radio_hw_enable ? "ENABLED" : "DISABLED");
		b43_rfkill_toggled(dev, radio_hw_enable);
	}
}

@@ -2850,7 +2849,7 @@ static int b43_dev_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
					"Press the button to turn it on.\n");
			}
		} else {
			b43_radio_turn_off(dev);
			b43_radio_turn_off(dev, 0);
			b43info(dev->wl, "Radio turned off by software\n");
		}
	}
@@ -3330,11 +3329,15 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
		return;
	b43_set_status(dev, B43_STAT_UNINIT);

	mutex_unlock(&dev->wl->mutex);
	b43_rfkill_exit(dev);
	mutex_lock(&dev->wl->mutex);

	b43_rng_exit(dev->wl);
	b43_pio_free(dev);
	b43_dma_free(dev);
	b43_chip_exit(dev);
	b43_radio_turn_off(dev);
	b43_radio_turn_off(dev, 1);
	b43_switch_analog(dev, 0);
	if (phy->dyn_tssi_tbl)
		kfree(phy->tssi2dbm);
@@ -3458,6 +3461,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
	memset(wl->mac_addr, 0, ETH_ALEN);
	b43_upload_card_macaddress(dev);
	b43_security_init(dev);
	b43_rfkill_init(dev);
	b43_rng_init(wl);

	b43_set_status(dev, B43_STAT_INITIALIZED);
@@ -3802,7 +3806,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
		wl->current_dev = dev;
	INIT_WORK(&dev->restart_work, b43_chip_reset);

	b43_radio_turn_off(dev);
	b43_radio_turn_off(dev, 1);
	b43_switch_analog(dev, 0);
	ssb_device_disable(dev->dev, 0);
	ssb_bus_may_powerdown(bus);
Loading