diff options
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c')
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c b/firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c new file mode 100644 index 0000000000..e4f0457cf9 --- /dev/null +++ b/firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2013 by Lorenzo Miori | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | #include "config.h" | ||
21 | #include "system.h" | ||
22 | #include "backlight.h" | ||
23 | #include "backlight-target.h" | ||
24 | #include "lcd.h" | ||
25 | #include "lcd-target.h" | ||
26 | #include "pmu-ypr1.h" | ||
27 | |||
28 | static bool backlight_on_status = true; /* Is on or off? */ | ||
29 | |||
30 | bool _backlight_init(void) | ||
31 | { | ||
32 | /* We have nothing to do */ | ||
33 | return true; | ||
34 | } | ||
35 | |||
36 | void _backlight_on(void) | ||
37 | { | ||
38 | if (!backlight_on_status) { | ||
39 | _backlight_set_brightness(backlight_brightness); | ||
40 | } | ||
41 | |||
42 | backlight_on_status = true; | ||
43 | |||
44 | } | ||
45 | |||
46 | void _backlight_off(void) | ||
47 | { | ||
48 | if (backlight_on_status) { | ||
49 | _backlight_set_brightness(0); | ||
50 | } | ||
51 | |||
52 | backlight_on_status = false; | ||
53 | } | ||
54 | |||
55 | void _backlight_set_brightness(int brightness) | ||
56 | { | ||
57 | /* Just another check... */ | ||
58 | if (brightness > MAX_BRIGHTNESS_SETTING) { | ||
59 | brightness = MAX_BRIGHTNESS_SETTING; | ||
60 | } | ||
61 | if (brightness < 0) { | ||
62 | brightness = MIN_BRIGHTNESS_SETTING; | ||
63 | } | ||
64 | /* Do the appropriate ioctl on the linux module */ | ||
65 | pmu_ioctl(MAX8819_IOCTL_LCD_DIM_CTRL, &brightness); | ||
66 | } | ||