From 5c015ada908d491fa2f9fa37b83e3fc9c56b4d86 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Thu, 14 Jun 2018 10:03:07 +0200 Subject: Agptek Rocker: Implement lcd_enable() In theory this should slightly improve battery life. Change-Id: Iaf55beb7dbc20e7562017958aeb0386459d49a31 --- firmware/target/hosted/agptek/lcd-agptek.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'firmware/target/hosted/agptek/lcd-agptek.c') diff --git a/firmware/target/hosted/agptek/lcd-agptek.c b/firmware/target/hosted/agptek/lcd-agptek.c index abf89ea9e3..ff5a8146a2 100644 --- a/firmware/target/hosted/agptek/lcd-agptek.c +++ b/firmware/target/hosted/agptek/lcd-agptek.c @@ -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); -- cgit v1.2.3