diff options
Diffstat (limited to 'firmware/target/arm/imx233/sony-nwz/backlight-nwz.c')
-rw-r--r-- | firmware/target/arm/imx233/sony-nwz/backlight-nwz.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/sony-nwz/backlight-nwz.c b/firmware/target/arm/imx233/sony-nwz/backlight-nwz.c new file mode 100644 index 0000000000..ad3ef484db --- /dev/null +++ b/firmware/target/arm/imx233/sony-nwz/backlight-nwz.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
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 | |||
22 | #include "config.h" | ||
23 | #include "system.h" | ||
24 | #include "lcd.h" | ||
25 | #include "backlight.h" | ||
26 | #include "backlight-target.h" | ||
27 | #include "pwm-imx233.h" | ||
28 | #include "pinctrl-imx233.h" | ||
29 | |||
30 | void _backlight_set_brightness(int brightness) | ||
31 | { | ||
32 | imx233_pwm_setup_simple(2, 24000, 100 - brightness); | ||
33 | imx233_pwm_enable(2, true); | ||
34 | } | ||
35 | |||
36 | bool _backlight_init(void) | ||
37 | { | ||
38 | imx233_pinctrl_acquire(0, 10, "backlight_enable"); | ||
39 | imx233_pinctrl_set_function(0, 10, PINCTRL_FUNCTION_GPIO); | ||
40 | imx233_pinctrl_enable_gpio(0, 10, true); | ||
41 | imx233_pinctrl_set_gpio(0, 10, true); | ||
42 | _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); | ||
43 | return true; | ||
44 | } | ||
45 | |||
46 | void _backlight_on(void) | ||
47 | { | ||
48 | #ifdef HAVE_LCD_ENABLE | ||
49 | lcd_enable(true); /* power on lcd + visible display */ | ||
50 | #endif | ||
51 | /* don't do anything special, the core will set the brightness */ | ||
52 | } | ||
53 | |||
54 | void _backlight_off(void) | ||
55 | { | ||
56 | /* there is no real on/off but we can set to 0 brightness */ | ||
57 | _backlight_set_brightness(0); | ||
58 | #ifdef HAVE_LCD_ENABLE | ||
59 | lcd_enable(false); /* power off visible display */ | ||
60 | #endif | ||
61 | } | ||