summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Leonhardt <sebastian.leonhardt@web.de>2016-06-25 15:25:30 +0200
committerSebastian Leonhardt <sebastian.leonhardt@web.de>2019-02-07 20:04:19 +0100
commit03e63da3165fa2ea02286a4497d2e9cf0bdc6ea6 (patch)
tree81a7a555bdf07e4bc868d00d7aaa2a32d0f1c079
parent60f60d9a12977cea8329b0b1c68981a2ad87b392 (diff)
downloadrockbox-03e63da3165fa2ea02286a4497d2e9cf0bdc6ea6.tar.gz
rockbox-03e63da3165fa2ea02286a4497d2e9cf0bdc6ea6.zip
YH820: implement LCD sleep
use sleep setting to keep transflective LCD active without backlight Change-Id: Iccd97e956d5e4a2a22abc90d15e9123782126ecb
-rw-r--r--firmware/export/backlight.h4
-rw-r--r--firmware/export/config/samsungyh820.h15
-rw-r--r--firmware/target/arm/samsung/yh820/backlight-yh820.c5
-rw-r--r--firmware/target/arm/samsung/yh820/lcd-yh820.c41
4 files changed, 57 insertions, 8 deletions
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index a1c65a3b4e..6d029790b3 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -60,6 +60,10 @@ void backlight_set_on_button_hold(int index);
60void lcd_set_sleep_after_backlight_off(int timeout_seconds); 60void lcd_set_sleep_after_backlight_off(int timeout_seconds);
61#endif 61#endif
62 62
63#ifdef HAVE_LCD_SLEEP
64void lcd_awake(void);
65#endif
66
63#else /* !HAVE_BACKLIGHT */ 67#else /* !HAVE_BACKLIGHT */
64#define backlight_init() 68#define backlight_init()
65#endif /* !HAVE_BACKLIGHT */ 69#endif /* !HAVE_BACKLIGHT */
diff --git a/firmware/export/config/samsungyh820.h b/firmware/export/config/samsungyh820.h
index 52ed821370..d937a3ff6c 100644
--- a/firmware/export/config/samsungyh820.h
+++ b/firmware/export/config/samsungyh820.h
@@ -34,6 +34,9 @@
34#define LCD_DEPTH 16 /* 65536 colours */ 34#define LCD_DEPTH 16 /* 65536 colours */
35#define LCD_PIXELFORMAT RGB565 35#define LCD_PIXELFORMAT RGB565
36 36
37/* LCD stays visible without backlight - simulator hint */
38#define HAVE_TRANSFLECTIVE_LCD
39
37#ifndef BOOTLOADER 40#ifndef BOOTLOADER
38 41
39/* define this if you have a real-time clock */ 42/* define this if you have a real-time clock */
@@ -42,12 +45,16 @@
42//#define HAVE_RTC_ALARM 45//#define HAVE_RTC_ALARM
43 46
44/* Define this if your LCD can be enabled/disabled */ 47/* Define this if your LCD can be enabled/disabled */
45#define HAVE_LCD_ENABLE 48/* #define HAVE_LCD_ENABLE */
46 49
47/* Define this if your LCD can be put to sleep. 50/* Define this if your LCD can be put to sleep.
48 HAVE_LCD_ENABLE should be defined as well. */ 51 HAVE_LCD_ENABLE should be defined as well.
49/* todo #define HAVE_LCD_SLEEP*/ 52 Note: with a transflective display, HAVE_LCD_ENABLE shouldn't be defined.
50/* todo #define HAVE_LCD_SLEEP_SETTING */ 53 LCD gets disabled when setting to sleep. */
54#define HAVE_LCD_SLEEP
55#define HAVE_LCD_SLEEP_SETTING
56/* The same code may also be used when shutting down */
57#define HAVE_LCD_SHUTDOWN
51#endif /* !BOOTLOADER */ 58#endif /* !BOOTLOADER */
52 59
53/* Define this for LCD backlight available */ 60/* Define this for LCD backlight available */
diff --git a/firmware/target/arm/samsung/yh820/backlight-yh820.c b/firmware/target/arm/samsung/yh820/backlight-yh820.c
index b24f8128c4..c9309eebbe 100644
--- a/firmware/target/arm/samsung/yh820/backlight-yh820.c
+++ b/firmware/target/arm/samsung/yh820/backlight-yh820.c
@@ -28,7 +28,7 @@
28void backlight_hw_on(void) 28void backlight_hw_on(void)
29{ 29{
30#ifdef HAVE_LCD_SLEEP 30#ifdef HAVE_LCD_SLEEP
31 backlight_lcd_sleep_countdown(false); /* stop counter */ 31 lcd_awake(); /* power on lcd + visible display */
32#endif 32#endif
33#ifdef HAVE_LCD_ENABLE 33#ifdef HAVE_LCD_ENABLE
34 lcd_enable(true); /* power on lcd + visible display */ 34 lcd_enable(true); /* power on lcd + visible display */
@@ -42,7 +42,4 @@ void backlight_hw_off(void)
42#ifdef HAVE_LCD_ENABLE 42#ifdef HAVE_LCD_ENABLE
43 lcd_enable(false); /* power off visible display */ 43 lcd_enable(false); /* power off visible display */
44#endif 44#endif
45#ifdef HAVE_LCD_SLEEP
46 backlight_lcd_sleep_countdown(true); /* start countdown */
47#endif
48} 45}
diff --git a/firmware/target/arm/samsung/yh820/lcd-yh820.c b/firmware/target/arm/samsung/yh820/lcd-yh820.c
index d6bb2a196b..f4b55ab917 100644
--- a/firmware/target/arm/samsung/yh820/lcd-yh820.c
+++ b/firmware/target/arm/samsung/yh820/lcd-yh820.c
@@ -25,6 +25,9 @@
25#include "lcd.h" 25#include "lcd.h"
26#include "kernel.h" 26#include "kernel.h"
27#include "system.h" 27#include "system.h"
28#ifdef HAVE_LCD_SHUTDOWN
29#include "backlight-target.h" /* included for backlight_hw_off() prototype */
30#endif
28 31
29/* Display status */ 32/* Display status */
30static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; 33static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
@@ -235,6 +238,28 @@ void lcd_enable(bool yesno)
235} 238}
236#endif 239#endif
237 240
241#ifdef HAVE_LCD_SLEEP
242void lcd_sleep(void)
243{
244 if (is_lcd_enabled)
245 {
246 is_lcd_enabled = false;
247 lcd_send_command(R_STANDBY_ON);
248 }
249}
250
251void lcd_awake(void)
252{
253 if (!is_lcd_enabled)
254 {
255 is_lcd_enabled = true;
256 lcd_send_command(R_STANDBY_OFF);
257 lcd_send_command(R_DISPLAY_ON);
258 send_event(LCD_EVENT_ACTIVATION, NULL);
259 }
260}
261#endif
262
238#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 263#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
239bool lcd_active(void) 264bool lcd_active(void)
240{ 265{
@@ -242,6 +267,17 @@ bool lcd_active(void)
242} 267}
243#endif 268#endif
244 269
270#if defined(HAVE_LCD_SHUTDOWN)
271void lcd_shutdown(void)
272{
273 backlight_hw_off();
274#ifndef HAVE_LCD_ENABLE
275 /* already done by backlight_hw_off() */
276 lcd_send_command(R_STANDBY_ON);
277#endif
278}
279#endif
280
245#ifdef HAVE_LCD_FLIP 281#ifdef HAVE_LCD_FLIP
246/* turn the display upside down (call lcd_update() afterwards) */ 282/* turn the display upside down (call lcd_update() afterwards) */
247/* Note: since the lcd is rotated, this will flip horiz instead of vert */ 283/* Note: since the lcd is rotated, this will flip horiz instead of vert */
@@ -338,6 +374,11 @@ void lcd_update(void)
338void lcd_update_rect(int x, int y, int width, int height) 374void lcd_update_rect(int x, int y, int width, int height)
339{ 375{
340 const fb_data *addr; 376 const fb_data *addr;
377
378#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
379 if (!is_lcd_enabled)
380 return;
381#endif
341 382
342 if (x + width >= LCD_WIDTH) 383 if (x + width >= LCD_WIDTH)
343 width = LCD_WIDTH - x; 384 width = LCD_WIDTH - x;