Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93ed8aa3 authored by Guoping Yu's avatar Guoping Yu
Browse files

leds: gpio-leds: retain the LED status on suspend



Add support to retain the LED status on suspend.
Enable the feature by define retain-state-suspended
in the LED sub-node properties.

CRs-fixed: 649441
Change-Id: I254f84e5f859be8637d8b3220f32a1736a1f0c60
Signed-off-by: default avatarGuoping Yu <guopingy@codeaurora.org>
parent 04f8a4e5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ LED sub-node properties:
  on).  The "keep" setting will keep the LED at whatever its current
  state is, without producing a glitch.  The default is off if this
  property is not present.
- retain-state-suspended: (optional) Retain the LED status on suspending.

Examples:

+2 −0
Original line number Diff line number Diff line
@@ -214,6 +214,7 @@
			label = "red";
			linux,default-trigger = "battery-charging";
			default-state = "off";
			retain-state-suspended;
		};

		green {
@@ -221,6 +222,7 @@
			label = "green";
			linux,default-trigger = "battery-full";
			default-state = "off";
			retain-state-suspended;
		};

		blue {
+4 −0
Original line number Diff line number Diff line
@@ -204,6 +204,10 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
				led.default_state = LEDS_GPIO_DEFSTATE_OFF;
		}

		led.retain_state_suspended =
			(unsigned)of_property_read_bool(child,
				"retain-state-suspended");

		ret = create_gpio_led(&led, &priv->leds[priv->num_leds++],
				      &pdev->dev, NULL);
		if (ret < 0) {