From 2f9e3cae2c567185a501f4e2a301665452a83350 Mon Sep 17 00:00:00 2001 From: Lorenzo Miori Date: Wed, 6 Mar 2013 22:24:40 +0100 Subject: 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 --- .../target/hosted/samsungypr/ypr0/backlight-ypr0.c | 27 +++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'firmware/target/hosted/samsungypr/ypr0') 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 @@ static bool backlight_on_status = true; /* Is on or off? */ -/*TODO: see if LCD sleep could be implemented in a better way -> ie using a rockbox feature */ -/* Turn off LCD power supply */ -static void _backlight_lcd_sleep(void) -{ - int fp = open("/sys/class/graphics/fb0/blank", O_RDWR); - write(fp, "1", 1); - close(fp); -} -/* Turn on LCD screen */ -static void _backlight_lcd_power(void) -{ - int fp = open("/sys/class/graphics/fb0/blank", O_RDWR); - write(fp, "0", 1); - close(fp); -} - bool _backlight_init(void) { /* We have nothing to do */ @@ -56,7 +40,9 @@ void _backlight_on(void) if (!backlight_on_status) { /* Turn on lcd power before backlight */ - _backlight_lcd_power(); +#ifdef HAVE_LCD_ENABLE + lcd_enable(true); +#endif /* Original app sets this to 0xb1 when backlight is on... */ ascodec_write_pmu(AS3543_BACKLIGHT, 0x1, 0xb1); } @@ -67,11 +53,14 @@ void _backlight_on(void) void _backlight_off(void) { - if (backlight_on_status) { + if (backlight_on_status) + { /* Disabling the DCDC15 completely, keeps brightness register value */ ascodec_write_pmu(AS3543_BACKLIGHT, 0x1, 0x00); /* Turn off lcd power then */ - _backlight_lcd_sleep(); +#ifdef HAVE_LCD_ENABLE + lcd_enable(false); +#endif } backlight_on_status = false; -- cgit v1.2.3