diff options
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/backlight-6g.c')
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/backlight-6g.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/backlight-6g.c b/firmware/target/arm/s5l8702/ipod6g/backlight-6g.c new file mode 100644 index 0000000000..7d1c8bde13 --- /dev/null +++ b/firmware/target/arm/s5l8702/ipod6g/backlight-6g.c | |||
@@ -0,0 +1,69 @@ | |||
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_hw_brightness(int brightness) | ||
36 | { | ||
37 | pmu_write(0x28, brightness); | ||
38 | } | ||
39 | |||
40 | void backlight_hw_on(void) | ||
41 | { | ||
42 | #ifdef HAVE_LCD_SLEEP | ||
43 | if (!lcd_active()) | ||
44 | { | ||
45 | lcd_awake(); | ||
46 | lcd_update(); | ||
47 | sleep(HZ/20); | ||
48 | } | ||
49 | #endif | ||
50 | pmu_write(0x29, 1); | ||
51 | } | ||
52 | |||
53 | void backlight_hw_off(void) | ||
54 | { | ||
55 | pmu_write(0x29, 0); | ||
56 | } | ||
57 | |||
58 | bool backlight_hw_init(void) | ||
59 | { | ||
60 | /* LEDCTL: overvoltage protection enabled, OCP limit is 500mA */ | ||
61 | pmu_write(0x2a, 0x05); | ||
62 | |||
63 | pmu_write(0x2b, 0x14); /* T_dimstep = 16 * value / 32768 */ | ||
64 | backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING); | ||
65 | |||
66 | backlight_hw_on(); | ||
67 | |||
68 | return true; | ||
69 | } | ||