Replace the legacy Pandora backlight platform device with a
pwm-backlight device-tree node using TWL4030 PWM0.

Use the 64-cycle PWM frame and retain the experimentally determined
brightness table. Request full duty for a 10 ms startup guard before
normal PWM dimming begins. The TWL4030 64-cycle encoding limits the
actual duty to approximately 62/64, retaining short low intervals
during the TPS61161 mode-detection window.

Signed-off-by: H. Nikolaus Schaller <[email protected]>
---

Notes:
    Changes against V1:
    - Describe the 10 ms full-duty request and the actual TWL4030 output.
    - Brightness levels remain unchanged; duty is capped by the TWL4030
      PWM provider in 64-cycle mode (patch 09), not by patch 11.
    - Code and commit-message review assisted by ChatGPT.

 .../dts/ti/omap/omap3-pandora-common.dtsi     | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

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 {
+               compatible = "pwm-backlight";
+               pwms = <&twl_pwm 0 1922710>;
+               /*
+                * 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>;
+               /* TPS61161: cover startup mode-detection window (10 ms) */
+               pwm-enable-guard-period-us = <10000>;
+       };
+
        tv: connector {
                compatible = "connector-analog-tv";
                label = "tv";
@@ -505,6 +524,10 @@ MATRIX_KEY(7, 4, KEY_LEFTBRACE )
         >;
 };
 
+&twl_pwm {
+       ti,twl4030-pwm-frame-64;
+};
+
 /* backup battery charger */
 &charger {
        ti,bb-uvolt = <3200000>;
@@ -737,6 +760,8 @@ lcd: lcd@1 {
                reset-gpios = <&gpio5 29 GPIO_ACTIVE_LOW>;      /* GPIO_157 */
                vcc-supply = <&lcd_5v>;
 
+               backlight = <&backlight>;
+
                port {
                        lcd_in: endpoint {
                                remote-endpoint = <&dpi_out>;
-- 
2.56.0

Reply via email to