summaryrefslogtreecommitdiff
path: root/firmware/backlight.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/backlight.c')
-rw-r--r--firmware/backlight.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 1e9d1ce743..fa6a42be44 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -61,7 +61,7 @@ static int remote_backlight_timer;
61static unsigned int remote_backlight_timeout = 5; 61static unsigned int remote_backlight_timeout = 5;
62#endif 62#endif
63 63
64#if CONFIG_BACKLIGHT == BL_IRIVER 64#if CONFIG_BACKLIGHT == BL_IRIVER_H100
65/* backlight fading */ 65/* backlight fading */
66#define BL_PWM_INTERVAL 5000 /* Cycle interval in µs */ 66#define BL_PWM_INTERVAL 5000 /* Cycle interval in µs */
67#define BL_PWM_COUNT 100 67#define BL_PWM_COUNT 100
@@ -195,7 +195,7 @@ void backlight_set_fade_out(int index)
195 195
196static void __backlight_off(void) 196static void __backlight_off(void)
197{ 197{
198#if CONFIG_BACKLIGHT == BL_IRIVER 198#if CONFIG_BACKLIGHT == BL_IRIVER_H100
199 if (fade_out_count > 0) 199 if (fade_out_count > 0)
200 backlight_dim(0); 200 backlight_dim(0);
201 else 201 else
@@ -203,6 +203,8 @@ static void __backlight_off(void)
203 bl_dim_target = bl_dim_current = 0; 203 bl_dim_target = bl_dim_current = 0;
204 or_l(0x00020000, &GPIO1_OUT); 204 or_l(0x00020000, &GPIO1_OUT);
205 } 205 }
206#elif CONFIG_BACKLIGHT == BL_IRIVER_H300
207 and_l(~0x00020000, &GPIO1_OUT);
206#elif CONFIG_BACKLIGHT == BL_RTC 208#elif CONFIG_BACKLIGHT == BL_RTC
207 /* Disable square wave */ 209 /* Disable square wave */
208 rtc_write(0x0a, rtc_read(0x0a) & ~0x40); 210 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
@@ -227,7 +229,7 @@ static void __backlight_off(void)
227 229
228static void __backlight_on(void) 230static void __backlight_on(void)
229{ 231{
230#if CONFIG_BACKLIGHT == BL_IRIVER 232#if CONFIG_BACKLIGHT == BL_IRIVER_H100
231 if (fade_in_count > 0) 233 if (fade_in_count > 0)
232 backlight_dim(BL_PWM_COUNT); 234 backlight_dim(BL_PWM_COUNT);
233 else 235 else
@@ -235,6 +237,8 @@ static void __backlight_on(void)
235 bl_dim_target = bl_dim_current = BL_PWM_COUNT; 237 bl_dim_target = bl_dim_current = BL_PWM_COUNT;
236 and_l(~0x00020000, &GPIO1_OUT); 238 and_l(~0x00020000, &GPIO1_OUT);
237 } 239 }
240#elif CONFIG_BACKLIGHT == BL_IRIVER_H300
241 or_l(0x00020000, &GPIO1_OUT);
238#elif CONFIG_BACKLIGHT == BL_RTC 242#elif CONFIG_BACKLIGHT == BL_RTC
239 /* Enable square wave */ 243 /* Enable square wave */
240 rtc_write(0x0a, rtc_read(0x0a) | 0x40); 244 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
@@ -317,7 +321,7 @@ void backlight_thread(void)
317 __backlight_off(); 321 __backlight_off();
318 break; 322 break;
319 323
320#if CONFIG_BACKLIGHT == BL_IRIVER 324#if CONFIG_BACKLIGHT == BL_IRIVER_H100
321 case BACKLIGHT_UNBOOST_CPU: 325 case BACKLIGHT_UNBOOST_CPU:
322 cpu_boost(false); 326 cpu_boost(false);
323 break; 327 break;
@@ -430,10 +434,14 @@ void backlight_init(void)
430 create_thread(backlight_thread, backlight_stack, 434 create_thread(backlight_thread, backlight_stack,
431 sizeof(backlight_stack), backlight_thread_name); 435 sizeof(backlight_stack), backlight_thread_name);
432 436
433#if CONFIG_BACKLIGHT == BL_IRIVER 437#if CONFIG_BACKLIGHT == BL_IRIVER_H100
434 or_l(0x00020000, &GPIO1_ENABLE); 438 or_l(0x00020000, &GPIO1_ENABLE);
435 or_l(0x00020000, &GPIO1_FUNCTION); 439 or_l(0x00020000, &GPIO1_FUNCTION);
436 and_l(~0x00020000, &GPIO1_OUT); /* Start with the backlight ON */ 440 and_l(~0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
441#elif CONFIG_BACKLIGHT == BL_IRIVER_H300
442 or_l(0x00020000, &GPIO1_ENABLE);
443 or_l(0x00020000, &GPIO1_FUNCTION);
444 or_l(0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
437#elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI 445#elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
438 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */ 446 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
439 or_b(0x40, &PAIORH); /* ..and output */ 447 or_b(0x40, &PAIORH); /* ..and output */