summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/rt2x00/rt73usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c70
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 = {
#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
#ifdef CONFIG_RT73USB_LEDS
-static void rt73usb_led_brightness(struct led_classdev *led_cdev,
+static void rt73usb_brightness_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
struct rt2x00_led *led =
@@ -291,13 +291,6 @@ static void rt73usb_led_brightness(struct led_classdev *led_cdev,
unsigned int bg_mode =
(enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ);
- if (in_atomic()) {
- NOTICE(led->rt2x00dev,
- "Ignoring LED brightness command for led %d\n",
- led->type);
- return;
- }
-
if (led->type == LED_TYPE_RADIO) {
rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg,
MCU_LEDCS_RADIO_STATUS, enabled);
@@ -326,8 +319,22 @@ static void rt73usb_led_brightness(struct led_classdev *led_cdev,
REGISTER_TIMEOUT);
}
}
-#else
-#define rt73usb_led_brightness NULL
+
+static int rt73usb_blink_set(struct led_classdev *led_cdev,
+ unsigned long *delay_on,
+ unsigned long *delay_off)
+{
+ struct rt2x00_led *led =
+ container_of(led_cdev, struct rt2x00_led, led_dev);
+ u32 reg;
+
+ rt73usb_register_read(led->rt2x00dev, MAC_CSR14, &reg);
+ rt2x00_set_field32(&reg, MAC_CSR14_ON_PERIOD, *delay_on);
+ rt2x00_set_field32(&reg, MAC_CSR14_OFF_PERIOD, *delay_off);
+ rt73usb_register_write(led->rt2x00dev, MAC_CSR14, reg);
+
+ return 0;
+}
#endif /* CONFIG_RT73USB_LEDS */
/*
@@ -1006,11 +1013,6 @@ static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev)
rt73usb_register_write(rt2x00dev, MAC_CSR13, 0x00007f00);
- rt73usb_register_read(rt2x00dev, MAC_CSR14, &reg);
- rt2x00_set_field32(&reg, MAC_CSR14_ON_PERIOD, 70);
- rt2x00_set_field32(&reg, MAC_CSR14_OFF_PERIOD, 30);
- rt73usb_register_write(rt2x00dev, MAC_CSR14, reg);
-
/*
* Invalidate all Shared Keys (SEC_CSR0),
* and clear the Shared key Cipher algorithms (SEC_CSR1 & SEC_CSR5)
@@ -1627,19 +1629,30 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
#ifdef CONFIG_RT73USB_LEDS
rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom);
- switch (value) {
- case LED_MODE_TXRX_ACTIVITY:
- case LED_MODE_ASUS:
- case LED_MODE_ALPHA:
- case LED_MODE_DEFAULT:
- rt2x00dev->led_flags =
- LED_SUPPORT_RADIO | LED_SUPPORT_ASSOC;
- break;
- case LED_MODE_SIGNAL_STRENGTH:
- rt2x00dev->led_flags =
- LED_SUPPORT_RADIO | LED_SUPPORT_ASSOC |
- LED_SUPPORT_QUALITY;
- break;
+ rt2x00dev->led_radio.rt2x00dev = rt2x00dev;
+ rt2x00dev->led_radio.type = LED_TYPE_RADIO;
+ rt2x00dev->led_radio.led_dev.brightness_set =
+ rt73usb_brightness_set;
+ rt2x00dev->led_radio.led_dev.blink_set =
+ rt73usb_blink_set;
+ rt2x00dev->led_radio.flags = LED_INITIALIZED;
+
+ rt2x00dev->led_assoc.rt2x00dev = rt2x00dev;
+ rt2x00dev->led_assoc.type = LED_TYPE_ASSOC;
+ rt2x00dev->led_assoc.led_dev.brightness_set =
+ rt73usb_brightness_set;
+ rt2x00dev->led_assoc.led_dev.blink_set =
+ rt73usb_blink_set;
+ rt2x00dev->led_assoc.flags = LED_INITIALIZED;
+
+ if (value == LED_MODE_SIGNAL_STRENGTH) {
+ rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
+ rt2x00dev->led_radio.type = LED_TYPE_QUALITY;
+ rt2x00dev->led_qual.led_dev.brightness_set =
+ rt73usb_brightness_set;
+ rt2x00dev->led_qual.led_dev.blink_set =
+ rt73usb_blink_set;
+ rt2x00dev->led_qual.flags = LED_INITIALIZED;
}
rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value);
@@ -2040,7 +2053,6 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
.link_stats = rt73usb_link_stats,
.reset_tuner = rt73usb_reset_tuner,
.link_tuner = rt73usb_link_tuner,
- .led_brightness = rt73usb_led_brightness,
.write_tx_desc = rt73usb_write_tx_desc,
.write_tx_data = rt2x00usb_write_tx_data,
.get_tx_data_len = rt73usb_get_tx_data_len,