From: sashiko-bot@kernel.org
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org,
linux-sound@vger.kernel.org, robh@kernel.org,
conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v2 18/20] ARM: dts: omap3pandora: Switch backlight to PWM
Date: Tue, 24 Nov 2026 07:46:12 +0000 [thread overview]
Message-ID: <sashiko-outbox-230669@kernel.org> (raw)
In-Reply-To: <40321eb9223453f39536092d7095d3eff9901188.1795505160.git.hns@goldelico.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] ARM: dts: omap3pandora: default brightness 11 overflows
64-cycle TWL4030 PWM
- [Medium] ARM: dts: omap3pandora: PWM0 stays enabled and pulsing when
brightness is 0
- [Low] ARM: dts: omap3pandora: non-generic node name pwm-backlight used
for backlight
--
commit f1da995614fb9b1711442126ec6e32081ef0bd39
Author: H. Nikolaus Schaller <hns@goldelico.com>
ARM: dts: omap3pandora: Switch backlight to PWM
This commit adds a pwm-backlight devicetree node using TWL4030 PWM0 in
64-cycle mode and attaches it to the Pandora LCD node.
> diff --git a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
> index a5633d93547a3..6bdfbd80b9fcd 100644
> --- a/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
> +++ b/arch/arm/boot/dts/ti/omap/omap3-pandora-common.dtsi
> @@ -53,6 +53,25 @@ lcd_5v: fixed-regulator-lcd-5v {
> vin-supply = <&aux_5v>; /* logical enable dependency */
> };
>
> + backlight: pwm-backlight {
[Severity: Low]
This isn't a bug, but the Devicetree Specification and pwm-backlight
binding expect the generic node name "backlight" rather than
"pwm-backlight".
> + compatible = "pwm-backlight";
> + pwms = <&twl_pwm 0 1922710>;
[Severity: Medium]
Does this leave TWL4030 PWM0 enabled and pulsing when brightness is set to
0?
Because this node defines neither power-supply nor enable-gpios,
pwm_backlight_update_status() sets state.enabled = true even at brightness
0:
drivers/video/backlight/pwm_bl.c:pwm_backlight_update_status() {
...
pwm_get_state(pb->pwm, &state);
state.duty_cycle = 0;
state.enabled = !pb->power_supply && !pb->enable_gpio;
pwm_apply_might_sleep(pb->pwm, &state);
...
}
In twl_pwm_config(), duty_ns = 0 maps duty_cycle = 1 to 2 (ON = 1, OFF =
2), so twl4030_pwm_apply() keeps PWM0 and its clock enabled and drives a
continuous 1/64 pulse train on the TPS61161 CTRL pin instead of disabling
PWM0 to hold CTRL low as the legacy pandora_bl driver did.
> + /*
> + * TPS61161 analog dimming window: duty must stay above
> + * ~20-25 % (below that the regulator drops out, LED off)
> + * and the startup waveform must avoid long low intervals
> + * that could trigger EasyScale detection. The enable guard
> + * requests full duty; TWL4030 limits it to about 62/64.
> + * These levels were determined experimentally.
> + */
> + brightness-levels = <
> + 0 24 30 36 42 49 58 68 80 94 110 129 255
> + >;
> + default-brightness-level = <11>;
[Severity: High]
Does default-brightness-level = <11> overflow the 64-cycle TWL4030 PWM
counter and turn the backlight off after the 10 ms startup guard?
The table maximum is 255, so index 11 (level 129) requests duty_ns =
(129 * 1922710) / 255 = 972665 ns (~50.6% of period_ns). However,
twl_pwm_config() scales duty_ns by TWL_PWM_MAX (127) and clamps against
TWL_PWM_MAX even when frame_64 is enabled:
drivers/pwm/pwm-twl.c:twl_pwm_config() {
int duty_cycle = DIV64_U64_ROUND_UP(duty_ns * TWL_PWM_MAX, period_ns) + 1;
...
if (frame_64 && duty_cycle > TWL_PWM_MAX)
duty_cycle = TWL_PWM_MAX;
}
For duty_ns = 972665 ns, duty_cycle is 65 + 1 = 66 (0x42), which is not
clamped and writes 66 to PWM0_OFF. In 64-cycle mode the 6-bit counter
wraps 66 to OFF = 2 (with ON = 1), producing a 1/64 (1.56%) duty cycle
that falls below the TPS61161 ~20-25% dropout threshold. In addition,
because levels 1..11 (24..129) sit on a 0..255 scale to compensate for the
127 multiplier in twl_pwm_config(), levels 1..4 request 9.4%..16.5% duty
cycles from pwm-backlight (below the ~20-25% TPS61161 threshold noted in
the comment), and both levels 11 (129) and 12 (255) exceed the 64-cycle
counter limit.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795505160.git.hns@goldelico.com?part=18
next prev parent reply other threads:[~2026-11-24 7:46 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 7:25 [PATCH v2 00/20] ARM: omap3: pandora: Modernize audio and backlight to use Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 01/20] dt-bindings: gpio: twl4030: Document REGEN GPIO H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 02/20] gpio: twl4030: Support " H. Nikolaus Schaller
2026-11-24 7:43 ` sashiko-bot
2026-11-24 7:25 ` [PATCH v2 03/20] ASoC: twl4030: Allow APLL rate selection through set_sysclk() H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 04/20] dt-bindings: sound: pcm1754: Describe PCM1773 H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 05/20] ASoC: codecs: pcm1754: Add PCM1773 support H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 06/20] dt-bindings: sound: Document OpenPandora sound card H. Nikolaus Schaller
2026-11-24 7:40 ` sashiko-bot
2026-11-24 7:25 ` [PATCH v2 07/20] ASoC: ti: omap3pandora: Convert sound card to DT H. Nikolaus Schaller
2026-11-24 7:45 ` sashiko-bot
2026-11-24 7:25 ` [PATCH v2 08/20] dt-bindings: mfd: twl4030: Document 64-cycle PWM H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 09/20] pwm: twl: Support 64-cycle PWM frame H. Nikolaus Schaller
2026-11-24 7:37 ` sashiko-bot
2026-11-24 7:25 ` [PATCH v2 10/20] dt-bindings: backlight: pwm: Document enable guard H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 11/20] backlight: pwm: Support enable guard period H. Nikolaus Schaller
2026-11-24 7:36 ` sashiko-bot
2026-11-24 7:25 ` [PATCH v2 12/20] drm/panel: td043mtea1: Attach DT backlight H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 13/20] ARM: dts: omap3pandora: Disable unused DMA channels H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 14/20] ARM: dts: omap3-pandora: Model LCD power enable dependencies H. Nikolaus Schaller
2026-11-24 7:45 ` sashiko-bot
2026-11-24 7:25 ` [PATCH v2 15/20] ARM: dts: omap3pandora: Enable audio interfaces H. Nikolaus Schaller
2026-11-24 7:25 ` [PATCH v2 16/20] ARM: dts: omap3pandora: Describe PCM1773 H. Nikolaus Schaller
2026-11-24 7:40 ` sashiko-bot
2026-11-24 7:25 ` [PATCH v2 17/20] ARM: dts: omap3pandora: Describe sound card H. Nikolaus Schaller
2026-11-24 7:47 ` sashiko-bot
2026-11-24 7:25 ` [PATCH v2 18/20] ARM: dts: omap3pandora: Switch backlight to PWM H. Nikolaus Schaller
2026-11-24 7:46 ` sashiko-bot [this message]
2026-11-24 7:25 ` [PATCH v2 19/20] backlight: Remove legacy Pandora driver H. Nikolaus Schaller
2026-11-24 7:26 ` [PATCH v2 20/20] ARM: OMAP2+: Remove Pandora platform-data quirks H. Nikolaus Schaller
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-230669@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hns@goldelico.com \
--cc=lee@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=robh@kernel.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