devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jelle Martijn Kok <jmkok-i3KCcyIX/XtmR6Xm/wNWPw@public.gmane.org>,
	linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH] leds-pwm: the startup brightness can be specified
Date: Thu, 9 Feb 2017 22:31:10 +0100	[thread overview]
Message-ID: <c4aebca4-d5a1-aaa7-d69b-8d0e4d4d8ba8@gmail.com> (raw)
In-Reply-To: <aed1129a-993a-91d9-7b14-13c3424ee0f4-Cb7RZHV19h6nMLx/lKYAZdBPR1lH4CV8@public.gmane.org>

Hi Jelle,

Thanks for the patch.

On 02/09/2017 03:00 PM, Jelle Martijn Kok wrote:
> 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-i3KCcyIX/XtmR6Xm/wNWPw@public.gmane.org>
> ---
>  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);

At first you would have to submit a patch for
Documentation/devicetree/bindings/leds/common.txt that would add
brightness property. The question is whether it is really needed?
You can set brightness from userspace via sysfs API.

By the way, I have a question to DT maintainers: is DT a proper
place for defining this type of configuration that can be set via
userspace scripts? Shouldn't DT describe only hardware properties and
constraints resulting from board configuration?

>           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 {

-- 
Best regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

       reply	other threads:[~2017-02-09 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <aed1129a-993a-91d9-7b14-13c3424ee0f4@solutionsradio.com>
     [not found] ` <aed1129a-993a-91d9-7b14-13c3424ee0f4-Cb7RZHV19h6nMLx/lKYAZdBPR1lH4CV8@public.gmane.org>
2017-02-09 21:31   ` Jacek Anaszewski [this message]
     [not found]     ` <c4aebca4-d5a1-aaa7-d69b-8d0e4d4d8ba8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-10 20:56       ` [PATCH] leds-pwm: the startup brightness can be specified 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4aebca4-d5a1-aaa7-d69b-8d0e4d4d8ba8@gmail.com \
    --to=jacek.anaszewski-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jmkok-i3KCcyIX/XtmR6Xm/wNWPw@public.gmane.org \
    --cc=linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).