How to turn off/on backlight

Amigo
Hi all,
I m using qt-embedded-4.5.3 on my mini2440 with 3.5" LCD. 
I want to turn off LCD backlight for power management while my qt app is
running, after some period of time say 2 min.

Also , if someone taps on LCD , then backlight should turn on
automatically.

I saw /usr/bin/bl , Also , tried echo 0 > /dev/backlight but no use.

I also seen "backlight control" topic , but no clues.

Any suggestions?
Thanks in advance.

gene.sally
Hi,

I've twiddled with my kernel a little, so this may not work with your
configuration..  But, if your system contains this directory

/sys/devices/platform/s3c24xx_led.5/leds/backlight

You can do the following to turn off the backlight of the LCD

echo 0 > /sys/devices/platform/s3c24xx_led.5/leds/backlight/brightness

If the board doesn't have a sys file system (I can't recall of the boards
do by default), do the following to see if you can mount /sys somewhere

cat /proc/filesystems

if there's a line like this

nodev   sysfs

You can then do the following

mkdir -p /sys
mount -t sys none /sys

to get access to the to the
/sys/devices/platform/s3c24xx_led.5/leds/backlight/brightness file.  

Sorry if this doesn't work with your RFS, as I've made lots of changes to
mine and don't have the "shipping" RFS handy as a reference.

Regards,
gene

Amigo
Hi gene.sally ,
thank you very much for your solution.
It worked !!!!
thanks once again.

mso
On the default kernel there is no:

/sys/devices/platform/s3c24xx_led.5/leds/backlight

so two questions:

- how could I enable this in my kernel 

or

- how can I control it without this entry?? It must be possible, as the
demo application in qtopia does it, too! Is there any source available for
that???

gene.sally
>> ow could I enable this in my kernel 

This is in the sysfs file system. Check if you have it by doing the
following:

$ grep sysfs < /proc/filesystems

if you get this output:

nodev   sysfs

You can just do a 

mkdir /sys
mount -t sys none /sys

If there's no sysfs support, you'll need to rebuild the kernel with sysfs
and then mount this file system.  If you want to access this directly,
without sysfs, you'll need to write some code that changes the state of the
GPIO line that handles the backlight.  This is line 4 on gpio bank G, so
the call from the kernel would be

s3c2410_gpio_setpin(S3C2410_GPG(4), 0);

to turn off the backlight.  But you'll probably want to wrap that in a nice
interface that you can reach from userland by creating a simple driver.

Regards,
gene

Slampt
Hey All,

I tried compiling my kernel to get the support required to turn the
backlight LED off however i dont have /sys/devices/platform/s3c24xx_led.5 
I do have 

/sys/class/gpio
# ls
export       gpiochip128  gpiochip192  gpiochip32   gpiochip96
gpiochip0    gpiochip160  gpiochip224  gpiochip64   unexport
# 


But nothing I do changes the LEDs on board or on the LCD.

Any ideas?

I am running Linux buildroot 2.6.32.2-FriendlyARM #2 Fri Oct 8 17:44:42 WST
2010 armv4tl GNU/Linux

Slampt
Ok, 

Just an update for everyone, I found the support in the latest kernel
available at;

git://repo.or.cz/linux-2.6/mini2440.git

Linux buildroot 2.6.32-rc8 #1 Fri Oct 8 21:32:14 WST 2010 armv4tl GNU/Linux
Now does anyone know how you can get the screen to issue the 

echo "0" > /sys/devices/platform/s3c24xx_led.5/leds/backlight/brightness
when idle for x minutes

and

echo "1" > /sys/devices/platform/s3c24xx_led.5/leds/backlight/brightness
when you press the screen?

Cheers
Slampt