Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Paul Sajna" <sajattack@postmarketos.org>
Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v5 2/3] leds: aw2013: Add AW2027 support
Date: Thu, 12 Nov 2026 21:29:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-211866@kernel.org> (raw)
In-Reply-To: <20261112-aw2013-aw20xx-rename-v5-2-b2c5e323a90a@postmarketos.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] leds: aw2013: build error and wrong imax mask in
  aw2013_probe_dt()
--

commit 07caacf25b9b9285cf8d8cd5387ef8435b68fb1e
Author: Paul Sajna <sajattack@postmarketos.org>

leds: aw2013: Add AW2027 support

This commit adds support for the Awinic AW2027 3-channel LED controller
to the aw2013 driver, introducing chip-specific definitions and current
configuration handling.

> diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c
> index cf20e94920fd6..d3858b06e594d 100644
> --- a/drivers/leds/leds-aw2013.c
> +++ b/drivers/leds/leds-aw2013.c
> @@ -20,13 +20,15 @@
>  #define AW2013_GCR 0x01
>  #define AW2013_GCR_ENABLE BIT(0)
>  
> +#define AW20XX_GCR2 0x04
> +
>  /* LED channel enable register */
>  #define AW2013_LCTR 0x30
>  #define AW2013_LCTR_LE(x) BIT((x))
>  
>  /* LED channel control registers */
>  #define AW2013_LCFG(x) (0x31 + (x))
> -#define AW2013_LCFG_IMAX_MASK (BIT(0) | BIT(1)) // Should be 0-3
> +#define AW2013_IMAX_MASK (BIT(0) | BIT(1)) // Should be 0-3

[ ... ]

> @@ -293,9 +403,9 @@ static int aw2013_probe_dt(struct aw2013 *chip)
>  		init_data.fwnode = of_fwnode_handle(child);
>  
>  		if (!of_property_read_u32(child, "led-max-microamp", &imax)) {
> -			led->imax = min_t(u32, imax / 5000, 3);
> +			led->imax = aw2013_microamp_to_imax(imax, chip->cdef);
>  		} else {
> -			led->imax = 1; // 5mA
> +			led->imax = chip->cdef->default_imax;
>  			dev_info(&chip->client->dev,
>  				 "DT property led-max-microamp is missing\n");
>  		}

[Severity: High]
Does renaming AW2013_LCFG_IMAX_MASK to AW2013_IMAX_MASK break the build in
aw2013_probe_dt()?

Just below this hunk, aw2013_probe_dt() still references the removed
AW2013_LCFG_IMAX_MASK macro when configuring subsequent LEDs after an
earlier LED enables the chip (for example via a default trigger during
devm_led_classdev_register_ext()):

drivers/leds/leds-aw2013.c:aw2013_probe_dt() {
	...
		if (chip->enabled) {
			ret = regmap_update_bits(chip->regmap,
						 AW2013_LCFG(led->num),
						 AW2013_LCFG_IMAX_MASK,
						 led->imax);
	...
}

In addition to failing to compile, on AW2027 the per-LED current field in
AW2013_LCFG(led->num) uses the 4-bit AW2027_LOCAL_IMAX_MASK rather than the
2-bit AW2013_IMAX_MASK, so using the 2-bit mask here would truncate
led->imax for those LEDs.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-aw2013-aw20xx-rename-v5-0-b2c5e323a90a@postmarketos.org?part=2

  reply	other threads:[~2026-11-12 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 21:22 [PATCH v5 0/3] leds: aw2013: Add AW2027 support Paul Sajna via B4 Relay
2026-11-12 21:22 ` [PATCH v5 1/3] dt-bindings: leds: aw2013: Add awinic,aw2027 compatible Paul Sajna via B4 Relay
2026-11-12 21:22 ` [PATCH v5 2/3] leds: aw2013: Add AW2027 support Paul Sajna via B4 Relay
2026-11-12 21:29   ` sashiko-bot [this message]
2026-11-12 21:22 ` [PATCH v5 3/3] leds: aw2013: Use dev_err_probe Paul Sajna via B4 Relay

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=sashiko-outbox-211866@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sajattack@postmarketos.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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