leds: Add suspend/resume state flags to leds-gpio
authorRichard Purdie <rpurdie@linux.intel.com>
Tue, 17 Feb 2009 15:04:07 +0000 (15:04 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Mon, 6 Apr 2009 15:06:26 +0000 (16:06 +0100)
Add an option to preserve LED state when suspending/resuming to the LED
gpio driver. Based on a suggestion from Robert Jarzmik.

Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
drivers/leds/leds-gpio.c
include/linux/leds.h

index 0daa2d21cbdec030aec4549b98fb467723c227d6..8fa352ac20f84328f60e7c891db8825e5b363369 100644 (file)
@@ -93,7 +93,8 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
        }
        led_dat->cdev.brightness_set = gpio_led_set;
        led_dat->cdev.brightness = LED_OFF;
-       led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
+       if (!template->retain_state_suspended)
+               led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
 
        ret = gpio_direction_output(led_dat->gpio, led_dat->active_low);
        if (ret < 0)
index 17d277e0c4a645d6be61bfffb84539f36cacace5..376fe07732ea9261dc81f3ff7411d49ac9051fb3 100644 (file)
@@ -141,7 +141,8 @@ struct gpio_led {
        const char *name;
        const char *default_trigger;
        unsigned        gpio;
-       u8              active_low;
+       u8              active_low : 1;
+       u8              retain_state_suspended : 1;
 };
 
 struct gpio_led_platform_data {