summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/samsungypr/ypr0
diff options
context:
space:
mode:
authorLorenzo Miori <memorys60@gmail.com>2013-03-06 22:24:40 +0100
committerThomas Martitz <kugel@rockbox.org>2013-03-06 23:23:52 +0100
commit2f9e3cae2c567185a501f4e2a301665452a83350 (patch)
treed7f13e767bd794d6157d50aeb3d68383dc25a137 /firmware/target/hosted/samsungypr/ypr0
parent8ef8ea2da2fb800832293054dd41be342f77764d (diff)
downloadrockbox-2f9e3cae2c567185a501f4e2a301665452a83350.tar.gz
rockbox-2f9e3cae2c567185a501f4e2a301665452a83350.zip
Samsung YP-R0 LCD improvements
This patch adds to YP-R0 (and other future targets using Linux framebuffer) the ability to use LCD_ENABLE to save some CPU cycles while display is powered off. This patch also changes the way to toggle LCD power: now using a proper ioctl call, slightly more efficient. Change-Id: I544de77f5abd4ac1c13d3fe3a6e40a30f7c0bece Reviewed-on: http://gerrit.rockbox.org/410 Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr0')
-rw-r--r--firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c
index 551b386f19..5555b30473 100644
--- a/firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c
+++ b/firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c
@@ -29,22 +29,6 @@
29 29
30static bool backlight_on_status = true; /* Is on or off? */ 30static bool backlight_on_status = true; /* Is on or off? */
31 31
32/*TODO: see if LCD sleep could be implemented in a better way -> ie using a rockbox feature */
33/* Turn off LCD power supply */
34static void _backlight_lcd_sleep(void)
35{
36 int fp = open("/sys/class/graphics/fb0/blank", O_RDWR);
37 write(fp, "1", 1);
38 close(fp);
39}
40/* Turn on LCD screen */
41static void _backlight_lcd_power(void)
42{
43 int fp = open("/sys/class/graphics/fb0/blank", O_RDWR);
44 write(fp, "0", 1);
45 close(fp);
46}
47
48bool _backlight_init(void) 32bool _backlight_init(void)
49{ 33{
50 /* We have nothing to do */ 34 /* We have nothing to do */
@@ -56,7 +40,9 @@ void _backlight_on(void)
56 if (!backlight_on_status) 40 if (!backlight_on_status)
57 { 41 {
58 /* Turn on lcd power before backlight */ 42 /* Turn on lcd power before backlight */
59 _backlight_lcd_power(); 43#ifdef HAVE_LCD_ENABLE
44 lcd_enable(true);
45#endif
60 /* Original app sets this to 0xb1 when backlight is on... */ 46 /* Original app sets this to 0xb1 when backlight is on... */
61 ascodec_write_pmu(AS3543_BACKLIGHT, 0x1, 0xb1); 47 ascodec_write_pmu(AS3543_BACKLIGHT, 0x1, 0xb1);
62 } 48 }
@@ -67,11 +53,14 @@ void _backlight_on(void)
67 53
68void _backlight_off(void) 54void _backlight_off(void)
69{ 55{
70 if (backlight_on_status) { 56 if (backlight_on_status)
57 {
71 /* Disabling the DCDC15 completely, keeps brightness register value */ 58 /* Disabling the DCDC15 completely, keeps brightness register value */
72 ascodec_write_pmu(AS3543_BACKLIGHT, 0x1, 0x00); 59 ascodec_write_pmu(AS3543_BACKLIGHT, 0x1, 0x00);
73 /* Turn off lcd power then */ 60 /* Turn off lcd power then */
74 _backlight_lcd_sleep(); 61#ifdef HAVE_LCD_ENABLE
62 lcd_enable(false);
63#endif
75 } 64 }
76 65
77 backlight_on_status = false; 66 backlight_on_status = false;