A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Agptek Rocker: Implement lcd_enable()

In theory this should slightly improve battery life.

Change-Id: Iaf55beb7dbc20e7562017958aeb0386459d49a31

+34 -2
+1
firmware/SOURCES
··· 114 114 #endif 115 115 116 116 #if defined(AGPTEK_ROCKER) && !defined(SIMULATOR) 117 + drivers/lcd-memframe.c 117 118 target/hosted/backtrace-glibc.c 118 119 target/hosted/kernel-unix.c 119 120 target/hosted/filesystem-unix.c
+3 -1
firmware/export/config/agptekrocker.h
··· 23 23 /* define this if you have a colour LCD */ 24 24 #define HAVE_LCD_COLOR 25 25 26 + #define HAVE_LCD_ENABLE 27 + 26 28 /* Define this if the LCD can shut down */ 27 - //#define HAVE_LCD_SHUTDOWN 29 + #define HAVE_LCD_SHUTDOWN 28 30 29 31 /* define this if you want album art for this target */ 30 32 #define HAVE_ALBUMART
+25
firmware/target/hosted/agptek/lcd-agptek.c
··· 29 29 #include "lcd.h" 30 30 #include "lcd-target.h" 31 31 #include "backlight-target.h" 32 + #include "sysfs.h" 32 33 #include "panic.h" 33 34 34 35 static int fd = -1; ··· 72 73 if((void *)framebuffer == MAP_FAILED) 73 74 { 74 75 panicf("Cannot map framebuffer"); 76 + } 77 + } 78 + 79 + #ifdef HAVE_LCD_SHUTDOWN 80 + void lcd_shutdown(void) 81 + { 82 + munmap(framebuffer, FRAMEBUFFER_SIZE); 83 + close(fd); 84 + } 85 + #endif 86 + 87 + void lcd_enable(bool on) 88 + { 89 + const char * const sysfs_fb_blank = "/sys/class/graphics/fb0/blank"; 90 + 91 + if (lcd_active() != on) 92 + { 93 + sysfs_set_int(sysfs_fb_blank, on ? 0 : 1); 94 + lcd_set_active(on); 95 + 96 + if (on) 97 + { 98 + send_event(LCD_EVENT_ACTIVATION, NULL); 99 + } 75 100 } 76 101 } 77 102
+5 -1
firmware/target/hosted/agptek/lcd-target.h
··· 21 21 #ifndef __LCD_TARGET_H__ 22 22 #define __LCD_TARGET_H__ 23 23 24 - extern fb_data *framebuffer; /* see lcd-nwz.c */ 24 + /* Agptek needs special ioctl() to redraw updated framebuffer content */ 25 + #define LCD_OPTIMIZED_UPDATE 26 + #define LCD_OPTIMIZED_UPDATE_RECT 27 + 28 + extern fb_data *framebuffer; /* see lcd-agptek.c */ 25 29 #define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col)) 26 30 #endif /* __LCD_TARGET_H__ */