rt2x00: merge an rt2800 initialization order fix
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 619-rt2x00-change-led-polarity-from-OF.patch
1 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
2 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
3 @@ -39,6 +39,7 @@
4 #include <linux/module.h>
5 #include <linux/slab.h>
6 #include <linux/clk.h>
7 +#include <linux/of.h>
8
9 #include "rt2x00.h"
10 #include "rt2800lib.h"
11 @@ -7253,6 +7254,17 @@ static int rt2800_init_eeprom(struct rt2
12 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
13 rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
14
15 + {
16 + struct device_node *np = rt2x00dev->dev->of_node;
17 + unsigned int led_polarity;
18 +
19 + /* Allow overriding polarity from OF */
20 + if (!of_property_read_u32(np, "ralink,led-polarity",
21 + &led_polarity))
22 + rt2x00_set_field16(&eeprom, EEPROM_FREQ_LED_POLARITY,
23 + led_polarity);
24 + }
25 +
26 rt2x00dev->led_mcu_reg = eeprom;
27 #endif /* CPTCFG_RT2X00_LIB_LEDS */
28
29 --- a/drivers/net/wireless/rt2x00/rt2x00leds.c
30 +++ b/drivers/net/wireless/rt2x00/rt2x00leds.c
31 @@ -111,6 +111,9 @@ static int rt2x00leds_register_led(struc
32 led->led_dev.name = name;
33 led->led_dev.brightness = LED_OFF;
34
35 + if (rt2x00_is_soc(rt2x00dev))
36 + led->led_dev.brightness_set(&led->led_dev, LED_OFF);
37 +
38 retval = led_classdev_register(device, &led->led_dev);
39 if (retval) {
40 rt2x00_err(rt2x00dev, "Failed to register led handler\n");