This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM625: Rquest Enable and Control BackLight DTS

Part Number: AM625

Tool/software:

Dear  TI 

My custom board is simiilar to E3 and I am using SDK 9.0.

We face difficulty to light up our LCD backlight and control PWM (brightness). 

According to our custom board schematic, and I referred to this thread, e2e.ti.com/.../am625-use-gpio0_33-as-pwm-for-display-backlight-on-custom-am625-som

I define the DTS, but it does not work. Please help to provide us the dts. Thanks.

modification_backlight.txt
diff --git a/arch/arm64/boot/dts/ti/k3-am62-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62-main.dtsi
index 74e34b84419a..048d96cfd1a2 100644
--- a/arch/arm64/boot/dts/ti/k3-am62-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62-main.dtsi
@@ -581,7 +581,7 @@
 		ti,itap-del-sel-sdr12 = <0xa>;
 		ti,itap-del-sel-sdr25 = <0x1>;
 		ti,clkbuf-sel = <0x7>;
-		bus-width = <4>;
+		bus-width = <1>;
 		status = "disabled";
 	};
 
diff --git a/arch/arm64/boot/dts/ti/k3-am625-sk.dts b/arch/arm64/boot/dts/ti/k3-am625-sk.dts
index b1737978103b..486ba5b16145 100644
--- a/arch/arm64/boot/dts/ti/k3-am625-sk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am625-sk.dts
@@ -28,7 +28,19 @@
 		reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
 
 	};
-
+	
+	backlight_lvds: backlight-lvds {
+                compatible = "pwm-backlight";
+
+                led0 {
+                        pwms = <&epwm0 0 50000 1>;
+                        brightness-levels = <0 4 8 16 32 64 128 255>;
+			default-brightness-level = <32>;
+                        linux,default-trigger = "default-on";
+			status = "okay";
+                };
+        };
+        
 	vmain_pd: regulator-0 {
 		/* TPS65988 PD CONTROLLER OUTPUT */
 		compatible = "regulator-fixed";
@@ -68,9 +80,10 @@
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 		regulator-boot-on;
-		enable-active-high;
+		/* enable-active-high; */
 		vin-supply = <&vcc_3v3_sys>;
-		gpio = <&exp1 3 GPIO_ACTIVE_HIGH>;
+		regulator-always-on; 
+		/* gpio = <&exp1 3 GPIO_ACTIVE_HIGH>; */
 	};
 
 	vdd_sd_dv: regulator-4 {
@@ -82,7 +95,8 @@
 		regulator-min-microvolt = <1800000>;
 		regulator-max-microvolt = <3300000>;
 		regulator-boot-on;
-		vin-supply = <&vcc_5v0>;
+		regulator-always-on;
+		vin-supply = <&vcc_3v3_sys>;
 		gpios = <&main_gpio0 31 GPIO_ACTIVE_HIGH>;
 		states = <1800000 0x0>,
 			 <3300000 0x1>;
@@ -191,6 +205,18 @@
 			AM62X_IOPAD(0x128, PIN_INPUT, 7) /* (B23) MMC2_SDWP.GPIO0_72 */
 		>;
 	};
+
+	epwm0bl_pins_default: epwm0bl-default-pins {
+                pinctrl-single,pins = <
+                        AM62X_IOPAD(0x01b4, PIN_OUTPUT_PULLUP, 2) /* (A13) SPI0_CS0.EHRPWM0_A */
+                >;
+        };
+};
+
+&epwm0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&epwm0bl_pins_default>;
+	status = "okay";
 };
 
 &main_i2c1 {
@@ -223,6 +249,7 @@
 };
 
 &sdhci1 {
+	status = "okay";
 	vmmc-supply = <&vdd_mmc1>;
 	vqmmc-supply = <&vdd_sd_dv>;
 };

HW_Schematic_BackLight .pdf

  • Hello,

    Are you getting any useful output on the terminal about the backlight driver?

    Is the backlight turning on at all? Are you able to see a PWM waveform on the pins? Do you see a difference if, for example, you change the default-brightness-level to 255 or 0?

    Regards,

    Nick

  • Hello Nick, 

    Thank for your support.

    I try to change brightness but it does not work.

    Firstly, may you help to review my dts; it is a correct setting? Thanks.

    My current dts setting's reproduce below result:

    root@am62xx-evm:/sys/class/backlight/backlight-lvds# echo 1 > bl_power
    root@am62xx-evm:/sys/class/backlight/backlight-lvds# echo 0 > bl_power
    root@am62xx-evm:/sys/class/backlight/backlight-lvds# cat max_brightness
    8
    root@am62xx-evm:/sys/class/backlight/backlight-lvds# cat brightness
    7
    root@am62xx-evm:/sys/class/backlight/backlight-lvds# echo 0 > brightness
    root@am62xx-evm:/sys/class/backlight/backlight-lvds# echo 255 > brightness
    root@am62xx-evm:/sys/class/pwm# ls
    pwmchip0
    root@am62xx-evm:/sys/class/pwm# cd pwmchip0
    root@am62xx-evm:/sys/class/pwm/pwmchip0# ls
    device export npwm power subsystem uevent unexport
    root@am62xx-evm:/sys/class/pwm/pwmchip0# echo 0 > /sys/class/pwm/pwmchip0/export
    -sh: echo: write error: Device or resource busy
    root@am62xx-evm:/sys/class/pwm/pwmchip0# echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
    -sh: /sys/class/pwm/pwmchip0/pwm0/enable: No such file or directory

  • Hello Paul,

    I am only going to be able to provide limited support from a "devicetree analysis" standpoint. What I can do is point you to other devicetree files where a PWM backlight is used, and you can compare your code against the code other people have written:

    arch/arm64/boot/dts/ti$ grep -r "backlight"
    k3-am625-beagleplay-lincolntech-lcd185-panel.dtso:      backlight: backlight {
    k3-am625-beagleplay-lincolntech-lcd185-panel.dtso:              compatible = "pwm-backlight";
    k3-am625-beagleplay-lincolntech-lcd185-panel.dtso:              pinctrl-0 = <&backlight_pins_default>;
    k3-am625-beagleplay-lincolntech-lcd185-panel.dtso:              backlight = <&backlight>;
    k3-am625-beagleplay.dts:        backlight_pins_default: bl-pins-default {
    k3-am654-evm-oldi-lcd1evm.dtso:         backlight = <&lcd_bl>;
    k3-am654-evm-oldi-lcd1evm.dtso: lcd_bl: backlight {
    k3-am654-evm-oldi-lcd1evm.dtso:         compatible = "pwm-backlight";
    k3-j721e-beagleboneai64-dsi-rpi-7inch-panel.dtso:               backlight = <&display_reg>;
    k3-am62p5-sk-dsi-rpi-7inch-panel.dtso:          backlight = <&display_reg>;
    k3-j722s-evm-dsi-rpi-7inch-panel.dtso:          backlight = <&display_reg>;
    

    The LED entry seems suspicious, I don't see anyone else mixing LEDs with PWM backlight. But I haven't done a deep dive into your code.

    What about in your terminal output? Do you see any error outputs or other information with this?
    dmesg | backlight

    Regards,

    Nick

  • Hello Nick

    Thank for your info and guide. We fix this issue after modifying DTS.

  • Hello Paul,

    I am glad to hear that you were able to get the backlight working! Feel free to create a new thread if you have any questions in the future.

    Regards,

    Nick