ath9k: Add RF kill support
PATCH 1/1 ath9k: Add RF kill support
This support is compiled in if CONFIG_RFKILL
option is set.
--- drivers/net/wireless/ath9k/Kconfig | 1 + drivers/net/wireless/ath9k/ath9k.h | 9 +- drivers/net/wireless/ath9k/core.h | 24 + drivers/net/wireless/ath9k/hw.c | 70 ++- drivers/net/wireless/ath9k/hw.h | 2 - drivers/net/wireless/ath9k/main.c | 1205 ++++++++++++++++++++++-------------- 6 files changed, 808 insertions(+), 503 deletions(-)
drivers/net/wireless/ath9k/Kconfig +1 -0
@@ -4,6 +4,7 @@ config ATH9K select MAC80211_LEDS select LEDS_CLASS select NEW_LEDS + select RFKILL ---help--- This module adds support for wireless adapters based on Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
drivers/net/wireless/ath9k/ath9k.h +7 -2
@@ -798,10 +798,13 @@ struct ath_hal {struct ath9k_channel *ah_curchan;u32 ah_nchan; -u16 ah_rfsilent; -bool ah_rfkillEnabled;bool ah_isPciExpress;u16 ah_txTrigLevel; +#ifdef CONFIG_RFKILL +u16 ah_rfsilent; +u32 ah_rfkill_gpio ; +u32 ah_rfkill_polarity; +#endif #ifndef ATH_NF_PER_CHAN struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS ];
@@ -1003,4 +1006,6 @@ bool ath9k_get_channel_edges(struct ath_hal *ah,void ath9k_hw_cfg_output (struct ath_hal *ah,u32 gpio,u32 ah_signal_type);void ath9k_hw_set_gpio (struct ath_hal *ah,u32 gpio,u32 value); +u32 ath9k_hw_gpio_get (struct ath_hal *ah,u32 gpio); +void ath9k_hw_cfg_gpio_input (struct ath_hal *ah,u32 gpio);#endif
drivers/net/wireless/ath9k/core.h +24 -0
@@ -40,6 +40,9 @@#include <asm/page.h> #include <net/mac80211.h> #include <linux/leds.h> +#ifdef CONFIG_RFKILL +#include <linux/rfkill.h> +#endif #include "ath9k.h" #include "rc.h"
@@ -823,6 +826,17 @@ struct ath_led {bool registered; }; +#ifdef CONFIG_RFKILL +/* Rfkill */ +#define ATH_RFKILL_POLL_INTERVAL 2000/* msecs */ + +struct ath_rfkill { +struct rfkill *rfkill; +struct delayed_work rfkill_poll; +char rfkill_name[32 ]; +}; +#endif +/********************/ /* Main driver core */ /********************/
@@ -906,6 +920,11 @@ struct ath_ht_info {#define SC_OP_PROTECT_ENABLE BIT(8)#define SC_OP_RXFLUSH BIT(9)#define SC_OP_LED_ASSOCIATED BIT(10) +#ifdef CONFIG_RFKILL +#define SC_OP_RFKILL_REGISTERED BIT(11) +#define SC_OP_RFKILL_SW_BLOCKED BIT(12) +#define SC_OP_RFKILL_HW_BLOCKED BIT(13) +#endif struct ath_softc {struct ieee80211_hw *hw;
@@ -1015,6 +1034,11 @@ struct ath_softc {struct ath_led assoc_led;struct ath_led tx_led;struct ath_led rx_led; + +#ifdef CONFIG_RFKILL +/* Rfkill */ +struct ath_rfkill rf_kill; +#endif };int ath_init (u16 devid,struct ath_softc *sc);
drivers/net/wireless/ath9k/hw.c +40 -30
101 lines not on this page · raw message
drivers/net/wireless/ath9k/hw.h +0 -2
@@ -757,8 +757,6 @@ struct ath_hal_5416 {u32 ah_ctstimeout;u32 ah_globaltxtimeout;u8 ah_gBeaconRate; -u32 ah_gpioSelect; -u32 ah_polarity;u32 ah_gpioBit;/* ANI */
drivers/net/wireless/ath9k/main.c +736 -469
1,247 lines not on this page · raw message
Signature · 1 line
1.5.5.1
Johannes Berg
maintainerdrivers/net/wireless/ath9k/Kconfig config ATH9K · line 7
Quoted 9 lines · Vasanthakumar Thiagarajan
This support is compiled in if
CONFIG_RFKILL
option is set.+++ b/drivers/net/wireless/ath9k/Kconfig
drivers/net/wireless/ath9k/Kconfig +1
-0@@ -4,6 +4,7 @@ config ATH9K select MAC80211_LEDS select LEDS_CLASS select NEW_LEDS + select RFKILL
You really want to drop that then though.
johannes
Quoted 17 lines · Johannes Berg
drivers/net/wireless/ath9k/Kconfig config ATH9K · line 8
Quoted 12 lines · Vasanthakumar Thiagarajan
This support is compiled in if
CONFIG_RFKILL
option is set.+++ b/drivers/net/wireless/ath9k/Kconfig
drivers/net/wireless/ath9k/Kconfig +1
-0@@ -4,6 +4,7 @@ config ATH9K select MAC80211_LEDS select LEDS_CLASS select NEW_LEDS + select RFKILLYou really want to drop that then though.
Quoted 2 lines
johannes
Yeah, I missed this one. Thanks.
Vasanth
Johannes Berg
maintainerdrivers/net/wireless/ath9k/ath9k.h struct ath_hal { · line 805
Quoted 4 lines
drivers/net/wireless/ath9k/ath9k.h +3
-0+#ifdef CONFIG_RFKILL +u16 ah_rfsilent; +u32 ah_rfkill_gpio ;
small typo, space too much.
Quoted 17 lines
drivers/net/wireless/ath9k/core.h +4
-0@@ -40,6 +40,9 @@#include <asm/page.h> #include <net/mac80211.h> #include <linux/leds.h> +#ifdef CONFIG_RFKILL +#include <linux/rfkill.h> +#endif #include "ath9k.h" #include "rc.h" @@ -823,6 +826,17 @@ struct ath_led {bool registered; }; +#ifdef CONFIG_RFKILL
drivers/net/wireless/ath9k/core.h struct ath_led { · line 839
Quoted 10 lines
drivers/net/wireless/ath9k/core.h +10
-0+/* Rfkill */ +#define ATH_RFKILL_POLL_INTERVAL 2000/* msecs */ + +struct ath_rfkill { +struct rfkill *rfkill; +struct delayed_work rfkill_poll; +char rfkill_name[32 ]; +}; +#endif +
No need to protect any of this with an #ifdef.
drivers/net/wireless/ath9k/core.h struct ath_ht_info { · line 927
Quoted 5 lines
drivers/net/wireless/ath9k/core.h +5
-0+#ifdef CONFIG_RFKILL +#define SC_OP_RFKILL_REGISTERED BIT(11) +#define SC_OP_RFKILL_SW_BLOCKED BIT(12) +#define SC_OP_RFKILL_HW_BLOCKED BIT(13) +#endif
Nor that.
drivers/net/wireless/ath9k/core.h
Quoted 5 lines
drivers/net/wireless/ath9k/core.h +5
-0+static void ath9k_ht_conf (struct ath_softc *sc, +struct ieee80211_bss_conf *bss_conf) +{ +#define IEEE80211_HT_CAP_40MHZ_INTOLERANT BIT(14) +struct ath_ht_info *ht_info = &sc->sc_ht_info;
All that doesn't seem to belong into this patch?
johannes
Quoted 8 lines · Johannes Berg
drivers/net/wireless/ath9k/ath9k.h struct ath_hal { · line 805
Quoted 4 lines
drivers/net/wireless/ath9k/ath9k.h +3
-0+#ifdef CONFIG_RFKILL +u16 ah_rfsilent; +u32 ah_rfkill_gpio ;small typo, space too much.
ok, thanks.
Quoted 32 lines
Quoted 18 lines
drivers/net/wireless/ath9k/core.h +5
-0@@ -40,6 +40,9 @@#include <asm/page.h> #include <net/mac80211.h> #include <linux/leds.h> +#ifdef CONFIG_RFKILL +#include <linux/rfkill.h> +#endif #include "ath9k.h" #include "rc.h" @@ -823,6 +826,17 @@ struct ath_led {bool registered; }; +#ifdef CONFIG_RFKILL +/* Rfkill */ drivers/net/wireless/ath9k/core.h struct ath_led { · line 840
Quoted 10 lines
drivers/net/wireless/ath9k/core.h +9
-0+#define ATH_RFKILL_POLL_INTERVAL 2000/* msecs */ + +struct ath_rfkill { +struct rfkill *rfkill; +struct delayed_work rfkill_poll; +char rfkill_name[32 ]; +}; +#endif +No need to protect any of this with an #ifdef.
Quoted 10 lines
drivers/net/wireless/ath9k/core.h struct ath_ht_info { · line 927
Quoted 6 lines
drivers/net/wireless/ath9k/core.h +5
-0+#ifdef CONFIG_RFKILL +#define SC_OP_RFKILL_REGISTERED BIT(11) +#define SC_OP_RFKILL_SW_BLOCKED BIT(12) +#define SC_OP_RFKILL_HW_BLOCKED BIT(13) +#endif Nor that.
ok.
Quoted 11 lines
drivers/net/wireless/ath9k/core.h
Quoted 6 lines
drivers/net/wireless/ath9k/core.h +5
-0+static void ath9k_ht_conf (struct ath_softc *sc, +struct ieee80211_bss_conf *bss_conf) +{ +#define IEEE80211_HT_CAP_40MHZ_INTOLERANT BIT(14) +struct ath_ht_info *ht_info = &sc->sc_ht_info;All that doesn't seem to belong into this patch?
johannes
I just rearranged (purely change in the location of few static functions in the file) the code to avoid
the prototype declaration of the functions which are called (before their definition) in case of any
failure during rfkill_register().
Thanks for your comments.
Regards
Vasanth
Quoted 5 lines · vasanthakumar thiagarajan
I just rearranged (purely change in the location of few static functions in the file) the code to avoid
the prototype declaration of the functions which are called (before their definition) in case of any
failure duringrfkill_register().
That's much better done in two patches.
The first patch should just move code around without changing *anything*. You can check the resulting binary to be sure you didn't change any code by mistake.
The second patch does the real code changes.
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Quoted 15 lines · Henrique de Moraes Holschuh
Quoted 6 lines · vasanthakumar thiagarajan
I just rearranged (purely change in the location of few static functions in the file) the code to avoid
the prototype declaration of the functions which are called (before their definition) in case of any
failure duringrfkill_register().That's much better done in two patches.
The first patch should just move code around without changing *anything*. You can check the resulting binary to be sure you didn't change any code by mistake.
Quoted 8 lines
The second patch does the real code changes.
--
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Yeah, I got it. Thanks.
Vasanth
This is much better, the rfkill bits seem fine at first glance.
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh