Porting to cfg80211 rfkill
cover Porting to cfg80211 rfkill
This series mainly has Johannes' rfkill porting and other two patches to allow wiphy_rfkill_polling to be done at attach time instead of at the time when the interface is brought up which used to be done before. With this series a kernel panic, which is a regression, during module unload disappears.
Johannes Berg (1):
ath9k: port to cfg80211 rfkill
Vasanthakumar Thiagarajan (2):
ath9k: Add helper to get ath9k specific current channel
ath9k: Make sure we have current channel in ah_curchan before rf
disable/enable
drivers/net/wireless/ath/ath9k/Kconfig | 1 - drivers/net/wireless/ath/ath9k/ath9k.h | 9 --- drivers/net/wireless/ath/ath9k/hw.c | 29 ++++---- drivers/net/wireless/ath/ath9k/hw.h | 3 - drivers/net/wireless/ath/ath9k/main.c | 120 +++++++++---------------------- 5 files changed, 48 insertions(+), 114 deletions(-)
PATCH 1/3 ath9k: Add helper to get ath9k specific current channel
--- drivers/net/wireless/ath/ath9k/main.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +16 -5
@@ -231,6 +231,19 @@ static void ath_setup_rates(struct ath_softc *sc, enum ieee80211_band band) } } +static struct ath9k_channel *ath_get_curchannel (struct ath_softc *sc, +struct ieee80211_hw *hw) +{ +struct ieee80211_channel *curchan = hw->conf.channel; +struct ath9k_channel *channel; +u8 chan_idx; + + chan_idx = curchan->hw_value; + channel = &sc->sc_ah->channels[chan_idx]; +ath9k_update_ichannel (sc, hw, channel); +return channel; +} +/* * Set/change channels. If the channel is really being changed, it's done * by reseting the chip. To accomplish this we must first cleanup any pending
@@ -1925,7 +1938,7 @@ static int ath9k_start(struct ieee80211_hw *hw)struct ath_softc *sc = aphy->sc;struct ieee80211_channel *curchan = hw->conf.channel;struct ath9k_channel *init_channel; -int r, pos; +int r;DPRINTF (sc,ATH_DBG_CONFIG ,"Starting driver with " "initial channel: %d MHz\n" , curchan->center_freq);
@@ -1955,11 +1968,9 @@ static int ath9k_start(struct ieee80211_hw *hw)/* setup initial channel */ - pos = curchan->hw_value; + sc->chan_idx = curchan->hw_value; - sc->chan_idx = pos; - init_channel = &sc->sc_ah->channels[pos]; -ath9k_update_ichannel (sc, hw, init_channel); + init_channel =ath_get_curchannel (sc, hw);/* Reset SERDES registers */ ath9k_hw_configpcipowersave (sc->sc_ah,0 );
Signature · 1 line
1.5.5.1
PATCH 2/3 ath9k: Make sure we have current channel in ah_curchan before rf disable/enable
--- drivers/net/wireless/ath/ath9k/main.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +6 -0
@@ -1125,6 +1125,9 @@ void ath_radio_enable(struct ath_softc *sc)ath9k_ps_wakeup (sc);ath9k_hw_configpcipowersave (ah,0 ); +if (!ah->curchan) + ah->curchan =ath_get_curchannel (sc, sc->hw); +spin_lock_bh (&sc->sc_resetlock); r =ath9k_hw_reset (ah, ah->curchan, false);if (r) {
@@ -1177,6 +1180,9 @@ void ath_radio_disable(struct ath_softc *sc)ath_stoprecv (sc);/* turn off frame recv */ ath_flushrecv (sc);/* flush recv queue */ +if (!ah->curchan) + ah->curchan =ath_get_curchannel (sc, sc->hw); +spin_lock_bh (&sc->sc_resetlock); r =ath9k_hw_reset (ah, ah->curchan, false);if (r) {
Signature · 1 line
1.5.5.1
PATCH 3/3 ath9k: port to cfg80211 rfkill
From: Johannes Berg <[email protected]>
This ports the ath9k rfkill code to the new API offered by cfg80211 and thus removes a lot of useless stuff.
--- drivers/net/wireless/ath/ath9k/Kconfig | 1 - drivers/net/wireless/ath/ath9k/ath9k.h | 9 --- drivers/net/wireless/ath/ath9k/hw.c | 29 +++++------ drivers/net/wireless/ath/ath9k/hw.h | 3 - drivers/net/wireless/ath/ath9k/main.c | 93 +++++--------------------------- 5 files changed, 26 insertions(+), 109 deletions(-)
drivers/net/wireless/ath/ath9k/Kconfig +0 -1
@@ -1,7 +1,6 @@ config ATH9K tristate "Atheros 802.11n wireless cards support" depends on PCI && MAC80211 && WLAN_80211 - depends on RFKILL || RFKILL=n select ATH_COMMON select MAC80211_LEDS select LEDS_CLASS
drivers/net/wireless/ath/ath9k/ath9k.h +0 -9
@@ -21,7 +21,6 @@#include <linux/device.h> #include <net/mac80211.h> #include <linux/leds.h> -#include <linux/rfkill.h> #include "hw.h" #include "rc.h"
@@ -480,12 +479,6 @@ struct ath_led {bool registered; }; -struct ath_rfkill { -struct rfkill *rfkill; -struct rfkill_ops ops; -char rfkill_name[32 ]; -}; -/********************/ /* Main driver core */ /********************/
@@ -525,7 +518,6 @@ struct ath_rfkill {#define SC_OP_PROTECT_ENABLE BIT(6)#define SC_OP_RXFLUSH BIT(7)#define SC_OP_LED_ASSOCIATED BIT(8) -#define SC_OP_RFKILL_REGISTERED BIT(9)#define SC_OP_WAIT_FOR_BEACON BIT(12)#define SC_OP_LED_ON BIT(13)#define SC_OP_SCANNING BIT(14)
@@ -612,7 +604,6 @@ struct ath_softc {int beacon_interval; -struct ath_rfkill rf_kill;struct ath_ani ani;struct ath9k_node_stats nodestats;#ifdef CONFIG_ATH9K_DEBUG
drivers/net/wireless/ath/ath9k/hw.c +13 -16
@@ -2186,6 +2186,18 @@ static void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chanREG_WRITE (ah,AR_PHY_MASK2_P_61_45 , tmp_mask); } +static void ath9k_enable_rfkill (struct ath_hw *ah) +{ +REG_SET_BIT (ah,AR_GPIO_INPUT_EN_VAL , +AR_GPIO_INPUT_EN_VAL_RFSILENT_BB ); + +REG_CLR_BIT (ah,AR_GPIO_INPUT_MUX2 , +AR_GPIO_INPUT_MUX2_RFSILENT ); + +ath9k_hw_cfg_gpio_input (ah, ah->rfkill_gpio); +REG_SET_BIT (ah,AR_PHY_TEST ,RFSILENT_BB ); +} +int ath9k_hw_reset (struct ath_hw *ah,struct ath9k_channel *chan,bool bChannelChange) {
@@ -2313,10 +2325,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,ath9k_hw_init_interrupt_masks (ah, ah->opmode);ath9k_hw_init_qos (ah); -#if defined(CONFIG_RFKILL ) || defined(CONFIG_RFKILL_MODULE )if (ah->caps.hw_caps &ATH9K_HW_CAP_RFSILENT )ath9k_enable_rfkill (ah); -#endif +ath9k_hw_init_user_settings (ah); REG_WRITE(ah, AR_STA_ID1,
@@ -3612,20 +3623,6 @@ void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val) AR_GPIO_BIT(gpio)); } -#if defined(CONFIG_RFKILL ) || defined(CONFIG_RFKILL_MODULE ) -void ath9k_enable_rfkill (struct ath_hw *ah) -{ -REG_SET_BIT (ah,AR_GPIO_INPUT_EN_VAL , -AR_GPIO_INPUT_EN_VAL_RFSILENT_BB ); - -REG_CLR_BIT (ah,AR_GPIO_INPUT_MUX2 , -AR_GPIO_INPUT_MUX2_RFSILENT ); - -ath9k_hw_cfg_gpio_input (ah, ah->rfkill_gpio); -REG_SET_BIT (ah,AR_PHY_TEST ,RFSILENT_BB ); -} -#endif -u32 ath9k_hw_getdefantenna (struct ath_hw *ah) {return REG_READ (ah,AR_DEF_ANTENNA ) &0x7 ;
drivers/net/wireless/ath/ath9k/hw.h +0 -3
@@ -564,9 +564,6 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);void ath9k_hw_cfg_output (struct ath_hw *ah,u32 gpio,u32 ah_signal_type);void ath9k_hw_set_gpio (struct ath_hw *ah,u32 gpio,u32 val); -#if defined(CONFIG_RFKILL ) || defined(CONFIG_RFKILL_MODULE ) -void ath9k_enable_rfkill (struct ath_hw *ah); -#endif u32 ath9k_hw_getdefantenna (struct ath_hw *ah);void ath9k_hw_setantenna (struct ath_hw *ah,u32 antenna); bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
drivers/net/wireless/ath/ath9k/main.c +13 -80
152 lines not on this page · raw message
Signature · 1 line
1.5.5.1