summaryrefslogtreecommitdiff
path: root/firmware/target/arm/pbell/vibe500/backlight-vibe500.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/pbell/vibe500/backlight-vibe500.c')
-rw-r--r--firmware/target/arm/pbell/vibe500/backlight-vibe500.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/firmware/target/arm/pbell/vibe500/backlight-vibe500.c b/firmware/target/arm/pbell/vibe500/backlight-vibe500.c
new file mode 100644
index 0000000000..727370633b
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/backlight-vibe500.c
@@ -0,0 +1,87 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id:$
9 *
10 * Copyright (C) 2009 by Szymon Dziok
11 * Based on the Iriver H10 and the Philips HD1630 code.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22#include "config.h"
23#include "cpu.h"
24#include "system.h"
25#include "backlight.h"
26#include "backlight-target.h"
27#include "lcd.h"
28#include "synaptics-mep.h"
29
30void _backlight_on(void)
31{
32#ifdef HAVE_LCD_ENABLE
33 lcd_enable(true); /* power on lcd + visible display */
34#endif
35 GPIO_SET_BITWISE(GPIOJ_OUTPUT_VAL, 0x01);
36}
37
38void _backlight_off(void)
39{
40 GPIO_CLEAR_BITWISE(GPIOJ_OUTPUT_VAL, 0x01);
41#ifdef HAVE_LCD_ENABLE
42 lcd_enable(false); /* power off visible display */
43#endif
44}
45
46#ifdef HAVE_BACKLIGHT_BRIGHTNESS
47static const int brightness_vals[16] =
48 {255,237,219,201,183,165,147,130,112,94,76,58,40,22,5,0};
49
50void _backlight_set_brightness(int brightness)
51{
52 /* From PB Vibe Bootloader and OF */
53 DEV_INIT1&=0xFFFF3F3F;
54 DEV_INIT1+=0x4000;
55 DEV_EN |= 0x20000;
56 outl(0x80000000 | (brightness_vals[brightness-1] << 16), 0x7000a010);
57}
58#endif
59
60#ifdef HAVE_BUTTON_LIGHT
61static unsigned short buttonlight_status = 0;
62
63void _buttonlight_on(void)
64{
65 if (!buttonlight_status)
66 {
67 touchpad_set_buttonlights(0x0f, 0);
68 buttonlight_status = 1;
69 }
70}
71
72void _buttonlight_off(void)
73{
74 if (buttonlight_status)
75 {
76 touchpad_set_buttonlights(0x00, 0);
77 buttonlight_status = 0;
78 }
79}
80
81void _buttonlight_set_brightness(int brightness)
82{
83 /* no brightness control, but lights stays on - for compatibility */
84 touchpad_set_buttonlights(0x0f, brightness);
85 buttonlight_status = 1;
86}
87#endif