diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 796cf2990b72..a9efe25f1ea7 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -280,7 +280,7 @@ static const struct rt2x00debug rt73usb_rt2x00debug = { | |||
280 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 280 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
281 | 281 | ||
282 | #ifdef CONFIG_RT73USB_LEDS | 282 | #ifdef CONFIG_RT73USB_LEDS |
283 | static void rt73usb_led_brightness(struct led_classdev *led_cdev, | 283 | static void rt73usb_brightness_set(struct led_classdev *led_cdev, |
284 | enum led_brightness brightness) | 284 | enum led_brightness brightness) |
285 | { | 285 | { |
286 | struct rt2x00_led *led = | 286 | struct rt2x00_led *led = |
@@ -291,13 +291,6 @@ static void rt73usb_led_brightness(struct led_classdev *led_cdev, | |||
291 | unsigned int bg_mode = | 291 | unsigned int bg_mode = |
292 | (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ); | 292 | (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ); |
293 | 293 | ||
294 | if (in_atomic()) { | ||
295 | NOTICE(led->rt2x00dev, | ||
296 | "Ignoring LED brightness command for led %d\n", | ||
297 | led->type); | ||
298 | return; | ||
299 | } | ||
300 | |||
301 | if (led->type == LED_TYPE_RADIO) { | 294 | if (led->type == LED_TYPE_RADIO) { |
302 | rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, | 295 | rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, |
303 | MCU_LEDCS_RADIO_STATUS, enabled); | 296 | MCU_LEDCS_RADIO_STATUS, enabled); |
@@ -326,8 +319,22 @@ static void rt73usb_led_brightness(struct led_classdev *led_cdev, | |||
326 | REGISTER_TIMEOUT); | 319 | REGISTER_TIMEOUT); |
327 | } | 320 | } |
328 | } | 321 | } |
329 | #else | 322 | |
330 | #define rt73usb_led_brightness NULL | 323 | static int rt73usb_blink_set(struct led_classdev *led_cdev, |
324 | unsigned long *delay_on, | ||
325 | unsigned long *delay_off) | ||
326 | { | ||
327 | struct rt2x00_led *led = | ||
328 | container_of(led_cdev, struct rt2x00_led, led_dev); | ||
329 | u32 reg; | ||
330 | |||
331 | rt73usb_register_read(led->rt2x00dev, MAC_CSR14, ®); | ||
332 | rt2x00_set_field32(®, MAC_CSR14_ON_PERIOD, *delay_on); | ||
333 | rt2x00_set_field32(®, MAC_CSR14_OFF_PERIOD, *delay_off); | ||
334 | rt73usb_register_write(led->rt2x00dev, MAC_CSR14, reg); | ||
335 | |||
336 | return 0; | ||
337 | } | ||
331 | #endif /* CONFIG_RT73USB_LEDS */ | 338 | #endif /* CONFIG_RT73USB_LEDS */ |
332 | 339 | ||
333 | /* | 340 | /* |
@@ -1006,11 +1013,6 @@ static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1006 | 1013 | ||
1007 | rt73usb_register_write(rt2x00dev, MAC_CSR13, 0x00007f00); | 1014 | rt73usb_register_write(rt2x00dev, MAC_CSR13, 0x00007f00); |
1008 | 1015 | ||
1009 | rt73usb_register_read(rt2x00dev, MAC_CSR14, ®); | ||
1010 | rt2x00_set_field32(®, MAC_CSR14_ON_PERIOD, 70); | ||
1011 | rt2x00_set_field32(®, MAC_CSR14_OFF_PERIOD, 30); | ||
1012 | rt73usb_register_write(rt2x00dev, MAC_CSR14, reg); | ||
1013 | |||
1014 | /* | 1016 | /* |
1015 | * Invalidate all Shared Keys (SEC_CSR0), | 1017 | * Invalidate all Shared Keys (SEC_CSR0), |
1016 | * and clear the Shared key Cipher algorithms (SEC_CSR1 & SEC_CSR5) | 1018 | * and clear the Shared key Cipher algorithms (SEC_CSR1 & SEC_CSR5) |
@@ -1627,19 +1629,30 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1627 | #ifdef CONFIG_RT73USB_LEDS | 1629 | #ifdef CONFIG_RT73USB_LEDS |
1628 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom); | 1630 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom); |
1629 | 1631 | ||
1630 | switch (value) { | 1632 | rt2x00dev->led_radio.rt2x00dev = rt2x00dev; |
1631 | case LED_MODE_TXRX_ACTIVITY: | 1633 | rt2x00dev->led_radio.type = LED_TYPE_RADIO; |
1632 | case LED_MODE_ASUS: | 1634 | rt2x00dev->led_radio.led_dev.brightness_set = |
1633 | case LED_MODE_ALPHA: | 1635 | rt73usb_brightness_set; |
1634 | case LED_MODE_DEFAULT: | 1636 | rt2x00dev->led_radio.led_dev.blink_set = |
1635 | rt2x00dev->led_flags = | 1637 | rt73usb_blink_set; |
1636 | LED_SUPPORT_RADIO | LED_SUPPORT_ASSOC; | 1638 | rt2x00dev->led_radio.flags = LED_INITIALIZED; |
1637 | break; | 1639 | |
1638 | case LED_MODE_SIGNAL_STRENGTH: | 1640 | rt2x00dev->led_assoc.rt2x00dev = rt2x00dev; |
1639 | rt2x00dev->led_flags = | 1641 | rt2x00dev->led_assoc.type = LED_TYPE_ASSOC; |
1640 | LED_SUPPORT_RADIO | LED_SUPPORT_ASSOC | | 1642 | rt2x00dev->led_assoc.led_dev.brightness_set = |
1641 | LED_SUPPORT_QUALITY; | 1643 | rt73usb_brightness_set; |
1642 | break; | 1644 | rt2x00dev->led_assoc.led_dev.blink_set = |
1645 | rt73usb_blink_set; | ||
1646 | rt2x00dev->led_assoc.flags = LED_INITIALIZED; | ||
1647 | |||
1648 | if (value == LED_MODE_SIGNAL_STRENGTH) { | ||
1649 | rt2x00dev->led_qual.rt2x00dev = rt2x00dev; | ||
1650 | rt2x00dev->led_radio.type = LED_TYPE_QUALITY; | ||
1651 | rt2x00dev->led_qual.led_dev.brightness_set = | ||
1652 | rt73usb_brightness_set; | ||
1653 | rt2x00dev->led_qual.led_dev.blink_set = | ||
1654 | rt73usb_blink_set; | ||
1655 | rt2x00dev->led_qual.flags = LED_INITIALIZED; | ||
1643 | } | 1656 | } |
1644 | 1657 | ||
1645 | rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value); | 1658 | rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value); |
@@ -2040,7 +2053,6 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | |||
2040 | .link_stats = rt73usb_link_stats, | 2053 | .link_stats = rt73usb_link_stats, |
2041 | .reset_tuner = rt73usb_reset_tuner, | 2054 | .reset_tuner = rt73usb_reset_tuner, |
2042 | .link_tuner = rt73usb_link_tuner, | 2055 | .link_tuner = rt73usb_link_tuner, |
2043 | .led_brightness = rt73usb_led_brightness, | ||
2044 | .write_tx_desc = rt73usb_write_tx_desc, | 2056 | .write_tx_desc = rt73usb_write_tx_desc, |
2045 | .write_tx_data = rt2x00usb_write_tx_data, | 2057 | .write_tx_data = rt2x00usb_write_tx_data, |
2046 | .get_tx_data_len = rt73usb_get_tx_data_len, | 2058 | .get_tx_data_len = rt73usb_get_tx_data_len, |