hosted: Fix overzealous spamming of backlight and lcd enable
This caused random delays in LCD activity, and also caused key inputs to go nuts Change-Id: Ie483c86f7461455308f8c5f8999df313521c6b55
This commit is contained in:
parent
f4f3255edf
commit
9ee618e889
2 changed files with 27 additions and 10 deletions
|
@ -44,20 +44,28 @@ bool backlight_hw_init(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int last_bl = -1;
|
||||||
|
|
||||||
void backlight_hw_on(void)
|
void backlight_hw_on(void)
|
||||||
{
|
{
|
||||||
|
if (last_bl != 1) {
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true);
|
lcd_enable(true);
|
||||||
#endif
|
#endif
|
||||||
sysfs_set_int(sysfs_bl_power, 0);
|
sysfs_set_int(sysfs_bl_power, 0);
|
||||||
|
last_bl = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_hw_off(void)
|
void backlight_hw_off(void)
|
||||||
{
|
{
|
||||||
|
if (last_bl != 0) {
|
||||||
sysfs_set_int(sysfs_bl_power, 1);
|
sysfs_set_int(sysfs_bl_power, 1);
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false);
|
lcd_enable(false);
|
||||||
#endif
|
#endif
|
||||||
|
last_bl = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_hw_brightness(int brightness)
|
void backlight_hw_brightness(int brightness)
|
||||||
|
|
|
@ -53,17 +53,17 @@ void lcd_init_device(void)
|
||||||
panicf("Cannot open framebuffer: %s\n", fb_dev);
|
panicf("Cannot open framebuffer: %s\n", fb_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fcntl( fd, F_SETFD, FD_CLOEXEC ) < 0)
|
||||||
|
{
|
||||||
|
panicf("Can't set CLOEXEC");
|
||||||
|
}
|
||||||
|
|
||||||
/* get fixed and variable information */
|
/* get fixed and variable information */
|
||||||
if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0)
|
if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0)
|
||||||
{
|
{
|
||||||
panicf("Cannot read framebuffer fixed information");
|
panicf("Cannot read framebuffer fixed information");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
|
|
||||||
{
|
|
||||||
panicf("Cannot read framebuffer variable information");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* check resolution and framebuffer size */
|
/* check resolution and framebuffer size */
|
||||||
if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH)
|
if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH)
|
||||||
|
@ -76,12 +76,17 @@ void lcd_init_device(void)
|
||||||
* values returned by the driver for line_length */
|
* values returned by the driver for line_length */
|
||||||
|
|
||||||
/* map framebuffer */
|
/* map framebuffer */
|
||||||
framebuffer = mmap(0, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
framebuffer = mmap(NULL, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
if((void *)framebuffer == MAP_FAILED)
|
if((void *)framebuffer == MAP_FAILED)
|
||||||
{
|
{
|
||||||
panicf("Cannot map framebuffer");
|
panicf("Cannot map framebuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
|
||||||
|
{
|
||||||
|
panicf("Cannot read framebuffer variable information");
|
||||||
|
}
|
||||||
|
|
||||||
memset(framebuffer, 0, finfo.smem_len);
|
memset(framebuffer, 0, finfo.smem_len);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
|
@ -104,7 +109,11 @@ void lcd_enable(bool on)
|
||||||
{
|
{
|
||||||
if (fd < 0) return;
|
if (fd < 0) return;
|
||||||
|
|
||||||
|
if (lcd_active() == on)
|
||||||
|
return;
|
||||||
|
|
||||||
lcd_set_active(on);
|
lcd_set_active(on);
|
||||||
|
|
||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
send_event(LCD_EVENT_ACTIVATION, NULL);
|
send_event(LCD_EVENT_ACTIVATION, NULL);
|
||||||
|
|
Loading…
Reference in a new issue