aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.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/rt2400pci.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/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c63
1 files changed, 36 insertions, 27 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 9abdfb84697c..b41187af1306 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -244,27 +244,39 @@ static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
244#endif /* CONFIG_RT2400PCI_RFKILL */ 244#endif /* CONFIG_RT2400PCI_RFKILL */
245 245
246#ifdef CONFIG_RT2400PCI_LEDS 246#ifdef CONFIG_RT2400PCI_LEDS
247static void rt2400pci_led_brightness(struct led_classdev *led_cdev, 247static void rt2400pci_brightness_set(struct led_classdev *led_cdev,
248 enum led_brightness brightness) 248 enum led_brightness brightness)
249{ 249{
250 struct rt2x00_led *led = 250 struct rt2x00_led *led =
251 container_of(led_cdev, struct rt2x00_led, led_dev); 251 container_of(led_cdev, struct rt2x00_led, led_dev);
252 unsigned int enabled = brightness != LED_OFF; 252 unsigned int enabled = brightness != LED_OFF;
253 unsigned int activity =
254 led->rt2x00dev->led_flags & LED_SUPPORT_ACTIVITY;
255 u32 reg; 253 u32 reg;
256 254
257 rt2x00pci_register_read(led->rt2x00dev, LEDCSR, &reg); 255 rt2x00pci_register_read(led->rt2x00dev, LEDCSR, &reg);
258 256
259 if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC) { 257 if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC)
260 rt2x00_set_field32(&reg, LEDCSR_LINK, enabled); 258 rt2x00_set_field32(&reg, LEDCSR_LINK, enabled);
261 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY, enabled && activity); 259 else if (led->type == LED_TYPE_ACTIVITY)
262 } 260 rt2x00_set_field32(&reg, LEDCSR_ACTIVITY, enabled);
263 261
264 rt2x00pci_register_write(led->rt2x00dev, LEDCSR, reg); 262 rt2x00pci_register_write(led->rt2x00dev, LEDCSR, reg);
265} 263}
266#else 264
267#define rt2400pci_led_brightness NULL 265static int rt2400pci_blink_set(struct led_classdev *led_cdev,
266 unsigned long *delay_on,
267 unsigned long *delay_off)
268{
269 struct rt2x00_led *led =
270 container_of(led_cdev, struct rt2x00_led, led_dev);
271 u32 reg;
272
273 rt2x00pci_register_read(led->rt2x00dev, LEDCSR, &reg);
274 rt2x00_set_field32(&reg, LEDCSR_ON_PERIOD, *delay_on);
275 rt2x00_set_field32(&reg, LEDCSR_OFF_PERIOD, *delay_off);
276 rt2x00pci_register_write(led->rt2x00dev, LEDCSR, reg);
277
278 return 0;
279}
268#endif /* CONFIG_RT2400PCI_LEDS */ 280#endif /* CONFIG_RT2400PCI_LEDS */
269 281
270/* 282/*
@@ -719,11 +731,6 @@ static int rt2400pci_init_registers(struct rt2x00_dev *rt2x00dev)
719 (rt2x00dev->rx->data_size / 128)); 731 (rt2x00dev->rx->data_size / 128));
720 rt2x00pci_register_write(rt2x00dev, CSR9, reg); 732 rt2x00pci_register_write(rt2x00dev, CSR9, reg);
721 733
722 rt2x00pci_register_read(rt2x00dev, LEDCSR, &reg);
723 rt2x00_set_field32(&reg, LEDCSR_ON_PERIOD, 70);
724 rt2x00_set_field32(&reg, LEDCSR_OFF_PERIOD, 30);
725 rt2x00pci_register_write(rt2x00dev, LEDCSR, reg);
726
727 rt2x00pci_register_write(rt2x00dev, CNT3, 0x3f080000); 734 rt2x00pci_register_write(rt2x00dev, CNT3, 0x3f080000);
728 735
729 rt2x00pci_register_read(rt2x00dev, ARCSR0, &reg); 736 rt2x00pci_register_read(rt2x00dev, ARCSR0, &reg);
@@ -1291,19 +1298,22 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1291#ifdef CONFIG_RT2400PCI_LEDS 1298#ifdef CONFIG_RT2400PCI_LEDS
1292 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); 1299 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE);
1293 1300
1294 switch (value) { 1301 rt2x00dev->led_radio.rt2x00dev = rt2x00dev;
1295 case LED_MODE_ASUS: 1302 rt2x00dev->led_radio.type = LED_TYPE_RADIO;
1296 case LED_MODE_ALPHA: 1303 rt2x00dev->led_radio.led_dev.brightness_set =
1297 case LED_MODE_DEFAULT: 1304 rt2400pci_brightness_set;
1298 rt2x00dev->led_flags = LED_SUPPORT_RADIO; 1305 rt2x00dev->led_radio.led_dev.blink_set =
1299 break; 1306 rt2400pci_blink_set;
1300 case LED_MODE_TXRX_ACTIVITY: 1307 rt2x00dev->led_radio.flags = LED_INITIALIZED;
1301 rt2x00dev->led_flags = 1308
1302 LED_SUPPORT_RADIO | LED_SUPPORT_ACTIVITY; 1309 if (value == LED_MODE_TXRX_ACTIVITY) {
1303 break; 1310 rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
1304 case LED_MODE_SIGNAL_STRENGTH: 1311 rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY;
1305 rt2x00dev->led_flags = LED_SUPPORT_RADIO; 1312 rt2x00dev->led_qual.led_dev.brightness_set =
1306 break; 1313 rt2400pci_brightness_set;
1314 rt2x00dev->led_qual.led_dev.blink_set =
1315 rt2400pci_blink_set;
1316 rt2x00dev->led_qual.flags = LED_INITIALIZED;
1307 } 1317 }
1308#endif /* CONFIG_RT2400PCI_LEDS */ 1318#endif /* CONFIG_RT2400PCI_LEDS */
1309 1319
@@ -1569,7 +1579,6 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
1569 .link_stats = rt2400pci_link_stats, 1579 .link_stats = rt2400pci_link_stats,
1570 .reset_tuner = rt2400pci_reset_tuner, 1580 .reset_tuner = rt2400pci_reset_tuner,
1571 .link_tuner = rt2400pci_link_tuner, 1581 .link_tuner = rt2400pci_link_tuner,
1572 .led_brightness = rt2400pci_led_brightness,
1573 .write_tx_desc = rt2400pci_write_tx_desc, 1582 .write_tx_desc = rt2400pci_write_tx_desc,
1574 .write_tx_data = rt2x00pci_write_tx_data, 1583 .write_tx_data = rt2x00pci_write_tx_data,
1575 .kick_tx_queue = rt2400pci_kick_tx_queue, 1584 .kick_tx_queue = rt2400pci_kick_tx_queue,