Commit defb512d authored by Richard Purdie's avatar Richard Purdie

leds: Add suspend/resume state flags to leds-gpio

Add an option to preserve LED state when suspending/resuming to the LED
gpio driver. Based on a suggestion from Robert Jarzmik.
Tested-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarRichard Purdie <rpurdie@linux.intel.com>
parent 41c42ff5
...@@ -93,7 +93,8 @@ static int __devinit create_gpio_led(const struct gpio_led *template, ...@@ -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_set = gpio_led_set;
led_dat->cdev.brightness = LED_OFF; 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); ret = gpio_direction_output(led_dat->gpio, led_dat->active_low);
if (ret < 0) if (ret < 0)
......
...@@ -141,7 +141,8 @@ struct gpio_led { ...@@ -141,7 +141,8 @@ struct gpio_led {
const char *name; const char *name;
const char *default_trigger; const char *default_trigger;
unsigned gpio; unsigned gpio;
u8 active_low; u8 active_low : 1;
u8 retain_state_suspended : 1;
}; };
struct gpio_led_platform_data { struct gpio_led_platform_data {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment