diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 54c9a75b549b..5ade097ed45e 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -244,27 +244,39 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
244 | #endif /* CONFIG_RT2500PCI_RFKILL */ | 244 | #endif /* CONFIG_RT2500PCI_RFKILL */ |
245 | 245 | ||
246 | #ifdef CONFIG_RT2500PCI_LEDS | 246 | #ifdef CONFIG_RT2500PCI_LEDS |
247 | static void rt2500pci_led_brightness(struct led_classdev *led_cdev, | 247 | static void rt2500pci_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, ®); | 255 | rt2x00pci_register_read(led->rt2x00dev, LEDCSR, ®); |
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(®, LEDCSR_LINK, enabled); | 258 | rt2x00_set_field32(®, LEDCSR_LINK, enabled); |
261 | rt2x00_set_field32(®, LEDCSR_ACTIVITY, enabled && activity); | 259 | else if (led->type == LED_TYPE_ACTIVITY) |
262 | } | 260 | rt2x00_set_field32(®, 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 rt2500pci_led_brightness NULL | 265 | static int rt2500pci_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, ®); | ||
274 | rt2x00_set_field32(®, LEDCSR_ON_PERIOD, *delay_on); | ||
275 | rt2x00_set_field32(®, LEDCSR_OFF_PERIOD, *delay_off); | ||
276 | rt2x00pci_register_write(led->rt2x00dev, LEDCSR, reg); | ||
277 | |||
278 | return 0; | ||
279 | } | ||
268 | #endif /* CONFIG_RT2500PCI_LEDS */ | 280 | #endif /* CONFIG_RT2500PCI_LEDS */ |
269 | 281 | ||
270 | /* | 282 | /* |
@@ -812,11 +824,6 @@ static int rt2500pci_init_registers(struct rt2x00_dev *rt2x00dev) | |||
812 | rt2x00_set_field32(®, CSR11_CW_SELECT, 0); | 824 | rt2x00_set_field32(®, CSR11_CW_SELECT, 0); |
813 | rt2x00pci_register_write(rt2x00dev, CSR11, reg); | 825 | rt2x00pci_register_write(rt2x00dev, CSR11, reg); |
814 | 826 | ||
815 | rt2x00pci_register_read(rt2x00dev, LEDCSR, ®); | ||
816 | rt2x00_set_field32(®, LEDCSR_ON_PERIOD, 70); | ||
817 | rt2x00_set_field32(®, LEDCSR_OFF_PERIOD, 30); | ||
818 | rt2x00pci_register_write(rt2x00dev, LEDCSR, reg); | ||
819 | |||
820 | rt2x00pci_register_write(rt2x00dev, CNT3, 0); | 827 | rt2x00pci_register_write(rt2x00dev, CNT3, 0); |
821 | 828 | ||
822 | rt2x00pci_register_read(rt2x00dev, TXCSR8, ®); | 829 | rt2x00pci_register_read(rt2x00dev, TXCSR8, ®); |
@@ -1468,19 +1475,22 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1468 | #ifdef CONFIG_RT2500PCI_LEDS | 1475 | #ifdef CONFIG_RT2500PCI_LEDS |
1469 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); | 1476 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); |
1470 | 1477 | ||
1471 | switch (value) { | 1478 | rt2x00dev->led_radio.rt2x00dev = rt2x00dev; |
1472 | case LED_MODE_ASUS: | 1479 | rt2x00dev->led_radio.type = LED_TYPE_RADIO; |
1473 | case LED_MODE_ALPHA: | 1480 | rt2x00dev->led_radio.led_dev.brightness_set = |
1474 | case LED_MODE_DEFAULT: | 1481 | rt2500pci_brightness_set; |
1475 | rt2x00dev->led_flags = LED_SUPPORT_RADIO; | 1482 | rt2x00dev->led_radio.led_dev.blink_set = |
1476 | break; | 1483 | rt2500pci_blink_set; |
1477 | case LED_MODE_TXRX_ACTIVITY: | 1484 | rt2x00dev->led_radio.flags = LED_INITIALIZED; |
1478 | rt2x00dev->led_flags = | 1485 | |
1479 | LED_SUPPORT_RADIO | LED_SUPPORT_ACTIVITY; | 1486 | if (value == LED_MODE_TXRX_ACTIVITY) { |
1480 | break; | 1487 | rt2x00dev->led_qual.rt2x00dev = rt2x00dev; |
1481 | case LED_MODE_SIGNAL_STRENGTH: | 1488 | rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY; |
1482 | rt2x00dev->led_flags = LED_SUPPORT_RADIO; | 1489 | rt2x00dev->led_qual.led_dev.brightness_set = |
1483 | break; | 1490 | rt2500pci_brightness_set; |
1491 | rt2x00dev->led_qual.led_dev.blink_set = | ||
1492 | rt2500pci_blink_set; | ||
1493 | rt2x00dev->led_qual.flags = LED_INITIALIZED; | ||
1484 | } | 1494 | } |
1485 | #endif /* CONFIG_RT2500PCI_LEDS */ | 1495 | #endif /* CONFIG_RT2500PCI_LEDS */ |
1486 | 1496 | ||
@@ -1882,7 +1892,6 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { | |||
1882 | .link_stats = rt2500pci_link_stats, | 1892 | .link_stats = rt2500pci_link_stats, |
1883 | .reset_tuner = rt2500pci_reset_tuner, | 1893 | .reset_tuner = rt2500pci_reset_tuner, |
1884 | .link_tuner = rt2500pci_link_tuner, | 1894 | .link_tuner = rt2500pci_link_tuner, |
1885 | .led_brightness = rt2500pci_led_brightness, | ||
1886 | .write_tx_desc = rt2500pci_write_tx_desc, | 1895 | .write_tx_desc = rt2500pci_write_tx_desc, |
1887 | .write_tx_data = rt2x00pci_write_tx_data, | 1896 | .write_tx_data = rt2x00pci_write_tx_data, |
1888 | .kick_tx_queue = rt2500pci_kick_tx_queue, | 1897 | .kick_tx_queue = rt2500pci_kick_tx_queue, |