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

Commit e6a3b616 authored by Tobias Doerffel's avatar Tobias Doerffel Committed by John W. Linville
Browse files

ath5k: added cfg80211 based rfkill support



This patch introduces initial rfkill support for the ath5k driver
based on rfkill support in the cfg80211 framework.
All rfkill related code is separated into newly created rfkill.c.

Changes to existing code are minimal:

* added a new data structure ath5k_rfkill to the ath5k_softc structure
* inserted calls to HW rfkill init/deinit routines
* ath5k_intr() has been extended to handle AR5K_INT_GPIO interrupts

Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 207ee162
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -39,3 +39,11 @@ config ATH5K_DEBUG

	  modprobe ath5k debug=0x00000400

config ATH5K_RFKILL
	bool "Atheros 5xxx rfkill support"
	depends on ATH5K
	default y
	---help---
	  Include support for enabling/disabling WiFi via rfkill switch
	  with Atheros 5xxx cards
+1 −0
Original line number Diff line number Diff line
@@ -12,4 +12,5 @@ ath5k-y += attach.o
ath5k-y				+= base.o
ath5k-y				+= led.o
ath5k-$(CONFIG_ATH5K_DEBUG)	+= debug.o
ath5k-$(CONFIG_ATH5K_RFKILL)	+= rfkill.o
obj-$(CONFIG_ATH5K)		+= ath5k.o
+9 −0
Original line number Diff line number Diff line
@@ -1256,6 +1256,15 @@ extern u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio);
extern int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val);
extern void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level);

/* rfkill Functions */
#ifdef CONFIG_ATH5K_RFKILL
extern void ath5k_rfkill_hw_start(struct ath5k_hw *ah);
extern void ath5k_rfkill_hw_stop(struct ath5k_hw *ah);
#else
static inline void ath5k_rfkill_hw_start(struct ath5k_hw *ah) {}
static inline void ath5k_rfkill_hw_stop(struct ath5k_hw *ah) {}
#endif

/* Misc functions */
int ath5k_hw_set_capabilities(struct ath5k_hw *ah);
extern int ath5k_hw_get_capability(struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability, u32 *result);
+10 −0
Original line number Diff line number Diff line
@@ -2360,6 +2360,8 @@ ath5k_init(struct ath5k_softc *sc)
	if (ret)
		goto done;

	ath5k_rfkill_hw_start(ah);

	/*
	 * Reset the key cache since some parts do not reset the
	 * contents on initial power up or resume from suspend.
@@ -2468,6 +2470,8 @@ ath5k_stop_hw(struct ath5k_softc *sc)
	tasklet_kill(&sc->restq);
	tasklet_kill(&sc->beacontq);

	ath5k_rfkill_hw_stop(sc->ah);

	return ret;
}

@@ -2526,6 +2530,12 @@ ath5k_intr(int irq, void *dev_id)
				 */
				ath5k_hw_update_mib_counters(ah, &sc->ll_stats);
			}
#ifdef CONFIG_ATH5K_RFKILL
			if (status & AR5K_INT_GPIO)
			{
				tasklet_schedule(&sc->rf_kill.toggleq);
			}
#endif
		}
	} while (ath5k_hw_is_intr_pending(ah) && --counter > 0);

+14 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
#include <linux/wireless.h>
#include <linux/if_ether.h>
#include <linux/leds.h>
#include <linux/rfkill.h>

#include "ath5k.h"
#include "debug.h"
@@ -91,6 +92,15 @@ struct ath5k_led
	struct led_classdev led_dev;		/* led classdev */
};

/* Rfkill */
struct ath5k_rfkill {
	/* GPIO PIN for rfkill */
	u16 gpio;
	/* polarity of rfkill GPIO PIN */
	bool polarity;
	/* RFKILL toggle tasklet */
	struct tasklet_struct toggleq;
};

#if CHAN_DEBUG
#define ATH_CHAN_MAX	(26+26+26+200+200)
@@ -167,6 +177,10 @@ struct ath5k_softc {
	struct tasklet_struct	txtq;		/* tx intr tasklet */
	struct ath5k_led	tx_led;		/* tx led */

#ifdef CONFIG_ATH5K_RFKILL
	struct ath5k_rfkill	rf_kill;
#endif

	spinlock_t		block;		/* protects beacon */
	struct tasklet_struct	beacontq;	/* beacon intr tasklet */
	struct ath5k_buf	*bbuf;		/* beacon buffer */
Loading