Disable backlight on LCD

Started by Bas Los, February 11, 2014, 12:11:17 PM

Previous topic - Next topic

Bas Los

Hello,

For one of my project's I use a A13-LCD10TS. To reduce the amount of power needed, I'd like to turn off the backlight of the display. I discovered that PB2/PWM0/A14 is responsible for enabling the backlight. I'm using the standard debian Image. But I'd like to know how to control this in my python project with the A20_GPIO library, since it doesn't know this pin. Or is there an other option to turn of the backlight.

Thanks in advance.

Bas

dlombardo

It might be good for closure if somebody is searching for the same.

The LCD control of brightness and backlight power is possible on both legacy Kernel 3.4 and mainline Kernel 5.10 Debian 11 Bullseye images.

For dimming the LCD I have posted a solution in forum reply https://www.olimex.com/forum/index.php?topic=2862.0
Where also the final standby - turning off the LCD is described.

On Kernel 3.4 the monitor power is managed by GPIO and if GPIO is not enabled, then it must be enabled by setting the script.fex -> script.bin file.

On mainline Debian 11 Bullseye image I have managed to controll Display standby / power by either:
  • Disabling power-manager in XFCE and using xset dpms
  • Controlling GPIO by updating Device Tree
but the first option is less demanding and works great once you know what to do :)

For the later option of changing the Device Tree some notes for reference.

Initially Olimex overlay is using LCD enable GPIO in a way that it can not be controlled by setting its value.

Firstly we need to get the Device Tree source and Device Tree Compiler [dtc]
Tested in Ubuntu 18.04 and 20.04.


git clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/OLIMEX/olinuxino-overlays.git
sudo apt-get install device-tree-compiler

Setting up the Device Tree source
cd olinuxino-overlays/sun7i-a20/A20-OLinuXino-Micro
vi micro-lcd-olinuxino-10.dts
where reference to GPIO can be commented out and thus disables default control
enable-gpios = <&pio 7 8 0>;
change to
// Disabling for manual control (DL 20211014) enable-gpios = <&pio 7 8 0>;

Build only this Device tree (dont mind the warnings :o as default Olimex makefile builds with -q (quiet) anyways)
dtc -@ -I dts -O dtb -o micro-lcd-olinuxino-10.dtbo micro-lcd-olinuxino-10.dts

micro-lcd-olinuxino-10.dtbo: Warning (reg_format): "reg" property in /fragment@3/__overlay__/endpoint@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
micro-lcd-olinuxino-10.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
micro-lcd-olinuxino-10.dtbo: Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
micro-lcd-olinuxino-10.dtbo: Warning (unit_address_vs_reg): Node /fragment@2 has a unit name, but no reg property
micro-lcd-olinuxino-10.dtbo: Warning (unit_address_vs_reg): Node /fragment@3 has a unit name, but no reg property
micro-lcd-olinuxino-10.dtbo: Warning (pci_device_reg): Failed prerequisite 'reg_format'
micro-lcd-olinuxino-10.dtbo: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
micro-lcd-olinuxino-10.dtbo: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
micro-lcd-olinuxino-10.dtbo: Warning (avoid_default_addr_size): Relying on default #address-cells value for /fragment@3/__overlay__/endpoint@0
micro-lcd-olinuxino-10.dtbo: Warning (avoid_default_addr_size): Relying on default #size-cells value for /fragment@3/__overlay__/endpoint@0
micro-lcd-olinuxino-10.dtbo: Warning (pwms_property): Property 'pwms', cell 2 is not a phandle reference in /fragment@0/__overlay__/backlight
micro-lcd-olinuxino-10.dtbo: Warning (pwms_property): Could not get phandle node for /fragment@0/__overlay__/backlight:pwms(cell 2)

and upload to the A20
scp micro-lcd-olinuxino-10.dtbo root@192.168.2.105:/usr/lib/olinuxino-overlays/sun7i-a20/micro-lcd-olinuxino-10.dtbo

After reboot, the LCD only blinks (as usually) but then does not turn on anymore.

Review of reserved GPIO shows the GPIO is free to use
cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-287, parent: platform/1c20800.pinctrl, 1c20800.pinctrl:
 gpio-40  (                    |ahci-5v             ) out hi
 gpio-41  (                    |usb0-vbus           ) out lo
 gpio-225 (                    |cd                  ) in  lo IRQ ACTIVE LOW
 gpio-226 (                    |a20-olinuxino-micro:) out hi
 gpio-227 (                    |usb2-vbus           ) out hi
 gpio-228 (                    |usb0_id_det         ) in  hi IRQ
 gpio-229 (                    |usb0_vbus_det       ) in  lo IRQ
 gpio-230 (                    |usb1-vbus           ) out hi
 gpio-235 (                    |cd                  ) in  hi IRQ ACTIVE LOW

gpiochip1: GPIOs 413-415, parent: platform/axp20x-gpio, axp20x-gpio, can sleep:

Manual control of the LCD power is then available using standard GPIO control
# INIT
echo 232 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio232/direction

# TURN ON
echo 1 > /sys/class/gpio/gpio232/value

# Control Brightness
echo 10 > /sys/class/backlight/backlight/brightness

# TURN OFF
echo 0 > /sys/class/gpio/gpio232/value