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 #endif 115 116 #if defined(AGPTEK_ROCKER) && !defined(SIMULATOR) 117 target/hosted/backtrace-glibc.c 118 target/hosted/kernel-unix.c 119 target/hosted/filesystem-unix.c
··· 114 #endif 115 116 #if defined(AGPTEK_ROCKER) && !defined(SIMULATOR) 117 + drivers/lcd-memframe.c 118 target/hosted/backtrace-glibc.c 119 target/hosted/kernel-unix.c 120 target/hosted/filesystem-unix.c
+3 -1
firmware/export/config/agptekrocker.h
··· 23 /* define this if you have a colour LCD */ 24 #define HAVE_LCD_COLOR 25 26 /* Define this if the LCD can shut down */ 27 - //#define HAVE_LCD_SHUTDOWN 28 29 /* define this if you want album art for this target */ 30 #define HAVE_ALBUMART
··· 23 /* define this if you have a colour LCD */ 24 #define HAVE_LCD_COLOR 25 26 + #define HAVE_LCD_ENABLE 27 + 28 /* Define this if the LCD can shut down */ 29 + #define HAVE_LCD_SHUTDOWN 30 31 /* define this if you want album art for this target */ 32 #define HAVE_ALBUMART
+25
firmware/target/hosted/agptek/lcd-agptek.c
··· 29 #include "lcd.h" 30 #include "lcd-target.h" 31 #include "backlight-target.h" 32 #include "panic.h" 33 34 static int fd = -1; ··· 72 if((void *)framebuffer == MAP_FAILED) 73 { 74 panicf("Cannot map framebuffer"); 75 } 76 } 77
··· 29 #include "lcd.h" 30 #include "lcd-target.h" 31 #include "backlight-target.h" 32 + #include "sysfs.h" 33 #include "panic.h" 34 35 static int fd = -1; ··· 73 if((void *)framebuffer == MAP_FAILED) 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 + } 100 } 101 } 102
+5 -1
firmware/target/hosted/agptek/lcd-target.h
··· 21 #ifndef __LCD_TARGET_H__ 22 #define __LCD_TARGET_H__ 23 24 - extern fb_data *framebuffer; /* see lcd-nwz.c */ 25 #define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col)) 26 #endif /* __LCD_TARGET_H__ */
··· 21 #ifndef __LCD_TARGET_H__ 22 #define __LCD_TARGET_H__ 23 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 */ 29 #define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col)) 30 #endif /* __LCD_TARGET_H__ */