1 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
2 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
3 @@ -938,6 +938,7 @@ EXPORT_SYMBOL_GPL(rt2800_rfkill_poll);
4 static void rt2800_brightness_set(struct led_classdev *led_cdev,
5 enum led_brightness brightness)
8 struct rt2x00_led *led =
9 container_of(led_cdev, struct rt2x00_led, led_dev);
10 unsigned int enabled = brightness != LED_OFF;
11 @@ -950,24 +951,46 @@ static void rt2800_brightness_set(struct
12 rt2x00_get_field16(led->rt2x00dev->led_mcu_reg,
13 EEPROM_FREQ_LED_MODE);
15 - if (led->type == LED_TYPE_RADIO) {
16 - rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
17 - enabled ? 0x20 : 0);
18 - } else if (led->type == LED_TYPE_ASSOC) {
19 - rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
20 - enabled ? (bg_mode ? 0x60 : 0xa0) : 0x20);
21 - } else if (led->type == LED_TYPE_QUALITY) {
23 - * The brightness is divided into 6 levels (0 - 5),
24 - * The specs tell us the following levels:
25 - * 0, 1 ,3, 7, 15, 31
26 - * to determine the level in a simple way we can simply
27 - * work with bitshifting:
30 - rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff,
31 - (1 << brightness / (LED_FULL / 6)) - 1,
33 + /* Check for SoC (SOC devices don't support MCU requests) */
34 + if (rt2x00_is_soc(led->rt2x00dev)) {
35 + rt2800_register_read(led->rt2x00dev, LED_CFG, ®);
37 + /* Set LED Polarity */
38 + rt2x00_set_field32(®, LED_CFG_LED_POLAR, polarity);
41 + if (led->type == LED_TYPE_RADIO) {
42 + rt2x00_set_field32(®, LED_CFG_G_LED_MODE,
44 + } else if (led->type == LED_TYPE_ASSOC) {
45 + rt2x00_set_field32(®, LED_CFG_Y_LED_MODE,
47 + } else if (led->type == LED_TYPE_QUALITY) {
48 + rt2x00_set_field32(®, LED_CFG_R_LED_MODE,
51 + rt2800_register_write(led->rt2x00dev, LED_CFG, reg);
54 + if (led->type == LED_TYPE_RADIO) {
55 + rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
56 + enabled ? 0x20 : 0);
57 + } else if (led->type == LED_TYPE_ASSOC) {
58 + rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode,
59 + enabled ? (bg_mode ? 0x60 : 0xa0) : 0x20);
60 + } else if (led->type == LED_TYPE_QUALITY) {
62 + * The brightness is divided into 6 levels (0 - 5),
63 + * The specs tell us the following levels:
64 + * 0, 1 ,3, 7, 15, 31
65 + * to determine the level in a simple way we can simply
66 + * work with bitshifting:
69 + rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff,
70 + (1 << brightness / (LED_FULL / 6)) - 1,