All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Lee Jones <lee@kernel.org>,  Pavel Machek <pavel@ucw.cz>,
	 Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Steffen Trumtrar <kernel@pengutronix.de>,
	Pavel Machek <pavel@kernel.org>,  Mark Brown <broonie@kernel.org>,
	linux-leds@vger.kernel.org,  devicetree@vger.kernel.org,
	linux-spi@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] leds: add support for TI LP5860 LED driver chip
Date: Thu, 06 Nov 2025 08:43:42 +0100	[thread overview]
Message-ID: <87ldkjip1t.fsf@pengutronix.de> (raw)
In-Reply-To: <5d8ec4c3-1b36-470b-a1c7-629060a154ce@gmail.com> (Jacek Anaszewski's message of "Sat, 11 Oct 2025 15:09:05 +0200")


Hi Jacek,

On 2025-10-11 at 15:09 +02, Jacek Anaszewski <jacek.anaszewski@gmail.com> wrote:

> Hi Steffen
> 
> On 9/30/25 09:40, Steffen Trumtrar wrote:
> > Hi,
> > On 2025-09-16 at 16:34 +01, Lee Jones <lee@kernel.org> wrote:
> > 
> >> > +#include <linux/gpio.h>
> >> > +#include <linux/led-class-multicolor.h>
> >> > +#include <linux/module.h>
> >> > +#include <linux/of_gpio.h>
> >> > +#include <linux/of_platform.h>
> >> > +#include <linux/regmap.h>
> >> > +
> >> > +#include <linux/platform_data/leds-lp5860.h>
> >> > +
> >> > +static struct lp5860_led *mcled_cdev_to_led(struct led_classdev_mc
> >> *mc_cdev)
> >> > +{
> >> > +    return container_of(mc_cdev, struct lp5860_led, mc_cdev);
> >> > +}
> >> > +
> >> > +LP5860_SHOW_MODE(r_global_brightness_set, LP5860_REG_R_CURRENT_SET,
> >> LP5860_CC_GROUP_MASK, 0)
> >> > +LP5860_STORE_MODE(r_global_brightness_set, LP5860_REG_R_CURRENT_SET,
> >> LP5860_CC_GROUP_MASK, 0)
> >> > +DEVICE_ATTR_RW(r_global_brightness_set);
> >>
> >> How is this different to /sys/class/leds/<led>/multi_intensity?
> >>
> >> # echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity
> >> red -
> >>     intensity = 138
> >>     max_brightness = 255
> >> green -
> >>     intensity = 43
> >>     max_brightness = 255
> >> blue -
> >>     intensity = 226
> >>     max_brightness = 255
> >>
> > the LP5860 has a register for setting the maximal brightness that holds for
> > all LEDs in the matrix. multi_intensity and max_brightness is only for that
> > one multicolor LED, right? And I can only manipulate the max_brightness of
> > that one multicolor LED instance.
> > If I'm wrong, I'd be happy to not have to add the sysfs files.
> 
> It seems that this device is similar in the aspect of LED grouping
> to LP50xx family. There is already a driver for that one [0] with
> related bindings. Grouping solution could be addressed similarly to the
> banking mechanism in that driver.
>
> That of course means that this patch needs a significant rework.
> 
> First thing that strikes me after analyzing datasheet is that
> LEDs are not assigned to any group since LP5860_REG_GRP_SEL_START
> address is not referenced anywhere, and this is base address for
> Dot_grp_selN registers that enable affiliation of the LED to given
> group. No need for global brightness setting then.
>

The (now called) global_brightness sets the current of the three color groups respectively. These groups have a fixed mapping:

Group 1 is CS0, CS3, CS6,...
Group 2 is CS1, CS4, CS7,...
Group 3 is CS2, CS5, CS8,...

therefore setting the R, G and B channel. No need to assign any groups for that.

> Anyway, I'd add proper support for this device with DT knobs
> to enable both grouping and individual approach to controlling the LEDs.
> 

As far as I can tell, both drivers are pretty similar already regarding the DT description and setup.

I will just remove the global_brightness (aka global current in the datasheet) stuff, as I don't see that it is really, really needed alas the chip supports this feature and just use the intensity and max_brightness knobs that are already there via the multicolor classdev.


Best regards,
Steffen

-- 
Pengutronix e.K.                | Dipl.-Inform. Steffen Trumtrar |
Steuerwalder Str. 21            | https://www.pengutronix.de/    |
31137 Hildesheim, Germany       | Phone: +49-5121-206917-0       |
Amtsgericht Hildesheim, HRA 2686| Fax:   +49-5121-206917-5555    |

  reply	other threads:[~2025-11-06  7:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11  6:59 [PATCH v3 0/3] LED: Add basic LP5860 LED matrix driver Steffen Trumtrar
2025-09-11  6:59 ` [PATCH v3 1/3] dt-bindings: leds: add lp5860 LED controller Steffen Trumtrar
2025-09-15  0:42   ` Rob Herring (Arm)
2025-09-11  6:59 ` [PATCH v3 2/3] leds: add support for TI LP5860 LED driver chip Steffen Trumtrar
2025-09-16 15:34   ` Lee Jones
2025-09-30  7:40     ` Steffen Trumtrar
2025-10-09 12:44       ` Lee Jones
2025-10-11 13:09       ` Jacek Anaszewski
2025-11-06  7:43         ` Steffen Trumtrar [this message]
2025-09-11  6:59 ` [PATCH v3 3/3] Documentation: ABI: add lp5860 led matrix controller Steffen Trumtrar

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=87ldkjip1t.fsf@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.