Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8621

Advanced users • Re: Help: DPI Overlay for Sharp LS035Y8DX04A Not Loading / Backlight Brightness Control Issues

$
0
0
Hello Raspberry Pi community,

I'm working on a PWM backlight overlay for GPIO12 (BCM12) on a Raspberry Pi Zero and would appreciate your expertise in reviewing my implementation. I've referenced the official vc4-kms-dpi.dtsi from the Raspberry Pi Linux repository in my approach.

My Hardware Setup:

· Raspberry Pi Zero
· GPIO12 (BCM12) for PWM backlight control
· Standard LED/display backlight

Device Tree Overlay (backlight-gpio12.dts):

Code:

dts/dts-v1/;/plugin/;/ {    compatible = "brcm,bcm2835";    fragment@0 {        target = <&gpio>;        __overlay__ {            pwm_backlight_pins: pwm_backlight_pins {                brcm,pins = <12>;     // BCM GPIO12                brcm,function = <4>;  // ALT0 - PWM0                brcm,pull = <0>;      // No pull-up/down            };        };    };    fragment@1 {        target = <&pwm>;        __overlay__ {            pinctrl-names = "default";            pinctrl-0 = <&pwm_backlight_pins>;            assigned-clock-rates = <100000000>; // 100 MHz clock            status = "okay";        };    };    fragment@2 {        target-path = "/";        __overlay__ {            backlight: backlight {                compatible = "pwm-backlight";                pwms = <&pwm 0 1000000 0>; // Channel 0, 1ms period (1000Hz)                brightness-levels = <0 1 2 3 4 5 6 7 8 9 10                                     20 30 40 50 60 70 80 90 100>;                default-brightness-level = <80>;                status = "okay";            };        };    };    __overrides__ {        pin = <&pwm_backlight_pins>,"brcm,pins:0";        func = <&pwm_backlight_pins>,"brcm,function:0";        clock_rate = <&pwm>,"assigned-clock-rates:0";        frequency = <&backlight>,"pwms.0:8";        brightness = <&backlight>,"default-brightness-level:0";    };};
Implementation Steps:

1. Compilation:

Code:

   dtc -@ -I dts -O dtb -o backlight-gpio12.dtbo backlight-gpio12.dts   
2. Installation:

Code:

   sudo cp backlight-gpio12.dtbo /boot/overlays/   echo "dtoverlay=backlight-gpio12" | sudo tee -a /boot/config.txt   sudo reboot   
Current Results:

After reboot:

· Backlight device appears in /sys/class/backlight/backlight/
· I can read brightness values: cat /sys/class/backlight/backlight/max_brightness returns 100
· Writing values works: echo 50 > /sys/class/backlight/backlight/brightness

However, I'm not seeing actual PWM output on GPIO12.

Specific Questions:

1. Is the pin configuration correct for GPIO12?
· Using brcm,pins = <12> and brcm,function = <4> (ALT0)
· Should I use a different function value for PWM on GPIO12?
2. Is the PWM channel assignment correct?
· Using pwms = <&pwm 0 1000000 0> for PWM channel 0
· Does GPIO12 use PWM0 or PWM1?
3. Are there any compatibility issues with Raspberry Pi Zero?
· I noticed the Pi Zero has some PWM limitations compared to other models
4. Should I include additional properties from vc4-kms-dpi.dtsi?
· Such as power-supply references or enable-gpios?
5. Is the assigned-clock-rates property properly placed?
· I placed it in the pwm fragment based on other examples

Troubleshooting I've Done:

· Verified overlay compilation without errors
· Checked kernel messages: dmesg | grep -i backlight shows device creation
· Tested basic PWM functionality manually with wiringPi library
· Verified physical connections to GPIO12

References I've Used:

· Raspberry Pi Linux repository: vc4-kms-dpi.dtsi
· Raspberry Pi documentation on PWM and device trees
· Various forum posts and tutorials

I would greatly appreciate any guidance on whether this implementation is correct or what modifications might be needed to get PWM output working on GPIO12 for backlight control.

Thank you for your time and expertise!

Statistics: Posted by coolerboy — Mon Sep 08, 2025 8:18 am



Viewing all articles
Browse latest Browse all 8621

Trending Articles