aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-03-31 09:53:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:14:09 -0400
commita2e1d52a32eab53f8ab03c4023310f65aaa054a7 (patch)
tree93f5f5692f220afbedc4512bdd372084097e5e54 /drivers/net/wireless/rt2x00/rt61pci.c
parente0b005fa1479045fe879944036268af3ebcd1835 (diff)
rt2x00: Remove MAC80211_LEDS dependency
Implement triggers inside rt2x00 itself based on input from mac80211. This replaces the method of using the mac80211 trigger events which do not work for USB drivers due to the scheduling requirement. After this patch RT2500USB_LEDS and RT73USB_LEDS no longer need to be tagged as broken since they now support LED handling again without having to check for in_atomic(). 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/rt61pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c64
1 files changed, 41 insertions, 23 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index c5c625143335..1cb056be4489 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -277,7 +277,7 @@ static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
277#endif /* CONFIG_RT61PCI_RFKILL */ 277#endif /* CONFIG_RT61PCI_RFKILL */
278 278
279#ifdef CONFIG_RT61PCI_LEDS 279#ifdef CONFIG_RT61PCI_LEDS
280static void rt61pci_led_brightness(struct led_classdev *led_cdev, 280static void rt61pci_brightness_set(struct led_classdev *led_cdev,
281 enum led_brightness brightness) 281 enum led_brightness brightness)
282{ 282{
283 struct rt2x00_led *led = 283 struct rt2x00_led *led =
@@ -314,8 +314,22 @@ static void rt61pci_led_brightness(struct led_classdev *led_cdev,
314 brightness / (LED_FULL / 6), 0); 314 brightness / (LED_FULL / 6), 0);
315 } 315 }
316} 316}
317#else 317
318#define rt61pci_led_brightness NULL 318static int rt61pci_blink_set(struct led_classdev *led_cdev,
319 unsigned long *delay_on,
320 unsigned long *delay_off)
321{
322 struct rt2x00_led *led =
323 container_of(led_cdev, struct rt2x00_led, led_dev);
324 u32 reg;
325
326 rt2x00pci_register_read(led->rt2x00dev, MAC_CSR14, &reg);
327 rt2x00_set_field32(&reg, MAC_CSR14_ON_PERIOD, *delay_on);
328 rt2x00_set_field32(&reg, MAC_CSR14_OFF_PERIOD, *delay_off);
329 rt2x00pci_register_write(led->rt2x00dev, MAC_CSR14, reg);
330
331 return 0;
332}
319#endif /* CONFIG_RT61PCI_LEDS */ 333#endif /* CONFIG_RT61PCI_LEDS */
320 334
321/* 335/*
@@ -1202,11 +1216,6 @@ static int rt61pci_init_registers(struct rt2x00_dev *rt2x00dev)
1202 1216
1203 rt2x00pci_register_write(rt2x00dev, MAC_CSR13, 0x0000e000); 1217 rt2x00pci_register_write(rt2x00dev, MAC_CSR13, 0x0000e000);
1204 1218
1205 rt2x00pci_register_read(rt2x00dev, MAC_CSR14, &reg);
1206 rt2x00_set_field32(&reg, MAC_CSR14_ON_PERIOD, 70);
1207 rt2x00_set_field32(&reg, MAC_CSR14_OFF_PERIOD, 30);
1208 rt2x00pci_register_write(rt2x00dev, MAC_CSR14, reg);
1209
1210 /* 1219 /*
1211 * Invalidate all Shared Keys (SEC_CSR0), 1220 * Invalidate all Shared Keys (SEC_CSR0),
1212 * and clear the Shared key Cipher algorithms (SEC_CSR1 & SEC_CSR5) 1221 * and clear the Shared key Cipher algorithms (SEC_CSR1 & SEC_CSR5)
@@ -2058,22 +2067,32 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2058 */ 2067 */
2059#ifdef CONFIG_RT61PCI_LEDS 2068#ifdef CONFIG_RT61PCI_LEDS
2060 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom); 2069 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom);
2061
2062 value = rt2x00_get_field16(eeprom, EEPROM_LED_LED_MODE); 2070 value = rt2x00_get_field16(eeprom, EEPROM_LED_LED_MODE);
2063 2071
2064 switch (value) { 2072 rt2x00dev->led_radio.rt2x00dev = rt2x00dev;
2065 case LED_MODE_TXRX_ACTIVITY: 2073 rt2x00dev->led_radio.type = LED_TYPE_RADIO;
2066 case LED_MODE_ASUS: 2074 rt2x00dev->led_radio.led_dev.brightness_set =
2067 case LED_MODE_ALPHA: 2075 rt61pci_brightness_set;
2068 case LED_MODE_DEFAULT: 2076 rt2x00dev->led_radio.led_dev.blink_set =
2069 rt2x00dev->led_flags = 2077 rt61pci_blink_set;
2070 LED_SUPPORT_RADIO | LED_SUPPORT_ASSOC; 2078 rt2x00dev->led_radio.flags = LED_INITIALIZED;
2071 break; 2079
2072 case LED_MODE_SIGNAL_STRENGTH: 2080 rt2x00dev->led_assoc.rt2x00dev = rt2x00dev;
2073 rt2x00dev->led_flags = 2081 rt2x00dev->led_assoc.type = LED_TYPE_ASSOC;
2074 LED_SUPPORT_RADIO | LED_SUPPORT_ASSOC | 2082 rt2x00dev->led_assoc.led_dev.brightness_set =
2075 LED_SUPPORT_QUALITY; 2083 rt61pci_brightness_set;
2076 break; 2084 rt2x00dev->led_assoc.led_dev.blink_set =
2085 rt61pci_blink_set;
2086 rt2x00dev->led_assoc.flags = LED_INITIALIZED;
2087
2088 if (value == LED_MODE_SIGNAL_STRENGTH) {
2089 rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
2090 rt2x00dev->led_radio.type = LED_TYPE_QUALITY;
2091 rt2x00dev->led_qual.led_dev.brightness_set =
2092 rt61pci_brightness_set;
2093 rt2x00dev->led_qual.led_dev.blink_set =
2094 rt61pci_blink_set;
2095 rt2x00dev->led_qual.flags = LED_INITIALIZED;
2077 } 2096 }
2078 2097
2079 rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value); 2098 rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value);
@@ -2447,7 +2466,6 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
2447 .link_stats = rt61pci_link_stats, 2466 .link_stats = rt61pci_link_stats,
2448 .reset_tuner = rt61pci_reset_tuner, 2467 .reset_tuner = rt61pci_reset_tuner,
2449 .link_tuner = rt61pci_link_tuner, 2468 .link_tuner = rt61pci_link_tuner,
2450 .led_brightness = rt61pci_led_brightness,
2451 .write_tx_desc = rt61pci_write_tx_desc, 2469 .write_tx_desc = rt61pci_write_tx_desc,
2452 .write_tx_data = rt2x00pci_write_tx_data, 2470 .write_tx_data = rt2x00pci_write_tx_data,
2453 .kick_tx_queue = rt61pci_kick_tx_queue, 2471 .kick_tx_queue = rt61pci_kick_tx_queue,