summaryrefslogtreecommitdiff
path: root/firmware/backlight.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/backlight.c')
-rw-r--r--firmware/backlight.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index fea22a06a4..de3ebe3e05 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -28,7 +28,7 @@
28#include "power.h" 28#include "power.h"
29#include "system.h" 29#include "system.h"
30 30
31#ifdef HAVE_BACKLIGHT 31#ifdef CONFIG_BACKLIGHT
32 32
33const char backlight_timeout_value[19] = 33const char backlight_timeout_value[19] =
34{ 34{
@@ -51,30 +51,30 @@ static unsigned int backlight_timeout = 5;
51 51
52static void __backlight_off(void) 52static void __backlight_off(void)
53{ 53{
54#ifdef IRIVER_H100 54#if CONFIG_BACKLIGHT == BL_IRIVER
55 GPIO1_OUT |= 0x00020000; 55 GPIO1_OUT |= 0x00020000;
56#else 56#elif CONFIG_BACKLIGHT == BL_RTC
57#ifdef HAVE_RTC
58 /* Disable square wave */ 57 /* Disable square wave */
59 rtc_write(0x0a, rtc_read(0x0a) & ~0x40); 58 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
60#else 59#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
61 and_b(~0x40, &PAIORH); 60 and_b(~0x40, &PAIORH); /* let it float (up) */
62#endif 61#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
62 and_b(~0x40, &PADRH); /* drive it low */
63#endif 63#endif
64} 64}
65 65
66static void __backlight_on(void) 66static void __backlight_on(void)
67{ 67{
68#ifdef IRIVER_H100 68#if CONFIG_BACKLIGHT == BL_IRIVER
69 GPIO1_OUT &= ~0x00020000; 69 GPIO1_OUT &= ~0x00020000;
70#else 70#elif CONFIG_BACKLIGHT == BL_RTC
71#ifdef HAVE_RTC
72 /* Enable square wave */ 71 /* Enable square wave */
73 rtc_write(0x0a, rtc_read(0x0a) | 0x40); 72 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
74#else 73#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
75 and_b(~0x40, &PADRH); 74 and_b(~0x40, &PADRH); /* drive an set low */
76 or_b(0x40, &PAIORH); 75 or_b(0x40, &PAIORH);
77#endif 76#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
77 or_b(0x40, &PADRH); /* drive it high */
78#endif 78#endif
79} 79}
80 80
@@ -187,15 +187,13 @@ void backlight_init(void)
187 create_thread(backlight_thread, backlight_stack, 187 create_thread(backlight_thread, backlight_stack,
188 sizeof(backlight_stack), backlight_thread_name); 188 sizeof(backlight_stack), backlight_thread_name);
189 189
190#ifdef HAVE_LCD_CHARCELLS 190#if CONFIG_BACKLIGHT == BL_IRIVER
191 GPIO1_ENABLE |= 0x00020000;
192 GPIO1_FUNCTION |= 0x00020000;
193#elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
191 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */ 194 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
192 or_b(0x40, &PAIORH); /* ..and output */ 195 or_b(0x40, &PAIORH); /* ..and output */
193#endif 196#endif
194
195#ifdef IRIVER_H100
196 GPIO1_ENABLE |= 0x00020000;
197 GPIO1_FUNCTION |= 0x00020000;
198#endif
199 backlight_on(); 197 backlight_on();
200} 198}
201 199
@@ -210,5 +208,5 @@ void backlight_set_timeout(int index) {(void)index;}
210bool backlight_get_on_when_charging(void) {return 0;} 208bool backlight_get_on_when_charging(void) {return 0;}
211void backlight_set_on_when_charging(bool yesno) {(void)yesno;} 209void backlight_set_on_when_charging(bool yesno) {(void)yesno;}
212 210
213#endif /* #ifdef HAVE_BACKLIGHT */ 211#endif /* #ifdef CONFIG_BACKLIGHT */
214 212