From: Lee Jones <lee@kernel.org>
To: Nora Schiffer <nora.schiffer@ew.tq-group.com>
Cc: Pavel Machek <pavel@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Isai Gaspar <isaiezequiel.gaspar@nxp.com>,
linux@ew.tq-group.com, linux-leds@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/8] leds: pca995x: Make output gain configurable
Date: Tue, 22 Sep 2026 17:12:34 +0100 [thread overview]
Message-ID: <20260922161234.GC3438784@google.com> (raw)
In-Reply-To: <6b65d783052e84fd00c139a3b3f85b04f680b798.1789477502.git.nora.schiffer@ew.tq-group.com>
On Tue, 15 Sep 2026, Nora Schiffer wrote:
> The output gain linearly configures the LED current in 255 levels; the
> absolute current depends on both the gain value and the R_ext resistor
> connected to the LED driver. Make the gain configurable in the Device
> Tree instead of hardcoding it to 128, allowing to adjust the current
> for different hardware designs.
>
> Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
> ---
>
> v2: Add nxp, vendor prefix
>
> drivers/leds/leds-pca995x.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-pca995x.c b/drivers/leds/leds-pca995x.c
> index 0c0ea57f3225a..9cd5702573b0d 100644
> --- a/drivers/leds/leds-pca995x.c
> +++ b/drivers/leds/leds-pca995x.c
> @@ -127,6 +127,7 @@ static int pca995x_probe(struct i2c_client *client)
> struct pca995x_chip *chip;
> struct pca995x_led *led;
> int i, j, reg, ret;
> + u32 iref;
>
> chipdef = device_get_match_data(&client->dev);
>
> @@ -154,6 +155,11 @@ static int pca995x_probe(struct i2c_client *client)
>
> i2c_set_clientdata(client, chip);
>
> + if (device_property_read_u32(dev, "nxp,output-gain", &iref))
> + iref = PCA995X_IREFALL_HALF_CFG;
> + else if (iref > PCA995X_IREFALL_FULL_CFG)
> + return dev_err_probe(dev, -EINVAL, "invalid nxp,output-gain\n");
As clever as is this, it's not that easy to follow.
I'd prefer:
u32 iref = PCA995X_IREFALL_HALF_CFG;
ret = device_property_read_u32(...);
if (!ret) {
if (val > PCA995X_IREFALL_FULL_CFG)
return dev_err_probe(dev, -EINVAL, "output-gain is out of range\n");
iref = val;
}
> device_for_each_child_node_scoped(dev, child) {
> ret = fwnode_property_read_u32(child, "reg", ®);
> if (ret)
> @@ -196,7 +202,7 @@ static int pca995x_probe(struct i2c_client *client)
> return ret;
>
> /* IREF Output current value for all LEDn outputs */
> - return regmap_write(chip->regmap, chipdef->irefall, PCA995X_IREFALL_HALF_CFG);
> + return regmap_write(chip->regmap, chipdef->irefall, iref);
> }
>
> static const struct i2c_device_id pca995x_id[] = {
> --
> TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
> Amtsgericht München, HRB 105018
> Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
> https://www.tq-group.com/
--
Lee Jones
next prev parent reply other threads:[~2026-09-22 16:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 13:43 [PATCH v2 1/8] dt-bindings: leds: pca995x: Describe reset-gpios property Nora Schiffer
2026-09-15 13:43 ` [PATCH v2 2/8] dt-bindings: leds: pca995x: Describe nxp,output-gain property Nora Schiffer
2026-09-15 14:22 ` sashiko-bot
2026-09-17 10:16 ` Krzysztof Kozlowski
2026-09-15 13:43 ` [PATCH v2 3/8] leds: pca995x: Fix maximum LED index for 16-channel variants Nora Schiffer
2026-09-15 14:24 ` sashiko-bot
2026-09-15 13:43 ` [PATCH v2 4/8] leds: pca995x: Add support for reset GPIO Nora Schiffer
2026-09-15 14:22 ` sashiko-bot
2026-09-15 13:43 ` [PATCH v2 5/8] leds: pca995x: Make output gain configurable Nora Schiffer
2026-09-15 14:22 ` sashiko-bot
2026-09-22 16:12 ` Lee Jones [this message]
2026-09-15 13:43 ` [PATCH v2 6/8] leds: pca995x: Add sysfs files for error reporting Nora Schiffer
2026-09-15 14:23 ` sashiko-bot
2026-09-15 13:43 ` [PATCH v2 7/8] leds: pca995x: Do not use full on LED mode Nora Schiffer
2026-09-15 14:26 ` sashiko-bot
2026-09-15 13:43 ` [PATCH v2 8/8] leds: pca995x: Add support for group brightness control Nora Schiffer
2026-09-15 14:32 ` sashiko-bot
2026-09-15 14:48 ` Nora Schiffer
2026-09-15 14:20 ` [PATCH v2 1/8] dt-bindings: leds: pca995x: Describe reset-gpios property sashiko-bot
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=20260922161234.GC3438784@google.com \
--to=lee@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=isaiezequiel.gaspar@nxp.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux@ew.tq-group.com \
--cc=nora.schiffer@ew.tq-group.com \
--cc=pavel@kernel.org \
--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.