diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-03-31 09:53:44 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-01 17:14:09 -0400 |
commit | a2e1d52a32eab53f8ab03c4023310f65aaa054a7 (patch) | |
tree | 93f5f5692f220afbedc4512bdd372084097e5e54 /drivers/net/wireless/rt2x00/rt2500usb.c | |
parent | e0b005fa1479045fe879944036268af3ebcd1835 (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/rt2500usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 85 |
1 files changed, 40 insertions, 45 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 28fdf191e956..6bb07b339325 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -283,34 +283,39 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = { | |||
283 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 283 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
284 | 284 | ||
285 | #ifdef CONFIG_RT2500USB_LEDS | 285 | #ifdef CONFIG_RT2500USB_LEDS |
286 | static void rt2500usb_led_brightness(struct led_classdev *led_cdev, | 286 | static void rt2500usb_brightness_set(struct led_classdev *led_cdev, |
287 | enum led_brightness brightness) | 287 | enum led_brightness brightness) |
288 | { | 288 | { |
289 | struct rt2x00_led *led = | 289 | struct rt2x00_led *led = |
290 | container_of(led_cdev, struct rt2x00_led, led_dev); | 290 | container_of(led_cdev, struct rt2x00_led, led_dev); |
291 | unsigned int enabled = brightness != LED_OFF; | 291 | unsigned int enabled = brightness != LED_OFF; |
292 | unsigned int activity = | 292 | u16 reg; |
293 | led->rt2x00dev->led_flags & LED_SUPPORT_ACTIVITY; | ||
294 | 293 | ||
295 | if (in_atomic()) { | 294 | rt2500usb_register_read(led->rt2x00dev, MAC_CSR20, ®); |
296 | NOTICE(led->rt2x00dev, | ||
297 | "Ignoring LED brightness command for led %d\n", | ||
298 | led->type); | ||
299 | return; | ||
300 | } | ||
301 | 295 | ||
302 | if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC) { | 296 | if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC) |
303 | rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, | 297 | rt2x00_set_field16(®, MAC_CSR20_LINK, enabled); |
304 | MAC_CSR20_LINK, enabled); | 298 | else if (led->type == LED_TYPE_ACTIVITY) |
305 | rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, | 299 | rt2x00_set_field16(®, MAC_CSR20_ACTIVITY, enabled); |
306 | MAC_CSR20_ACTIVITY, enabled && activity); | 300 | |
307 | } | 301 | rt2500usb_register_write(led->rt2x00dev, MAC_CSR20, reg); |
302 | } | ||
303 | |||
304 | static int rt2500usb_blink_set(struct led_classdev *led_cdev, | ||
305 | unsigned long *delay_on, | ||
306 | unsigned long *delay_off) | ||
307 | { | ||
308 | struct rt2x00_led *led = | ||
309 | container_of(led_cdev, struct rt2x00_led, led_dev); | ||
310 | u16 reg; | ||
311 | |||
312 | rt2500usb_register_read(led->rt2x00dev, MAC_CSR21, ®); | ||
313 | rt2x00_set_field16(®, MAC_CSR21_ON_PERIOD, *delay_on); | ||
314 | rt2x00_set_field16(®, MAC_CSR21_OFF_PERIOD, *delay_off); | ||
315 | rt2500usb_register_write(led->rt2x00dev, MAC_CSR21, reg); | ||
308 | 316 | ||
309 | rt2500usb_register_write(led->rt2x00dev, MAC_CSR20, | 317 | return 0; |
310 | led->rt2x00dev->led_mcu_reg); | ||
311 | } | 318 | } |
312 | #else | ||
313 | #define rt2500usb_led_brightness NULL | ||
314 | #endif /* CONFIG_RT2500USB_LEDS */ | 319 | #endif /* CONFIG_RT2500USB_LEDS */ |
315 | 320 | ||
316 | /* | 321 | /* |
@@ -762,11 +767,6 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev) | |||
762 | rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 0); | 767 | rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 0); |
763 | rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); | 768 | rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); |
764 | 769 | ||
765 | rt2500usb_register_read(rt2x00dev, MAC_CSR21, ®); | ||
766 | rt2x00_set_field16(®, MAC_CSR21_ON_PERIOD, 70); | ||
767 | rt2x00_set_field16(®, MAC_CSR21_OFF_PERIOD, 30); | ||
768 | rt2500usb_register_write(rt2x00dev, MAC_CSR21, reg); | ||
769 | |||
770 | rt2500usb_register_read(rt2x00dev, TXRX_CSR5, ®); | 770 | rt2500usb_register_read(rt2x00dev, TXRX_CSR5, ®); |
771 | rt2x00_set_field16(®, TXRX_CSR5_BBP_ID0, 13); | 771 | rt2x00_set_field16(®, TXRX_CSR5_BBP_ID0, 13); |
772 | rt2x00_set_field16(®, TXRX_CSR5_BBP_ID0_VALID, 1); | 772 | rt2x00_set_field16(®, TXRX_CSR5_BBP_ID0_VALID, 1); |
@@ -1384,27 +1384,23 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1384 | #ifdef CONFIG_RT2500USB_LEDS | 1384 | #ifdef CONFIG_RT2500USB_LEDS |
1385 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); | 1385 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); |
1386 | 1386 | ||
1387 | switch (value) { | 1387 | rt2x00dev->led_radio.rt2x00dev = rt2x00dev; |
1388 | case LED_MODE_ASUS: | 1388 | rt2x00dev->led_radio.type = LED_TYPE_RADIO; |
1389 | case LED_MODE_ALPHA: | 1389 | rt2x00dev->led_radio.led_dev.brightness_set = |
1390 | case LED_MODE_DEFAULT: | 1390 | rt2500usb_brightness_set; |
1391 | rt2x00dev->led_flags = LED_SUPPORT_RADIO; | 1391 | rt2x00dev->led_radio.led_dev.blink_set = |
1392 | break; | 1392 | rt2500usb_blink_set; |
1393 | case LED_MODE_TXRX_ACTIVITY: | 1393 | rt2x00dev->led_radio.flags = LED_INITIALIZED; |
1394 | rt2x00dev->led_flags = | 1394 | |
1395 | LED_SUPPORT_RADIO | LED_SUPPORT_ACTIVITY; | 1395 | if (value == LED_MODE_TXRX_ACTIVITY) { |
1396 | break; | 1396 | rt2x00dev->led_qual.rt2x00dev = rt2x00dev; |
1397 | case LED_MODE_SIGNAL_STRENGTH: | 1397 | rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY; |
1398 | rt2x00dev->led_flags = LED_SUPPORT_RADIO; | 1398 | rt2x00dev->led_qual.led_dev.brightness_set = |
1399 | break; | 1399 | rt2500usb_brightness_set; |
1400 | rt2x00dev->led_qual.led_dev.blink_set = | ||
1401 | rt2500usb_blink_set; | ||
1402 | rt2x00dev->led_qual.flags = LED_INITIALIZED; | ||
1400 | } | 1403 | } |
1401 | |||
1402 | /* | ||
1403 | * Store the current led register value, we need it later | ||
1404 | * in set_brightness but that is called in irq context which | ||
1405 | * means we can't use rt2500usb_register_read() at that time. | ||
1406 | */ | ||
1407 | rt2500usb_register_read(rt2x00dev, MAC_CSR20, &rt2x00dev->led_mcu_reg); | ||
1408 | #endif /* CONFIG_RT2500USB_LEDS */ | 1404 | #endif /* CONFIG_RT2500USB_LEDS */ |
1409 | 1405 | ||
1410 | /* | 1406 | /* |
@@ -1792,7 +1788,6 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | |||
1792 | .link_stats = rt2500usb_link_stats, | 1788 | .link_stats = rt2500usb_link_stats, |
1793 | .reset_tuner = rt2500usb_reset_tuner, | 1789 | .reset_tuner = rt2500usb_reset_tuner, |
1794 | .link_tuner = rt2500usb_link_tuner, | 1790 | .link_tuner = rt2500usb_link_tuner, |
1795 | .led_brightness = rt2500usb_led_brightness, | ||
1796 | .write_tx_desc = rt2500usb_write_tx_desc, | 1791 | .write_tx_desc = rt2500usb_write_tx_desc, |
1797 | .write_tx_data = rt2x00usb_write_tx_data, | 1792 | .write_tx_data = rt2x00usb_write_tx_data, |
1798 | .get_tx_data_len = rt2500usb_get_tx_data_len, | 1793 | .get_tx_data_len = rt2500usb_get_tx_data_len, |