summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iriver/h300
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-11-12 18:49:53 +0000
committerJens Arnold <amiconn@rockbox.org>2007-11-12 18:49:53 +0000
commitef12b3b5c678e4fa44d60061b0c1bc312e589ba1 (patch)
tree4c2572d7bf3d995be16b33fa2e46ccccad34f4ee /firmware/target/coldfire/iriver/h300
parent8537cbf091634efa57768dccff39049afdf6d288 (diff)
downloadrockbox-ef12b3b5c678e4fa44d60061b0c1bc312e589ba1.tar.gz
rockbox-ef12b3b5c678e4fa44d60061b0c1bc312e589ba1.zip
Hardware controlled backlight brightness for iPod Video and Nano, retaining the software PWM fade in/ fade out. * Backlight handling cleanup, getting rid of one layer of 'lowlevelness'. * Use atomic GPIO bit manipulation for PP502x backlight handling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15599 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iriver/h300')
-rw-r--r--firmware/target/coldfire/iriver/h300/backlight-h300.c12
-rw-r--r--firmware/target/coldfire/iriver/h300/backlight-target.h29
2 files changed, 35 insertions, 6 deletions
diff --git a/firmware/target/coldfire/iriver/h300/backlight-h300.c b/firmware/target/coldfire/iriver/h300/backlight-h300.c
index 4cec54f0d7..c0d441ad3f 100644
--- a/firmware/target/coldfire/iriver/h300/backlight-h300.c
+++ b/firmware/target/coldfire/iriver/h300/backlight-h300.c
@@ -25,7 +25,7 @@
25#include "pcf50606.h" 25#include "pcf50606.h"
26#include "lcd.h" 26#include "lcd.h"
27 27
28bool __backlight_init(void) 28bool _backlight_init(void)
29{ 29{
30 or_l(0x00020000, &GPIO1_ENABLE); 30 or_l(0x00020000, &GPIO1_ENABLE);
31 or_l(0x00020000, &GPIO1_FUNCTION); 31 or_l(0x00020000, &GPIO1_FUNCTION);
@@ -34,21 +34,21 @@ bool __backlight_init(void)
34 return true; /* Backlight always ON after boot. */ 34 return true; /* Backlight always ON after boot. */
35} 35}
36 36
37void __backlight_on(void) 37void _backlight_on(void)
38{ 38{
39 lcd_enable(true); 39 lcd_enable(true);
40 sleep(HZ/100); /* lcd needs time - avoid flashing for dark screens */ 40 sleep(HZ/100); /* lcd needs time - avoid flashing for dark screens */
41 or_l(0x00020000, &GPIO1_OUT); 41 or_l(0x00020000, &GPIO1_OUT);
42} 42}
43 43
44void __backlight_off(void) 44void _backlight_off(void)
45{ 45{
46 and_l(~0x00020000, &GPIO1_OUT); 46 and_l(~0x00020000, &GPIO1_OUT);
47 lcd_enable(false); 47 lcd_enable(false);
48} 48}
49 49
50/* set brightness by changing the PWM */ 50/* set brightness by changing the PWM */
51void __backlight_set_brightness(int val) 51void _backlight_set_brightness(int val)
52{ 52{
53 /* disable IRQs while bitbanging */ 53 /* disable IRQs while bitbanging */
54 int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); 54 int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
@@ -57,12 +57,12 @@ void __backlight_set_brightness(int val)
57 set_irq_level(old_irq_level); 57 set_irq_level(old_irq_level);
58} 58}
59 59
60void __remote_backlight_on(void) 60void _remote_backlight_on(void)
61{ 61{
62 and_l(~0x00000002, &GPIO1_OUT); 62 and_l(~0x00000002, &GPIO1_OUT);
63} 63}
64 64
65void __remote_backlight_off(void) 65void _remote_backlight_off(void)
66{ 66{
67 or_l(0x00000002, &GPIO1_OUT); 67 or_l(0x00000002, &GPIO1_OUT);
68} 68}
diff --git a/firmware/target/coldfire/iriver/h300/backlight-target.h b/firmware/target/coldfire/iriver/h300/backlight-target.h
new file mode 100644
index 0000000000..f0e1147304
--- /dev/null
+++ b/firmware/target/coldfire/iriver/h300/backlight-target.h
@@ -0,0 +1,29 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22bool _backlight_init(void); /* Returns backlight current state (true=ON). */
23void _backlight_on(void);
24void _backlight_off(void);
25void _backlight_set_brightness(int val);
26void _remote_backlight_on(void);
27void _remote_backlight_off(void);
28
29#endif