We are migrating to mainline and leaving the old 3.x kernel behind.
How can we turn off the lcd backlight (using the LVDS interface)?
This is what we used on old kernel:
```
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <string.h>
#include <asm/types.h>
#include "sunxi_disp_ioctl.h"
int
main(int argc, char *argv[])
{
int fd = open("/dev/disp", O_RDWR);
int ret, tmp, width, height;
if (fd == -1) {
fprintf(stderr, "Error: Failed to open /dev/disp: %s\n",
strerror(errno));
return errno;
}
tmp = 0;
ret = ioctl(fd, DISP_CMD_LCD_OFF, &tmp);
if (ret != 0) {
printf("Warning: LCD OFF failed\n");
} else {
printf("Warning: LCD OFF succeeded\n");
}
return 0;
}
```
Maybe use directly devmem2 and registers? Check this post:
https://www.olimex.com/forum/index.php?topic=8572.msg32849#msg32849
Thanks for the answer, however i do not know where these numbers come from.
Can you please link some documentation where i can get answers?
I am guessing a kernel driver should exists which exports these functions to userspace?
like echo 1 > /dev/lvds_backlight
I would rather limit my executable, not to be able to write to physical memory directly.
As you can check, things like 0x01C20824 are from the datasheet.
John
Maybe off topic as I have no experience with LVDS monitors.
For Olimex LCD I am using
Old 3.x kernel images
Backlight pwm control works with values 20 to 100 in file
/sys/class/pwm-sunxi/pwm0/duty_percent
Values below 20 do not work.
To completely turn off the backlight set GPIO to 0 in
/sys/class/gpio/gpio58_ph8/value
To turn on set GPIO to 1.
New 5.x Mainline images
Backlight can be set from 1 to 10 (100%) in file
/sys/class/backlight/backlight/brightness
Value 0 resets to 10.
To turn monitor off with GPIO set to 0 in
/sys/class/gpio/gpio232/value
To turn monitor on with GPIO set to 1.