linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Andrew Jeffery" <andrew@aj.id.au>
To: "Eddie James" <eajames@linux.ibm.com>, linux-leds@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, "Pavel Machek" <pavel@ucw.cz>,
	"Jacek Anaszewski" <jacek.anaszewski@gmail.com>,
	robh+dt@kernel.or, devicetree@vger.kernel.org,
	vishwa@linux.ibm.com
Subject: Re: [PATCH 2/5] leds: leds-core: Implement the retain-state-shutdown property
Date: Thu, 13 May 2021 14:21:32 +0930	[thread overview]
Message-ID: <1ffffb47-4846-4769-910f-6606a1364a74@www.fastmail.com> (raw)
In-Reply-To: <20210429205002.70245-3-eajames@linux.ibm.com>



On Fri, 30 Apr 2021, at 06:19, Eddie James wrote:
> Read the retain-state-shutdown device tree property to set the
> existing LED_RETAIN_AT_SHUTDOWN flag. Then check the flag when
> unregistering, and if set, don't set the brightness to OFF. This
> is useful for systems that want to keep the HW state of the LED
> across reboots.
> 
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
>  drivers/leds/led-class.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 2e495ff67856..f2f29318d312 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -354,10 +354,15 @@ int led_classdev_register_ext(struct device *parent,
>  		if (ret < 0)
>  			return ret;
>  
> -		if (init_data->fwnode)
> +		if (init_data->fwnode) {
>  			fwnode_property_read_string(init_data->fwnode,
>  				"linux,default-trigger",
>  				&led_cdev->default_trigger);
> +
> +			if (fwnode_property_present(init_data->fwnode,
> +						    "retain-state-shutdown"))
> +				led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN;

This is what we need, but I notice the pca955x driver is calling 
through devm_led_classdev_register() which passes NULL through 
init_data. So we won't get the result we want from this series as I 
understand it.

Andrew

  reply	other threads:[~2021-05-13  4:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 20:49 [PATCH 0/5] leds: Support retaining state for the PCA955x Eddie James
2021-04-29 20:49 ` [PATCH 1/5] dt-bindings: leds: Add retain-state-shutdown boolean Eddie James
2021-04-29 21:00   ` Eddie James
2021-04-30 11:21     ` vishwanatha subbanna
2021-05-05 23:05   ` Rob Herring
2021-04-29 20:49 ` [PATCH 2/5] leds: leds-core: Implement the retain-state-shutdown property Eddie James
2021-05-13  4:51   ` Andrew Jeffery [this message]
2021-04-29 20:50 ` [PATCH 3/5] leds: pca955x: Clean up code formatting Eddie James
2021-04-29 20:50 ` [PATCH 4/5] leds: pca955x: Add brightness_get function Eddie James
2021-04-29 20:50 ` [PATCH 5/5] leds: pca955x: Implement the default-state property Eddie James

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=1ffffb47-4846-4769-910f-6606a1364a74@www.fastmail.com \
    --to=andrew@aj.id.au \
    --cc=devicetree@vger.kernel.org \
    --cc=eajames@linux.ibm.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.or \
    --cc=vishwa@linux.ibm.com \
    /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).