[adm5120] add patch for gpio-leds to support special brightness values, thanks to...
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / patches-2.6.23 / 203-gpio_leds_brightness.patch
1 Index: linux-2.6.23/drivers/leds/leds-gpio.c
2 ===================================================================
3 --- linux-2.6.23.orig/drivers/leds/leds-gpio.c
4 +++ linux-2.6.23/drivers/leds/leds-gpio.c
5 @@ -41,13 +41,17 @@
6 container_of(led_cdev, struct gpio_led_data, cdev);
7 int level;
8
9 - if (value == LED_OFF)
10 - level = 0;
11 - else
12 - level = 1;
13 -
14 - if (led_dat->active_low)
15 - level = !level;
16 + switch (value) {
17 + case LED_OFF:
18 + level = led_dat->active_low ? 1 : 0;
19 + break;
20 + case LED_FULL:
21 + level = led_dat->active_low ? 0 : 1;
22 + break;
23 + default:
24 + level = value;
25 + break;
26 + }
27
28 /* setting GPIOs with I2C/etc requires a preemptible task context */
29 if (led_dat->can_sleep) {