LCD Backlight GPIO PWM

Started by Morzilla, September 21, 2013, 09:07:40 PM

Previous topic - Next topic


Hello! This is my second post today :D

I've another problem with the Olinuxino A10S and the 4,3" LCD+TS. I created a powersaving script that turn off the power to the backlight if in 60 seconds there ins't any input from the user (I check the /dev/event/inputX, that is the TouchScreen device, for a finger touch, and write "1" or "0" in /sys/devices/virtual/misc/sun4i-gpio/pin/pb2 to poweroff or poweron the display).

What I would like to do is gradually decrease the backlight of the LCD until it completely power off.
How can I do this thing?
Maybe with PWM signal on GPIO PB2 Pin that control the backlight?



I'm sorry, I wrote wrong things in previous post...The script for power-off the backlight is working correctly in A13, but not in A10S, because there isn't the /sys/devices/virtual/misc/sun4i-gpio/pin/pb2 (there are other gpio pins). I loaded the sun4i-gpio correct?



Ok, I've done!
I added this line in the fex file:

gpio_used = 1
gpio_num = 30
gpio_pin_30 = port:PB02<1><default><default><0>

pin_30 = port:PB02<1><default><default><0>

I compiled the fex in script.bin with fex2bin binary and now I can power-off and power-on the LCD with the command above (with sun4i-gpio kernel module)


Now I'm using gpio-sunxi module instead of sun4i-gpio: for its initialization, I need to do those commands:

echo 30 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio21_pe3/direction

and now I'm ready to read/write the value of GPIO Pin with

cat/echo /sys/class/gpio/gpio21_pe3/value