linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds-pwm: the startup brightness can be specified
@ 2017-02-09 14:00 Jelle Martijn Kok
       [not found] ` <aed1129a-993a-91d9-7b14-13c3424ee0f4-Cb7RZHV19h6nMLx/lKYAZdBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jelle Martijn Kok @ 2017-02-09 14:00 UTC (permalink / raw)
  To: linux-leds

Upto now the leds-pwm are either on or off at startup. This allows the
dts to specify the startup brightness

Signed-off-by: Jelle Martijn Kok <jmkok@youcom.nl>
---
  drivers/leds/leds-pwm.c  | 5 ++++-
  include/linux/leds_pwm.h | 1 +
  2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index a9145aa..4799f36 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -97,7 +97,7 @@ static int led_pwm_add(struct device *dev, struct 
led_pwm_priv *priv,
  	led_data->active_low = led->active_low;
  	led_data->cdev.name = led->name;
  	led_data->cdev.default_trigger = led->default_trigger;
-	led_data->cdev.brightness = LED_OFF;
+	led_data->cdev.brightness = led->default_brightness;
  	led_data->cdev.max_brightness = led->max_brightness;
  	led_data->cdev.flags = LED_CORE_SUSPENDRESUME;
  @@ -159,6 +159,9 @@ static int led_pwm_create_of(struct device *dev, 
struct led_pwm_priv *priv)
  		led.active_low = of_property_read_bool(child, "active-low");
  		of_property_read_u32(child, "max-brightness",
  				     &led.max_brightness);
+		led.default_brightness = LED_OFF;
+		of_property_read_u32(child, "brightness",
+				     &led.default_brightness);
   		ret = led_pwm_add(dev, priv, &led, child);
  		if (ret) {
diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h
index a65e964..7e70438 100644
--- a/include/linux/leds_pwm.h
+++ b/include/linux/leds_pwm.h
@@ -11,6 +11,7 @@ struct led_pwm {
  	u8 		active_low;
  	unsigned 	max_brightness;
  	unsigned	pwm_period_ns;
+	unsigned 	default_brightness;
  };
   struct led_pwm_platform_data {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-14 21:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-09 14:00 [PATCH] leds-pwm: the startup brightness can be specified Jelle Martijn Kok
     [not found] ` <aed1129a-993a-91d9-7b14-13c3424ee0f4-Cb7RZHV19h6nMLx/lKYAZdBPR1lH4CV8@public.gmane.org>
2017-02-09 21:31   ` Jacek Anaszewski
     [not found]     ` <c4aebca4-d5a1-aaa7-d69b-8d0e4d4d8ba8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-10 20:56       ` Pavel Machek
2017-02-14 10:34         ` Jelle Martijn Kok
     [not found]           ` <74325158-79f6-ff2a-832e-9f2ece1cf853-i3KCcyIX/XtmR6Xm/wNWPw@public.gmane.org>
2017-02-14 21:13             ` Jacek Anaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).