aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-12-20 04:55:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:58:37 -0500
commit7396faf4f3228b88c6c815c7a93081b456716d5f (patch)
tree86eeb5aa85d0300cbfea04ac6d2e14ce7528c04b /drivers/net/wireless/rt2x00
parenta07dbea210e146aedf8929cdabe082b58696260c (diff)
rt2x00: Add RFKILL support to rt2500usb and rt73usb
Some very rare Ralink USB hardware exists which features the RFKILL switch on the USB stick. This patch adds the EEPROM check function to see if RFKILL is supported and the polling function to rt2500usb and rt73usb in order to support RFKILL for that hardware. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c21
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.h8
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c21
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.h13
4 files changed, 63 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 557fcf2b30e4..01e5584d8f77 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -280,6 +280,18 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
280}; 280};
281#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ 281#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
282 282
283#ifdef CONFIG_RT2X00_LIB_RFKILL
284static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)
285{
286 u16 reg;
287
288 rt2500usb_register_read(rt2x00dev, MAC_CSR19, &reg);
289 return rt2x00_get_field32(reg, MAC_CSR19_BIT7);
290}
291#else
292#define rt2500usb_rfkill_poll NULL
293#endif /* CONFIG_RT2X00_LIB_RFKILL */
294
283#ifdef CONFIG_RT2X00_LIB_LEDS 295#ifdef CONFIG_RT2X00_LIB_LEDS
284static void rt2500usb_brightness_set(struct led_classdev *led_cdev, 296static void rt2500usb_brightness_set(struct led_classdev *led_cdev,
285 enum led_brightness brightness) 297 enum led_brightness brightness)
@@ -1597,6 +1609,14 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1597#endif /* CONFIG_RT2X00_LIB_LEDS */ 1609#endif /* CONFIG_RT2X00_LIB_LEDS */
1598 1610
1599 /* 1611 /*
1612 * Detect if this device has an hardware controlled radio.
1613 */
1614#ifdef CONFIG_RT2X00_LIB_RFKILL
1615 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1616 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
1617#endif /* CONFIG_RT2X00_LIB_RFKILL */
1618
1619 /*
1600 * Check if the BBP tuning should be disabled. 1620 * Check if the BBP tuning should be disabled.
1601 */ 1621 */
1602 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); 1622 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
@@ -1902,6 +1922,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
1902 .uninitialize = rt2x00usb_uninitialize, 1922 .uninitialize = rt2x00usb_uninitialize,
1903 .clear_entry = rt2x00usb_clear_entry, 1923 .clear_entry = rt2x00usb_clear_entry,
1904 .set_device_state = rt2500usb_set_device_state, 1924 .set_device_state = rt2500usb_set_device_state,
1925 .rfkill_poll = rt2500usb_rfkill_poll,
1905 .link_stats = rt2500usb_link_stats, 1926 .link_stats = rt2500usb_link_stats,
1906 .reset_tuner = rt2500usb_reset_tuner, 1927 .reset_tuner = rt2500usb_reset_tuner,
1907 .link_tuner = rt2500usb_link_tuner, 1928 .link_tuner = rt2500usb_link_tuner,
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.h b/drivers/net/wireless/rt2x00/rt2500usb.h
index 4347dfdabcd4..e1f714e82af0 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.h
+++ b/drivers/net/wireless/rt2x00/rt2500usb.h
@@ -189,6 +189,14 @@
189 * MAC_CSR19: GPIO control register. 189 * MAC_CSR19: GPIO control register.
190 */ 190 */
191#define MAC_CSR19 0x0426 191#define MAC_CSR19 0x0426
192#define MAC_CSR19_BIT0 FIELD32(0x0001)
193#define MAC_CSR19_BIT1 FIELD32(0x0002)
194#define MAC_CSR19_BIT2 FIELD32(0x0004)
195#define MAC_CSR19_BIT3 FIELD32(0x0008)
196#define MAC_CSR19_BIT4 FIELD32(0x0010)
197#define MAC_CSR19_BIT5 FIELD32(0x0020)
198#define MAC_CSR19_BIT6 FIELD32(0x0040)
199#define MAC_CSR19_BIT7 FIELD32(0x0080)
192 200
193/* 201/*
194 * MAC_CSR20: LED control register. 202 * MAC_CSR20: LED control register.
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index e99bcacfc191..c2658108d9c3 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -186,6 +186,18 @@ static const struct rt2x00debug rt73usb_rt2x00debug = {
186}; 186};
187#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ 187#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
188 188
189#ifdef CONFIG_RT2X00_LIB_RFKILL
190static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)
191{
192 u32 reg;
193
194 rt2x00usb_register_read(rt2x00dev, MAC_CSR13, &reg);
195 return rt2x00_get_field32(reg, MAC_CSR13_BIT7);
196}
197#else
198#define rt73usb_rfkill_poll NULL
199#endif /* CONFIG_RT2X00_LIB_RFKILL */
200
189#ifdef CONFIG_RT2X00_LIB_LEDS 201#ifdef CONFIG_RT2X00_LIB_LEDS
190static void rt73usb_brightness_set(struct led_classdev *led_cdev, 202static void rt73usb_brightness_set(struct led_classdev *led_cdev,
191 enum led_brightness brightness) 203 enum led_brightness brightness)
@@ -1853,6 +1865,14 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1853 __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags); 1865 __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags);
1854 1866
1855 /* 1867 /*
1868 * Detect if this device has an hardware controlled radio.
1869 */
1870#ifdef CONFIG_RT2X00_LIB_RFKILL
1871 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1872 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
1873#endif /* CONFIG_RT2X00_LIB_RFKILL */
1874
1875 /*
1856 * Read frequency offset. 1876 * Read frequency offset.
1857 */ 1877 */
1858 rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); 1878 rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
@@ -2257,6 +2277,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
2257 .uninitialize = rt2x00usb_uninitialize, 2277 .uninitialize = rt2x00usb_uninitialize,
2258 .clear_entry = rt2x00usb_clear_entry, 2278 .clear_entry = rt2x00usb_clear_entry,
2259 .set_device_state = rt73usb_set_device_state, 2279 .set_device_state = rt73usb_set_device_state,
2280 .rfkill_poll = rt73usb_rfkill_poll,
2260 .link_stats = rt73usb_link_stats, 2281 .link_stats = rt73usb_link_stats,
2261 .reset_tuner = rt73usb_reset_tuner, 2282 .reset_tuner = rt73usb_reset_tuner,
2262 .link_tuner = rt73usb_link_tuner, 2283 .link_tuner = rt73usb_link_tuner,
diff --git a/drivers/net/wireless/rt2x00/rt73usb.h b/drivers/net/wireless/rt2x00/rt73usb.h
index 46e1405eb0e2..204bbd5b7c59 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.h
+++ b/drivers/net/wireless/rt2x00/rt73usb.h
@@ -267,6 +267,19 @@ struct hw_pairwise_ta_entry {
267 * MAC_CSR13: GPIO. 267 * MAC_CSR13: GPIO.
268 */ 268 */
269#define MAC_CSR13 0x3034 269#define MAC_CSR13 0x3034
270#define MAC_CSR13_BIT0 FIELD32(0x00000001)
271#define MAC_CSR13_BIT1 FIELD32(0x00000002)
272#define MAC_CSR13_BIT2 FIELD32(0x00000004)
273#define MAC_CSR13_BIT3 FIELD32(0x00000008)
274#define MAC_CSR13_BIT4 FIELD32(0x00000010)
275#define MAC_CSR13_BIT5 FIELD32(0x00000020)
276#define MAC_CSR13_BIT6 FIELD32(0x00000040)
277#define MAC_CSR13_BIT7 FIELD32(0x00000080)
278#define MAC_CSR13_BIT8 FIELD32(0x00000100)
279#define MAC_CSR13_BIT9 FIELD32(0x00000200)
280#define MAC_CSR13_BIT10 FIELD32(0x00000400)
281#define MAC_CSR13_BIT11 FIELD32(0x00000800)
282#define MAC_CSR13_BIT12 FIELD32(0x00001000)
270 283
271/* 284/*
272 * MAC_CSR14: LED control register. 285 * MAC_CSR14: LED control register.