Agptek Rocker: Implement lcd_enable()

In theory this should slightly improve battery life.

Change-Id: Iaf55beb7dbc20e7562017958aeb0386459d49a31
This commit is contained in:
Marcin Bukat 2018-06-14 10:03:07 +02:00
parent 755b824596
commit 5c015ada90
4 changed files with 34 additions and 2 deletions

View file

@ -114,6 +114,7 @@ target/hosted/sonynwz/nwz-db.c
#endif
#if defined(AGPTEK_ROCKER) && !defined(SIMULATOR)
drivers/lcd-memframe.c
target/hosted/backtrace-glibc.c
target/hosted/kernel-unix.c
target/hosted/filesystem-unix.c

View file

@ -23,8 +23,10 @@
/* define this if you have a colour LCD */
#define HAVE_LCD_COLOR
#define HAVE_LCD_ENABLE
/* Define this if the LCD can shut down */
//#define HAVE_LCD_SHUTDOWN
#define HAVE_LCD_SHUTDOWN
/* define this if you want album art for this target */
#define HAVE_ALBUMART

View file

@ -29,6 +29,7 @@
#include "lcd.h"
#include "lcd-target.h"
#include "backlight-target.h"
#include "sysfs.h"
#include "panic.h"
static int fd = -1;
@ -75,6 +76,30 @@ void lcd_init_device(void)
}
}
#ifdef HAVE_LCD_SHUTDOWN
void lcd_shutdown(void)
{
munmap(framebuffer, FRAMEBUFFER_SIZE);
close(fd);
}
#endif
void lcd_enable(bool on)
{
const char * const sysfs_fb_blank = "/sys/class/graphics/fb0/blank";
if (lcd_active() != on)
{
sysfs_set_int(sysfs_fb_blank, on ? 0 : 1);
lcd_set_active(on);
if (on)
{
send_event(LCD_EVENT_ACTIVATION, NULL);
}
}
}
static void redraw(void)
{
ioctl(fd, FBIOPAN_DISPLAY, &vinfo);

View file

@ -21,6 +21,10 @@
#ifndef __LCD_TARGET_H__
#define __LCD_TARGET_H__
extern fb_data *framebuffer; /* see lcd-nwz.c */
/* Agptek needs special ioctl() to redraw updated framebuffer content */
#define LCD_OPTIMIZED_UPDATE
#define LCD_OPTIMIZED_UPDATE_RECT
extern fb_data *framebuffer; /* see lcd-agptek.c */
#define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col))
#endif /* __LCD_TARGET_H__ */