linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Tony Lindgren <tony@atomide.com>,
	kernel list <linux-kernel@vger.kernel.org>,
	sre@kernel.org, nekit1000@gmail.com, mpartap@gmx.net,
	merlijn@wizzup.org, Dan Murphy <dmurphy@ti.com>,
	linux-leds@vger.kernel.org
Subject: Re: [FYI] lm3532: right registration to work with LED-backlight
Date: Sun, 8 Sep 2019 18:17:27 +0200	[thread overview]
Message-ID: <390760c1-de39-9328-bb23-cbf791094718@gmail.com> (raw)
In-Reply-To: <20190908080305.GC25459@amd>

On 9/8/19 10:03 AM, Pavel Machek wrote:
> On Wed 2019-08-28 22:32:57, Jacek Anaszewski wrote:
>> On 8/28/19 10:53 AM, Pavel Machek wrote:
>>> Hi!
>>>
>>> Eventually, these will be needed.
>>>
>>> Best regards,
>>> 								Pavel
>>>
>>> commit 38d956977a7d6cbdc811676f9b4033da7487e045
>>> Author: Pavel <pavel@ucw.cz>
>>> Date:   Wed Aug 7 12:43:52 2019 +0200
>>>
>>>     d4: lm3532 needs to use right register function for backlight to work.
>>>
>>> diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
>>> index 365a22a5..f98e657 100644
>>> --- a/drivers/leds/leds-lm3532.c
>>> +++ b/drivers/leds/leds-lm3532.c
>>> @@ -629,7 +629,7 @@ static int lm3532_parse_node(struct lm3532_data *priv)
>>>  
>>>  		lm3532_init_registers(led);
>>>  
>>> -		ret = devm_led_classdev_register(priv->dev, &led->led_dev);
>>> +		ret = devm_of_led_classdev_register(priv->dev, to_of_node(child), &led->led_dev);
>>
>> We no longer have devm_of_led_classdev_register(). You must use
>> devm_led_classdev_register_ext().
> 
> Something like this (untested)?
> 
> 								Pavel
> 
> diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
> index 62ace66..6340d5b 100644
> --- a/drivers/leds/leds-lm3532.c
> +++ b/drivers/leds/leds-lm3532.c
> @@ -577,6 +577,11 @@ static int lm3532_parse_node(struct lm3532_data *priv)
>  		priv->runtime_ramp_down = lm3532_get_ramp_index(ramp_time);
>  
>  	device_for_each_child_node(priv->dev, child) {
> +		struct led_init_data idata = {
> +			.fwnode = child,
> +			.default_label = "backlight",
> +		};
> +

If you want to properly switch to the new extended LED registration
API, then you need:

.default_label = ":",
.devicename = led->client->name;

and in addition to that you need to remove old way of composing
the LED name. Something like patch [0] for leds-lm3692x.c.
And also patch for DT for consistency would be needed (like [1]).

However it will not change anything in LED naming in comparison
to the existing code, except that it will enable the possibility
of using 'function' and 'color' DT properties instead of deprecated
'label'.

I suppose that you expected some extra bonus by passing
DT node, but I'm not sure what exactly. Possibly you confused
this with the patch set [2] that allows for instantiating
backlight device on top of LED class device (it has been forgotten
btw and will miss 5.4).

And for lm3532 - it was just relying on the glue provided by
ledtrig-backlight, as pointed out by Tony in [3].


>  		led = &priv->leds[i];
>  
>  		ret = fwnode_property_read_u32(child, "reg", &control_bank);
> @@ -648,7 +653,7 @@ static int lm3532_parse_node(struct lm3532_data *priv)
>  		led->led_dev.name = led->label;
>  		led->led_dev.brightness_set_blocking = lm3532_brightness_set;
>  
> -		ret = devm_led_classdev_register(priv->dev, &led->led_dev);
> +		ret = devm_led_classdev_register_ext(priv->dev, &led->led_dev, &idata);
>  		if (ret) {
>  			dev_err(&priv->client->dev, "led register err: %d\n",
>  				ret);
> 
> 

[0]
https://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git/commit/?h=for-next&id=a50ff28348934913c46feb7945571329e46c70b3
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git/commit/?h=for-next&id=4dcbc8f8c59f4b618d651f5ba884ee5bf562c8de
[2]
https://lore.kernel.org/linux-leds/20190717141514.21171-1-jjhiblot@ti.com/
[3] https://lore.kernel.org/linux-leds/20190403235500.GU49658@atomide.com/
-- 
Best regards,
Jacek Anaszewski

  reply	other threads:[~2019-09-08 16:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 21:52 [PATCH] leds: lm3532: Avoid potentially unpaired regulator calls Tony Lindgren
2019-08-28  8:42 ` Pavel Machek
2019-08-28  8:53 ` [FYI] lm3532: right registration to work with LED-backlight Pavel Machek
2019-08-28 20:32   ` Jacek Anaszewski
2019-09-08  8:03     ` Pavel Machek
2019-09-08 16:17       ` Jacek Anaszewski [this message]
2019-09-17 12:40         ` [PATCH] " Pavel Machek
2019-09-17 15:10           ` kbuild test robot
2019-09-17 12:42         ` [FYI] " Pavel Machek
2019-09-17 17:23           ` Jacek Anaszewski
2019-08-28 20:09 ` [PATCH] leds: lm3532: Avoid potentially unpaired regulator calls 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=390760c1-de39-9328-bb23-cbf791094718@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=merlijn@wizzup.org \
    --cc=mpartap@gmx.net \
    --cc=nekit1000@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=sre@kernel.org \
    --cc=tony@atomide.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).