diff options
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/backlight-ipod6g.c')
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/backlight-ipod6g.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/backlight-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/backlight-ipod6g.c new file mode 100644 index 0000000000..dc21d161de --- /dev/null +++ b/firmware/target/arm/s5l8702/ipod6g/backlight-ipod6g.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: backlight-nano2g.c 28601 2010-11-14 20:39:18Z theseven $ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Dave Chapman | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include <stdbool.h> | ||
22 | |||
23 | #include "config.h" | ||
24 | #include "kernel.h" | ||
25 | #include "backlight.h" | ||
26 | #include "backlight-target.h" | ||
27 | #include "pmu-target.h" | ||
28 | |||
29 | #ifdef HAVE_LCD_SLEEP | ||
30 | bool lcd_active(void); | ||
31 | void lcd_awake(void); | ||
32 | void lcd_update(void); | ||
33 | #endif | ||
34 | |||
35 | void _backlight_set_brightness(int brightness) | ||
36 | { | ||
37 | pmu_write(0x28, brightness); | ||
38 | } | ||
39 | |||
40 | void _backlight_on(void) | ||
41 | { | ||
42 | #ifdef HAVE_LCD_SLEEP | ||
43 | if (!lcd_active()) | ||
44 | { | ||
45 | lcd_awake(); | ||
46 | lcd_update(); | ||
47 | sleep(HZ/8); | ||
48 | } | ||
49 | #endif | ||
50 | pmu_write(0x29, 1); | ||
51 | } | ||
52 | |||
53 | void _backlight_off(void) | ||
54 | { | ||
55 | pmu_write(0x29, 0); | ||
56 | } | ||
57 | |||
58 | bool _backlight_init(void) | ||
59 | { | ||
60 | pmu_write(0x2a, 6); | ||
61 | pmu_write(0x28, 0x20); | ||
62 | pmu_write(0x2b, 20); | ||
63 | |||
64 | _backlight_on(); | ||
65 | |||
66 | return true; | ||
67 | } | ||