Posts: 11
Joined: Tue Jul 07, 2015 1:55 pm

Backlight control for LCD panel

Mon Jul 27, 2015 11:22 am

I am using a TFP401 based circuit to convert the HDMI output to LVDS for an LCD panel. This all works fine but I am wondering about backlight control. I have a GPIO setup to enable / disable it and one of the hardware PWMs setup for brightless contol. Using the wiringpi library, I have checked this all works.
It would be nice to integrate the backlight control into the kernel using either the gpio-backlight or (ideally) pwm-backlight modules.
I have not found an example device tree overlay for the pwm on RPI and am a little confused about it so decided to work with gpio-backlight for now and do the pwm later.
I have created this overlay :

Code: Select all

// Overlay for GPIO BACKLIGHT
// Compile with :
//  ../output/build/linux-rpi-4.0.y/scripts/dtc/dtc [email protected] -I dts -O dtb -o gpio-backlight-overlay.dtb gpio-backlight-overlay.dts


/ {
    compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";

  	// backlight device in /sys/class/backlight/gpio-backlight
	[email protected] {
		target-path = "/";
		__overlay__ {
			gpio-backlight {
				compatible = "gpio-backlight";
				gpios = <&gpio 40 1>;
				fb = <&fb>;
I had to fix gpio_backlight.c as here ... el/2151180 and re-compile the kernel.
Now, after adding the overlay to config.txt and modprobe gpio-backlight, I get /sys/class/backlight/gpio-backlight and I can control the backlight by writing to bl_power. So far so good.
There are two problems (possibly related) :
1 - The backlight defaults to OFF even though I have set default-on in the dts.
2 - Then after 10 minutes, the framebuffer console blanks as normal, but the backlight stays on. It seems that the backlight is not 'connected' to the frame buffer but I can't see any way of doing this other than adding fb = <&fb> to the overlay (which I did). Also, if I start Xfbdev (I am using buildroot) then xset s XX does nothing.
Does anyone have any advice ?
Ultimately, I can just count seconds in my application and blank using gpio writes etc. but it would be nicer to get it working properly if I can.

Return to “Compute Module”