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 <[email protected]> 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/[email protected]?part=18
