Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61c2b682 authored by Ivo van Doorn's avatar Ivo van Doorn Committed by John W. Linville
Browse files

rt2x00: Fix quality/activity led handling



There was an obvious typo in LED structure
initialization which caused the radio and quality/activity
leds to be incorrectly initialized which resulted in
the leds not being enabled.

Additionally add the rt2x00led_led_activity() handler
that will enable TX/RX activity leds when the radio
is being enabled.

Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 44a9809b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1308,7 +1308,7 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)

	if (value == LED_MODE_TXRX_ACTIVITY) {
		rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
		rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY;
		rt2x00dev->led_qual.type = LED_TYPE_ACTIVITY;
		rt2x00dev->led_qual.led_dev.brightness_set =
		    rt2400pci_brightness_set;
		rt2x00dev->led_qual.led_dev.blink_set =
+1 −1
Original line number Diff line number Diff line
@@ -1485,7 +1485,7 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)

	if (value == LED_MODE_TXRX_ACTIVITY) {
		rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
		rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY;
		rt2x00dev->led_qual.type = LED_TYPE_ACTIVITY;
		rt2x00dev->led_qual.led_dev.brightness_set =
		    rt2500pci_brightness_set;
		rt2x00dev->led_qual.led_dev.blink_set =
+1 −1
Original line number Diff line number Diff line
@@ -1394,7 +1394,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)

	if (value == LED_MODE_TXRX_ACTIVITY) {
		rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
		rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY;
		rt2x00dev->led_qual.type = LED_TYPE_ACTIVITY;
		rt2x00dev->led_qual.led_dev.brightness_set =
		    rt2500usb_brightness_set;
		rt2x00dev->led_qual.led_dev.blink_set =
+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
		return status;

	rt2x00leds_led_radio(rt2x00dev, true);
	rt2x00led_led_activity(rt2x00dev, true);

	__set_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags);

@@ -157,6 +158,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
	 * Disable radio.
	 */
	rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_OFF);
	rt2x00led_led_activity(rt2x00dev, false);
	rt2x00leds_led_radio(rt2x00dev, false);
}

+15 −0
Original line number Diff line number Diff line
@@ -72,6 +72,21 @@ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
	}
}

void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, bool enabled)
{
	struct rt2x00_led *led = &rt2x00dev->led_qual;
	unsigned int brightness;

	if ((led->type != LED_TYPE_ACTIVITY) || !(led->flags & LED_REGISTERED))
		return;

	brightness = enabled ? LED_FULL : LED_OFF;
	if (brightness != led->led_dev.brightness) {
		led->led_dev.brightness_set(&led->led_dev, brightness);
		led->led_dev.brightness = brightness;
	}
}

void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled)
{
	struct rt2x00_led *led = &rt2x00dev->led_assoc;
Loading