dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 5/6] backlight: aw99706: Support the led-max-microamp property
       [not found] ` <20261205005118.884885-6-lukapanio@gmail.com>
@ 2026-12-05  0:59   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-05  0:59 UTC (permalink / raw)
  To: Luka Panio; +Cc: dri-devel, linux-leds, devicetree, robh, conor+dt, lee

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] backlight: aw99706: empty commit message body omits rationale
  and fallback
- [Low] backlight: aw99706: aw99706_dt_parse() warns with wrong name for
  legacy prop
--

commit 145a6dabcb5680c7062435715038e4c7b53fef01
Author: Luka Panio <lukapanio@gmail.com>

> backlight: aw99706: Support the led-max-microamp property
>
> Signed-off-by: Luka Panio <lukapanio@gmail.com>

[Severity: Low]
The commit message has no body explaining why the driver switches to
led-max-microamp or noting that awinic,iled-max-microamp is retained as a
fallback when led-max-microamp is absent.  A short description of the
rationale and fallback precedence would help future readers of git history.

> diff --git a/drivers/video/backlight/aw99706.c b/drivers/video/backlight/aw99706.c
> index db12ee1c979da..5e0f8ccd3c88e 100644
> --- a/drivers/video/backlight/aw99706.c
> +++ b/drivers/video/backlight/aw99706.c

[ ... ]

> @@ -291,6 +293,10 @@ static void aw99706_dt_parse(struct aw99706_device *aw,
>  	for (i = 0; i < chip->num_dt_props; i++) {
>  		prop = &chip->dt_props[i];
>  		ret = device_property_read_u32(aw->dev, prop->name, &dt_val);
> +		if (ret < 0 && prop->legacy_name)
> +			ret = device_property_read_u32(aw->dev,
> +						       prop->legacy_name,
> +						       &dt_val);
>  		if (ret < 0)
>  			dt_val = prop->def_val;

[Severity: Low]
When a legacy device tree omits led-max-microamp and provides an invalid
awinic,iled-max-microamp value, does the dev_warn() right below log
prop->name (led-max-microamp) instead of the legacy property that supplied
dt_val?

Tracking the matched property name in a local variable and passing it to
dev_warn() would ensure the warning identifies the offending property.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205005118.884885-1-lukapanio@gmail.com?part=5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/6] dt-bindings: leds: backlight: aw99706: Use standard led-max-microamp
       [not found] ` <20261205005118.884885-2-lukapanio@gmail.com>
@ 2026-12-05  1:01   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-05  1:01 UTC (permalink / raw)
  To: Luka Panio; +Cc: dri-devel, linux-leds, devicetree, robh, conor+dt, lee

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dt-bindings: aw99706: place led-max-microamp before vendor
  properties
--

commit b5cccb409159501f7c23d7b085592afcea3d6e74
Author: Luka Panio <lukapanio@gmail.com>

dt-bindings: leds: backlight: aw99706: Use standard led-max-microamp

This commit adds the standard led-max-microamp property to the AW99706
backlight DT binding, marks awinic,iled-max-microamp as deprecated, and
updates the example node.

> diff --git a/Documentation/devicetree/bindings/leds/backlight/awinic,aw99706.yaml b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99706.yaml
> index 60eae50ff742f..0690e0e0de659 100644
> --- a/Documentation/devicetree/bindings/leds/backlight/awinic,aw99706.yaml
> +++ b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99706.yaml
> @@ -45,12 +45,20 @@ properties:
>      enum: [ 1500000, 2000000, 2500000, 3000000 ]
>      default: 3000000
>
> +  led-max-microamp:
> +    description: Maximum LED current setting in uA.
> +    minimum: 5000
> +    maximum: 50000
> +    multipleOf: 500
> +    default: 20000
> +
>    awinic,iled-max-microamp:
>      description: Maximum LED current setting in uA.
>      minimum: 5000
>      maximum: 50000
>      multipleOf: 500
>      default: 20000
> +    deprecated: true
>
>    awinic,uvlo-thres-microvolt:
>      description: UVLO(Under Voltage Lock Out) in uV.
> @@ -93,7 +101,7 @@ examples:
>              awinic,sw-freq-hz = <750000>;
>              awinic,sw-ilmt-microamp = <3000000>;
>              awinic,uvlo-thres-microvolt = <2200000>;
> -            awinic,iled-max-microamp = <20000>;
> +            led-max-microamp = <20000>;
>              awinic,ramp-ctl = <2>;
>          };
>      };

[Severity: Low]
Should led-max-microamp be placed before the vendor-prefixed awinic,*
properties in both the properties block (before awinic,dim-mode) and the
examples node?  Per Documentation/devicetree/bindings/dts-coding-style.rst
and writing-schema.rst, standard properties without vendor prefixes belong
before vendor-specific ones.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205005118.884885-1-lukapanio@gmail.com?part=1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/6] dt-bindings: leds: backlight: Add Awinic AW99703 backlight
       [not found] ` <20261205005118.884885-3-lukapanio@gmail.com>
@ 2026-12-05  1:04   ` sashiko-bot
  2026-12-05  9:55   ` Andreas Kemnade
  1 sibling, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-05  1:04 UTC (permalink / raw)
  To: Luka Panio; +Cc: dri-devel, linux-leds, devicetree, robh, conor+dt, lee

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dt-bindings: leds: backlight: brightness properties after vendor
  properties
--

commit e73a777362909b5241688863c1637a75fd178b6d
Author: Luka Panio <lukapanio@gmail.com>

dt-bindings: leds: backlight: Add Awinic AW99703 backlight

This commit adds the Devicetree binding schema for the Awinic AW99703
3-channel WLED backlight driver and updates MAINTAINERS.

> diff --git a/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml
> new file mode 100644
> index 0000000000000..a08da356542ce
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml

[ ... ]

> +  awinic,pwm-input:
> +    description:
> +      The PWM input pin is connected and its duty cycle is combined with the
> +      brightness set over I2C.
> +    type: boolean
> +
> +  default-brightness:
> +    maximum: 2047
> +
> +  max-brightness:
> +    maximum: 2047

[Severity: Low]
Should default-brightness and max-brightness be placed before the
awinic,* vendor-specific properties?

Documentation/devicetree/bindings/writing-schema.rst follows the property
ordering in dts-coding-style.rst, which groups standard properties before
vendor-prefixed ones.  Moving these two common.yaml properties above
awinic,ovp-microvolt keeps the schema consistent with that convention.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205005118.884885-1-lukapanio@gmail.com?part=2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/6] backlight: aw99706: Enable the chip before reading its ID
       [not found] ` <20261205005118.884885-4-lukapanio@gmail.com>
@ 2026-12-05  1:05   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-05  1:05 UTC (permalink / raw)
  To: Luka Panio; +Cc: dri-devel, linux-leds, devicetree, robh, conor+dt, lee

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] backlight: aw99706: GPIOD_OUT_LOW causes HWEN low glitch in
  aw99706_probe()
--

commit 075b8a34b2576dc02fa570093a2f3e92820bbe54
Author: Luka Panio <lukapanio@gmail.com>

backlight: aw99706: Enable the chip before reading its ID

This commit moves the chip ID read in aw99706_probe() after requesting and
asserting the enable GPIO, and de-asserts the GPIO if subsequent probe steps
fail.

> diff --git a/drivers/video/backlight/aw99706.c b/drivers/video/backlight/aw99706.c
> index 43f82c83f91a3..c6b0d0122ad69 100644
> --- a/drivers/video/backlight/aw99706.c
> +++ b/drivers/video/backlight/aw99706.c
> @@ -389,11 +389,6 @@ static int aw99706_probe(struct i2c_client *client)
[ ... ]
>  	aw->hwen_gpio = devm_gpiod_get(aw->dev, "enable", GPIOD_OUT_LOW);
> @@ -401,23 +396,39 @@ static int aw99706_probe(struct i2c_client *client)
>  		return dev_err_probe(dev, PTR_ERR(aw->hwen_gpio),
>  				     "Failed to get enable gpio\n");
>  
> +	gpiod_set_value_cansleep(aw->hwen_gpio, 1);
> +
> +	ret = aw99706_chip_id_read(aw);

[Severity: Medium]
Does requesting aw->hwen_gpio with GPIOD_OUT_LOW and immediately asserting
it high glitch the enable line low before aw99706_chip_id_read()?

On boards where the bootloader already enabled the backlight, this low
pulse can reset the chip, causing display flicker or making
aw99706_chip_id_read() fail while the chip is resetting.  Requesting the
GPIO with GPIOD_OUT_HIGH instead would avoid the low pulse and remove the
redundant gpiod_set_value_cansleep() call.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205005118.884885-1-lukapanio@gmail.com?part=3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 6/6] backlight: aw99706: Add AW99703 support
       [not found] ` <20261205005118.884885-7-lukapanio@gmail.com>
@ 2026-12-05  1:11   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-05  1:11 UTC (permalink / raw)
  To: Luka Panio; +Cc: dri-devel, linux-leds, devicetree, robh, conor+dt, lee

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] backlight: aw99706: skip hwen_delay_us in aw99706_probe()
  without enable-gpios
- [Medium] backlight: aw99706: missing hwen_delay_us in
  aw99706_hw_init() on resume
- [Medium] backlight: aw99706: aw->bl_enable desynced when enable-gpios
  is omitted
--

commit 33423fef0e8fe321782e20dbb975455055809999
Author: Luka Panio <lukapanio@gmail.com>

backlight: aw99706: Add AW99703 support

This commit adds support for the Awinic AW99703 3-channel WLED backlight
driver to the aw99706 driver, including optional vin regulator and enable
GPIO handling, a label property, and an HWEN startup delay.

> diff --git a/drivers/video/backlight/aw99706.c b/drivers/video/backlight/aw99706.c
> index 5e0f8ccd3c88e..f898df0d4ed15 100644
> --- a/drivers/video/backlight/aw99706.c
> +++ b/drivers/video/backlight/aw99706.c

[ ... ]

> @@ -456,12 +611,19 @@ static int aw99706_probe(struct i2c_client *client)
>  
>  	aw99706_dt_parse(aw, &props);
>  
> -	aw->hwen_gpio = devm_gpiod_get(aw->dev, "enable", GPIOD_OUT_LOW);
> +	ret = devm_regulator_get_enable_optional(dev, "vin");
> +	if (ret < 0 && ret != -ENODEV)
> +		return dev_err_probe(dev, ret, "Failed to enable vin supply\n");
> +
> +	aw->hwen_gpio = devm_gpiod_get_optional(aw->dev, "enable",
> +						GPIOD_OUT_LOW);
>  	if (IS_ERR(aw->hwen_gpio))
>  		return dev_err_probe(dev, PTR_ERR(aw->hwen_gpio),
>  				     "Failed to get enable gpio\n");

[Severity: Medium]
Can aw->bl_enable get out of sync with the hardware when enable-gpios is
omitted?

Without an enable GPIO, probe neither resets the chip nor reads
chip->en_reg, so aw->bl_enable stays false even if the bootloader left the
backlight enabled.  A later aw99706_update_brightness(aw, 0) when blanking
the backlight then skips aw99706_bl_enable(aw, false), leaving the boost
converter active.  Initializing aw->bl_enable from chip->en_reg or issuing
a software reset when no enable GPIO is present would keep the cached state
aligned.

>  
>  	gpiod_set_value_cansleep(aw->hwen_gpio, 1);
> +	if (aw->hwen_gpio && aw->chip->hwen_delay_us)
> +		fsleep(aw->chip->hwen_delay_us);
>  
>  	ret = aw99706_chip_id_read(aw);

[Severity: Medium]
Should the hwen_delay_us wait also run when vin-supply powers the chip
without enable-gpios?

When HWEN is tied high to VIN and enable-gpios is omitted,
devm_regulator_get_enable_optional() enables the supply but aw->hwen_gpio
is NULL, so fsleep() is skipped.  aw99706_chip_id_read() then accesses the
chip before the 3.5 ms startup window completes, which can NACK over I2C
and fail probe with -ENODEV.

[Severity: Medium]
Does aw99706_hw_init() also need to wait aw->chip->hwen_delay_us after
asserting aw->hwen_gpio?

aw99706_resume() calls aw99706_hw_init() directly, which drives
aw->hwen_gpio high and immediately issues I2C writes for aw->init_tbl[].
If HWEN dropped low during suspend or hibernation, skipping the 3.5 ms
startup delay on AW99703 can cause those transfers to fail and leave the
backlight uninitialized after resume.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205005118.884885-1-lukapanio@gmail.com?part=6

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/6] dt-bindings: leds: backlight: Add Awinic AW99703 backlight
       [not found] ` <20261205005118.884885-3-lukapanio@gmail.com>
  2026-12-05  1:04   ` [PATCH v2 2/6] dt-bindings: leds: backlight: Add Awinic AW99703 backlight sashiko-bot
@ 2026-12-05  9:55   ` Andreas Kemnade
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Kemnade @ 2026-12-05  9:55 UTC (permalink / raw)
  To: Luka Panio
  Cc: lee, danielt, jingoohan1, pavel, robh, krzk+dt, conor+dt, deller,
	griffin, junjie.cao, mitltlatltl, dri-devel, linux-leds,
	devicetree, linux-fbdev, linux-kernel

On Sat,  5 Dec 2026 01:51:14 +0100
Luka Panio <lukapanio@gmail.com> wrote:

> The Awinic AW99703 is a 3-channel WLED driver with an integrated boost
> converter and 11-bit brightness control over I2C, optionally combined
> with a PWM input.
> 
> Signed-off-by: Luka Panio <lukapanio@gmail.com>
> ---
[...]
> +
> +  awinic,pwm-input:
> +    description:
> +      The PWM input pin is connected and its duty cycle is combined with the
> +      brightness set over I2C.
> +    type: boolean
> +
Hmm, shouln't this be a type object and a phandle for a pwm intput.
But no idea what is a sane way to translate brightness input into pwm
duty cycle and brightness register setting.
The driver can just ignore that for now.

Regards,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/6] backlight: aw99706: Add Awinic AW99703 support
       [not found] <20261205005118.884885-1-lukapanio@gmail.com>
                   ` (4 preceding siblings ...)
       [not found] ` <20261205005118.884885-7-lukapanio@gmail.com>
@ 2026-12-05 12:16 ` Andreas Kemnade
  5 siblings, 0 replies; 7+ messages in thread
From: Andreas Kemnade @ 2026-12-05 12:16 UTC (permalink / raw)
  To: Luka Panio
  Cc: lee, danielt, jingoohan1, pavel, robh, krzk+dt, conor+dt, deller,
	griffin, junjie.cao, mitltlatltl, dri-devel, linux-leds,
	devicetree, linux-fbdev, linux-kernel

On Sat,  5 Dec 2026 01:51:12 +0100
Luka Panio <lukapanio@gmail.com> wrote:

> The Awinic AW99703 is a 3-channel WLED driver with an integrated boost
> converter and 11-bit brightness control over I2C, used for the panel
> backlight of the Nexphone (QCM6490).
> 
A general word to the process here:
My devicetree has something like this:

&i2c1 {
        pinctrl-names = "default","sleep";
        pinctrl-0 = <&pinctrl_i2c1>;
        pinctrl-1 = <&pinctrl_i2c1_sleep>;
        clock-frequency = <100000>;
        status = "okay";

        /* backlight aw99703 at 0x36 */
};

The idea is to describe the hardware as good as possible, as well as indicating
a source of possible testes and helpers. I buy the device after having the
impression that I could do what I want to do with it. Then I put together things
and am happy if they compile and basically work. Then I replace drivers with
cleaner ones.

I am wondering if the process can be more automated to that comments like that
would lead to being automatically added in driver submissions.

> As suggested on v1, this version adds the AW99703 to the existing aw99706
> driver instead of adding a new one. The two chips share the programming
> model but have different register maps, so the driver is first converted
> to per-chip data. Following the binding review, the AW99703 binding uses
> the standard led-sources and led-max-microamp properties, and the
> AW99706 binding gains led-max-microamp as well, with the vendor
> awinic,iled-max-microamp property deprecated but still read.
> 
> Patch 3 is a fix for the existing driver: the chip ID was read before
> HWEN was asserted.
> 
> Andreas, your Kobo Clara 2e series [1] adds a separate aw99703 driver
> and binding for the same chip. Hopefully we can settle  on 1 driver,
> please test this driver and let me know if it works for you, or you
> have any other ideas.
> 
I added the led-sources property and tested:

Issues found:
- After booting I found that backlight in sysfs is set to 1023, but
  backlight is off. After a suspend resume
  cycle, backlight is on. Test was done from a minimal initramfs system without
  any userspace controlling the backlight
  Expected behaviour: brightness value in sysfs matches the hardware
  state and is the same before and after suspend.
- hwen/regulator stays on even when backlight is off 
  (can be solved after this series is in with a bit more thought)

Regards,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-05 12:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261205005118.884885-1-lukapanio@gmail.com>
     [not found] ` <20261205005118.884885-6-lukapanio@gmail.com>
2026-12-05  0:59   ` [PATCH v2 5/6] backlight: aw99706: Support the led-max-microamp property sashiko-bot
     [not found] ` <20261205005118.884885-2-lukapanio@gmail.com>
2026-12-05  1:01   ` [PATCH v2 1/6] dt-bindings: leds: backlight: aw99706: Use standard led-max-microamp sashiko-bot
     [not found] ` <20261205005118.884885-3-lukapanio@gmail.com>
2026-12-05  1:04   ` [PATCH v2 2/6] dt-bindings: leds: backlight: Add Awinic AW99703 backlight sashiko-bot
2026-12-05  9:55   ` Andreas Kemnade
     [not found] ` <20261205005118.884885-4-lukapanio@gmail.com>
2026-12-05  1:05   ` [PATCH v2 3/6] backlight: aw99706: Enable the chip before reading its ID sashiko-bot
     [not found] ` <20261205005118.884885-7-lukapanio@gmail.com>
2026-12-05  1:11   ` [PATCH v2 6/6] backlight: aw99706: Add AW99703 support sashiko-bot
2026-12-05 12:16 ` [PATCH v2 0/6] backlight: aw99706: Add Awinic " Andreas Kemnade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox