diff options
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c')
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c | 27 |
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 | ||
30 | static bool backlight_on_status = true; /* Is on or off? */ | 30 | static 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 */ | ||
34 | static 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 */ | ||
41 | static 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 | |||
48 | bool _backlight_init(void) | 32 | bool _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 | ||
68 | void _backlight_off(void) | 54 | void _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; |