summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-11-21 23:55:39 +0000
committerJens Arnold <amiconn@rockbox.org>2005-11-21 23:55:39 +0000
commitb51f7dfc9b507ab9db12fe90b2ddad708f435e06 (patch)
treeefcef3411689401da21795d700a0741f8ab1072b /firmware
parente68680ac310adb8373c9f3a5194466766d64cf37 (diff)
downloadrockbox-b51f7dfc9b507ab9db12fe90b2ddad708f435e06.tar.gz
rockbox-b51f7dfc9b507ab9db12fe90b2ddad708f435e06.zip
Backlight handling: * Added 'Caption Backlight' and 'Backlight On When Charging' for the iriver remote LCD. * Enabled the backlight code for the simulator, and prepared backlight simulation. It's only a stub atm, writing messages to the console window. * Added tick task handling to the simulators for this to work. * Code cleanup in backlight.c, less dead code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8034 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/backlight.c278
-rw-r--r--firmware/drivers/button.c2
-rw-r--r--firmware/drivers/lcd-h100-remote.c18
-rw-r--r--firmware/export/backlight.h18
-rw-r--r--firmware/export/config-fmrecorder.h6
-rw-r--r--firmware/export/config-h100.h6
-rw-r--r--firmware/export/config-h120.h6
-rw-r--r--firmware/export/config-h300.h6
-rw-r--r--firmware/export/config-ipodcolor.h6
-rw-r--r--firmware/export/config-ipodnano.h6
-rw-r--r--firmware/export/config-player.h6
-rw-r--r--firmware/export/config-recorder.h6
-rw-r--r--firmware/export/config-recorderv2.h6
-rw-r--r--firmware/export/lcd-remote.h2
-rw-r--r--firmware/powermgmt.c8
16 files changed, 204 insertions, 178 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index e5056c54df..aba4e3b622 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1,9 +1,7 @@
1#ifdef ROCKBOX_HAS_LOGF 1#ifdef ROCKBOX_HAS_LOGF
2logf.c 2logf.c
3#endif 3#endif
4#ifndef SIMULATOR
5backlight.c 4backlight.c
6#endif
7buffer.c 5buffer.c
8common/atoi.c 6common/atoi.c
9common/ctype.c 7common/ctype.c
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 26d0362c27..9cec4ea08c 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -28,6 +28,7 @@
28#include "power.h" 28#include "power.h"
29#include "system.h" 29#include "system.h"
30#include "timer.h" 30#include "timer.h"
31#include "backlight.h"
31 32
32#ifdef HAVE_REMOTE_LCD 33#ifdef HAVE_REMOTE_LCD
33#include "lcd-remote.h" 34#include "lcd-remote.h"
@@ -51,17 +52,17 @@ static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
51static const char backlight_thread_name[] = "backlight"; 52static const char backlight_thread_name[] = "backlight";
52static struct event_queue backlight_queue; 53static struct event_queue backlight_queue;
53 54
54static bool charger_was_inserted = 0; 55static bool backlight_on_when_charging = false;
55static bool backlight_on_when_charging = 0;
56
57static int backlight_timer; 56static int backlight_timer;
58static unsigned int backlight_timeout = 5; 57static unsigned int backlight_timeout = 5;
58
59#ifdef HAVE_REMOTE_LCD 59#ifdef HAVE_REMOTE_LCD
60static bool remote_backlight_on_when_charging = false;
60static int remote_backlight_timer; 61static int remote_backlight_timer;
61static unsigned int remote_backlight_timeout = 5; 62static unsigned int remote_backlight_timeout = 5;
62#endif 63#endif
63 64
64#if CONFIG_BACKLIGHT == BL_IRIVER_H100 65#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
65/* backlight fading */ 66/* backlight fading */
66#define BL_PWM_INTERVAL 5000 /* Cycle interval in µs */ 67#define BL_PWM_INTERVAL 5000 /* Cycle interval in µs */
67#define BL_PWM_COUNT 100 68#define BL_PWM_COUNT 100
@@ -191,11 +192,52 @@ void backlight_set_fade_out(int index)
191{ 192{
192 fade_out_count = backlight_fade_value[index]; 193 fade_out_count = backlight_fade_value[index];
193} 194}
195#endif /* (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR) */
196
197static void __backlight_on(void)
198{
199#ifdef SIMULATOR
200 sim_backlight(100);
201#elif CONFIG_BACKLIGHT == BL_IRIVER_H100
202 if (fade_in_count > 0)
203 backlight_dim(BL_PWM_COUNT);
204 else
205 {
206 bl_dim_target = bl_dim_current = BL_PWM_COUNT;
207 and_l(~0x00020000, &GPIO1_OUT);
208 }
209#elif CONFIG_BACKLIGHT == BL_IRIVER_H300
210 or_l(0x00020000, &GPIO1_OUT);
211#elif CONFIG_BACKLIGHT == BL_RTC
212 /* Enable square wave */
213 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
214#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
215 and_b(~0x40, &PADRH); /* drive and set low */
216 or_b(0x40, &PAIORH);
217#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
218 or_b(0x40, &PADRH); /* drive it high */
219#elif CONFIG_BACKLIGHT == BL_GMINI
220 P1 |= 0x10;
221#elif CONFIG_BACKLIGHT == BL_IPOD4G
222 /* brightness full */
223 outl(0x80000000 | (0xff << 16), 0x7000a010);
224
225 /* set port b bit 3 on */
226 outl(((0x100 | 1) << 3), 0x6000d824);
227#elif CONFIG_BACKLIGHT==BL_IPODNANO
228 /* set port B03 on */
229 outl(((0x100 | 1) << 3), 0x6000d824);
230
231 /* set port L07 on */
232 outl(((0x100 | 1) << 7), 0x6000d12c);
194#endif 233#endif
234}
195 235
196static void __backlight_off(void) 236static void __backlight_off(void)
197{ 237{
198#if CONFIG_BACKLIGHT == BL_IRIVER_H100 238#ifdef SIMULATOR
239 sim_backlight(0);
240#elif CONFIG_BACKLIGHT == BL_IRIVER_H100
199 if (fade_out_count > 0) 241 if (fade_out_count > 0)
200 backlight_dim(0); 242 backlight_dim(0);
201 else 243 else
@@ -227,42 +269,29 @@ static void __backlight_off(void)
227#endif 269#endif
228} 270}
229 271
230static void __backlight_on(void) 272#ifdef HAVE_REMOTE_LCD
273static void __remote_backlight_on(void)
231{ 274{
232#if CONFIG_BACKLIGHT == BL_IRIVER_H100 275#ifdef SIMULATOR
233 if (fade_in_count > 0) 276 sim_remote_backlight(100);
234 backlight_dim(BL_PWM_COUNT); 277#elif defined(IRIVER_H300_SERIES)
235 else 278 and_l(~0x00000002, &GPIO1_OUT);
236 { 279#else
237 bl_dim_target = bl_dim_current = BL_PWM_COUNT; 280 and_l(~0x00000800, &GPIO_OUT);
238 and_l(~0x00020000, &GPIO1_OUT); 281#endif
239 } 282}
240#elif CONFIG_BACKLIGHT == BL_IRIVER_H300
241 or_l(0x00020000, &GPIO1_OUT);
242#elif CONFIG_BACKLIGHT == BL_RTC
243 /* Enable square wave */
244 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
245#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
246 and_b(~0x40, &PADRH); /* drive and set low */
247 or_b(0x40, &PAIORH);
248#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
249 or_b(0x40, &PADRH); /* drive it high */
250#elif CONFIG_BACKLIGHT == BL_GMINI
251 P1 |= 0x10;
252#elif CONFIG_BACKLIGHT == BL_IPOD4G
253 /* brightness full */
254 outl(0x80000000 | (0xff << 16), 0x7000a010);
255
256 /* set port b bit 3 on */
257 outl(((0x100 | 1) << 3), 0x6000d824);
258#elif CONFIG_BACKLIGHT==BL_IPODNANO
259 /* set port B03 on */
260 outl(((0x100 | 1) << 3), 0x6000d824);
261 283
262 /* set port L07 on */ 284static void __remote_backlight_off(void)
263 outl(((0x100 | 1) << 7), 0x6000d12c); 285{
286#ifdef SIMULATOR
287 sim_remote_backlight(0);
288#elif defined(IRIVER_H300_SERIES)
289 or_l(0x00000002, &GPIO1_OUT);
290#else
291 or_l(0x00000800, &GPIO_OUT);
264#endif 292#endif
265} 293}
294#endif /* HAVE_REMOTE_LCD */
266 295
267void backlight_thread(void) 296void backlight_thread(void)
268{ 297{
@@ -275,26 +304,34 @@ void backlight_thread(void)
275 { 304 {
276#ifdef HAVE_REMOTE_LCD 305#ifdef HAVE_REMOTE_LCD
277 case REMOTE_BACKLIGHT_ON: 306 case REMOTE_BACKLIGHT_ON:
278 remote_backlight_timer = 307 if( remote_backlight_on_when_charging && charger_inserted() )
279 HZ*backlight_timeout_value[remote_backlight_timeout]; 308 {
309 /* Forcing to zero keeps the lights on */
310 remote_backlight_timer = 0;
311 }
312 else
313 {
314 remote_backlight_timer =
315 HZ*backlight_timeout_value[remote_backlight_timeout];
316 }
280 317
281 /* Backlight == OFF in the setting? */ 318 /* Backlight == OFF in the setting? */
282 if(remote_backlight_timer < 0) 319 if(remote_backlight_timer < 0)
283 { 320 {
284 remote_backlight_timer = 0; /* Disable the timeout */ 321 remote_backlight_timer = 0; /* Disable the timeout */
285 lcd_remote_backlight_off(); 322 __remote_backlight_off();
286 } 323 }
287 else 324 else
288 { 325 {
289 lcd_remote_backlight_on(); 326 __remote_backlight_on();
290 } 327 }
291 break; 328 break;
292 329
293 case REMOTE_BACKLIGHT_OFF: 330 case REMOTE_BACKLIGHT_OFF:
294 lcd_remote_backlight_off(); 331 __remote_backlight_off();
295 break; 332 break;
296 333
297#endif 334#endif /* HAVE_REMOTE_LCD */
298 case BACKLIGHT_ON: 335 case BACKLIGHT_ON:
299 if( backlight_on_when_charging && charger_inserted() ) 336 if( backlight_on_when_charging && charger_inserted() )
300 { 337 {
@@ -321,7 +358,7 @@ void backlight_thread(void)
321 __backlight_off(); 358 __backlight_off();
322 break; 359 break;
323 360
324#if CONFIG_BACKLIGHT == BL_IRIVER_H100 361#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
325 case BACKLIGHT_UNBOOST_CPU: 362 case BACKLIGHT_UNBOOST_CPU:
326 cpu_boost(false); 363 cpu_boost(false);
327 break; 364 break;
@@ -340,74 +377,24 @@ void backlight_thread(void)
340 } 377 }
341} 378}
342 379
343void backlight_on(void) 380static void backlight_tick(void)
344{ 381{
345 queue_post(&backlight_queue, BACKLIGHT_ON, NULL); 382#ifdef HAVE_CHARGING
346} 383 static bool charger_was_inserted = false;
347 384 bool charger_is_inserted = charger_inserted();
348void backlight_off(void)
349{
350 queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
351}
352 385
386 if( charger_was_inserted != charger_is_inserted )
387 {
388 if( backlight_on_when_charging )
389 backlight_on();
353#ifdef HAVE_REMOTE_LCD 390#ifdef HAVE_REMOTE_LCD
354void remote_backlight_on(void) 391 if( remote_backlight_on_when_charging )
355{ 392 remote_backlight_on();
356 queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, NULL);
357}
358
359void remote_backlight_off(void)
360{
361 queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, NULL);
362}
363
364void remote_backlight_set_timeout(int index)
365{
366 if((unsigned)index >= sizeof(backlight_timeout_value))
367 /* if given a weird value, use 0 */
368 index=0;
369 remote_backlight_timeout = index; /* index in the backlight_timeout_value table */
370 remote_backlight_on();
371}
372#endif
373
374int backlight_get_timeout(void)
375{
376 return backlight_timeout;
377}
378
379void backlight_set_timeout(int index)
380{
381 if((unsigned)index >= sizeof(backlight_timeout_value))
382 /* if given a weird value, use 0 */
383 index=0;
384 backlight_timeout = index; /* index in the backlight_timeout_value table */
385 backlight_on();
386}
387
388#ifdef HAVE_CHARGE_CTRL
389bool backlight_get_on_when_charging(void)
390{
391 return backlight_on_when_charging;
392}
393#endif 393#endif
394
395void backlight_set_on_when_charging(bool yesno)
396{
397 backlight_on_when_charging = yesno;
398 backlight_on();
399}
400
401void backlight_tick(void)
402{
403 bool charger_is_inserted = charger_inserted();
404 if( backlight_on_when_charging &&
405 (charger_was_inserted != charger_is_inserted) )
406 {
407 backlight_on();
408 } 394 }
409 charger_was_inserted = charger_is_inserted; 395 charger_was_inserted = charger_is_inserted;
410 396#endif /* HAVE_CHARGING */
397
411 if(backlight_timer) 398 if(backlight_timer)
412 { 399 {
413 backlight_timer--; 400 backlight_timer--;
@@ -433,8 +420,10 @@ void backlight_init(void)
433 queue_init(&backlight_queue); 420 queue_init(&backlight_queue);
434 create_thread(backlight_thread, backlight_stack, 421 create_thread(backlight_thread, backlight_stack,
435 sizeof(backlight_stack), backlight_thread_name); 422 sizeof(backlight_stack), backlight_thread_name);
436 423 tick_add_task(backlight_tick);
437#if CONFIG_BACKLIGHT == BL_IRIVER_H100 424#ifdef SIMULATOR
425 /* do nothing */
426#elif CONFIG_BACKLIGHT == BL_IRIVER_H100
438 or_l(0x00020000, &GPIO1_ENABLE); 427 or_l(0x00020000, &GPIO1_ENABLE);
439 or_l(0x00020000, &GPIO1_FUNCTION); 428 or_l(0x00020000, &GPIO1_FUNCTION);
440 and_l(~0x00020000, &GPIO1_OUT); /* Start with the backlight ON */ 429 and_l(~0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
@@ -454,22 +443,77 @@ void backlight_init(void)
454#endif 443#endif
455} 444}
456 445
457#else /* no backlight, empty dummy functions */ 446void backlight_on(void)
447{
448 queue_post(&backlight_queue, BACKLIGHT_ON, NULL);
449}
458 450
459void backlight_init(void) 451void backlight_off(void)
460{ 452{
461#if defined(IRIVER_H300_SERIES) && defined(BOOTLOADER) 453 queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
462 or_l(0x00020000, &GPIO1_OUT); 454}
463 or_l(0x00020000, &GPIO1_ENABLE); 455
464 or_l(0x00020000, &GPIO1_FUNCTION); 456int backlight_get_timeout(void)
457{
458 return backlight_timeout;
459}
460
461void backlight_set_timeout(int index)
462{
463 if((unsigned)index >= sizeof(backlight_timeout_value))
464 /* if given a weird value, use 0 */
465 index=0;
466 backlight_timeout = index; /* index in the backlight_timeout_value table */
467 backlight_on();
468}
469
470#ifdef HAVE_CHARGING
471bool backlight_get_on_when_charging(void)
472{
473 return backlight_on_when_charging;
474}
475
476void backlight_set_on_when_charging(bool yesno)
477{
478 backlight_on_when_charging = yesno;
479 backlight_on();
480}
465#endif 481#endif
482
483#ifdef HAVE_REMOTE_LCD
484void remote_backlight_on(void)
485{
486 queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, NULL);
466} 487}
488
489void remote_backlight_off(void)
490{
491 queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, NULL);
492}
493
494void remote_backlight_set_timeout(int index)
495{
496 if((unsigned)index >= sizeof(backlight_timeout_value))
497 /* if given a weird value, use 0 */
498 index=0;
499 remote_backlight_timeout = index; /* index in the backlight_timeout_value table */
500 remote_backlight_on();
501}
502
503#ifdef HAVE_CHARGING
504void remote_backlight_set_on_when_charging(bool yesno)
505{
506 remote_backlight_on_when_charging = yesno;
507 remote_backlight_on();
508}
509#endif
510#endif /* HAVE_REMOTE_LCD */
511
512#else /* no backlight, empty dummy functions */
513
467void backlight_on(void) {} 514void backlight_on(void) {}
468void backlight_off(void) {} 515void backlight_off(void) {}
469void backlight_tick(void) {}
470int backlight_get_timeout(void) {return 0;}
471void backlight_set_timeout(int index) {(void)index;} 516void backlight_set_timeout(int index) {(void)index;}
472void backlight_set_on_when_charging(bool yesno) {(void)yesno;}
473#ifdef HAVE_REMOTE_LCD 517#ifdef HAVE_REMOTE_LCD
474void remote_backlight_on(void) {} 518void remote_backlight_on(void) {}
475void remote_backlight_off(void) {} 519void remote_backlight_off(void) {}
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 918705eb4f..c764e1392f 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -181,8 +181,6 @@ static void button_tick(void)
181 lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT); 181 lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT);
182 tick = 0; 182 tick = 0;
183 } 183 }
184
185 backlight_tick();
186} 184}
187 185
188long button_get(bool block) 186long button_get(bool block)
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c
index 02a907dc89..05e7791cbb 100644
--- a/firmware/drivers/lcd-h100-remote.c
+++ b/firmware/drivers/lcd-h100-remote.c
@@ -122,24 +122,6 @@ static const char scroll_tick_table[16] = {
122/*** driver routines ***/ 122/*** driver routines ***/
123 123
124#ifndef SIMULATOR 124#ifndef SIMULATOR
125void lcd_remote_backlight_on(void)
126{
127#ifdef IRIVER_H300_SERIES
128 and_l(~0x00000002, &GPIO1_OUT);
129#else
130 and_l(~0x00000800, &GPIO_OUT);
131#endif
132}
133
134void lcd_remote_backlight_off(void)
135{
136#ifdef IRIVER_H300_SERIES
137 or_l(0x00000002, &GPIO1_OUT);
138#else
139 or_l(0x00000800, &GPIO_OUT);
140#endif
141}
142
143void lcd_remote_write_command(int cmd) 125void lcd_remote_write_command(int cmd)
144{ 126{
145 int i; 127 int i;
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index 6fee2c0db5..6d3d4d5451 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -21,24 +21,32 @@
21 21
22#include "config.h" 22#include "config.h"
23 23
24void backlight_init(void);
25void backlight_on(void); 24void backlight_on(void);
26void backlight_off(void); 25void backlight_off(void);
27void backlight_tick(void);
28int backlight_get_timeout(void);
29void backlight_set_timeout(int index); 26void backlight_set_timeout(int index);
27#ifdef CONFIG_BACKLIGHT
28void backlight_init(void);
29int backlight_get_timeout(void);
30#if CONFIG_BACKLIGHT == BL_IRIVER_H100 30#if CONFIG_BACKLIGHT == BL_IRIVER_H100
31void backlight_set_fade_in(int index); 31void backlight_set_fade_in(int index);
32void backlight_set_fade_out(int index); 32void backlight_set_fade_out(int index);
33#endif 33#endif
34bool backlight_get_on_when_charging(void); 34bool backlight_get_on_when_charging(void);
35void backlight_set_on_when_charging(bool yesno); 35void backlight_set_on_when_charging(bool yesno);
36void remote_backlight_on(void);
37void remote_backlight_off(void);
38extern const char backlight_timeout_value[]; 36extern const char backlight_timeout_value[];
37#else
38#define backlight_init()
39#endif
39 40
40#ifdef HAVE_REMOTE_LCD 41#ifdef HAVE_REMOTE_LCD
42void remote_backlight_on(void);
43void remote_backlight_off(void);
41void remote_backlight_set_timeout(int index); 44void remote_backlight_set_timeout(int index);
45void remote_backlight_set_on_when_charging(bool yesno);
42#endif 46#endif
43 47
48#ifdef SIMULATOR
49void sim_backlight(int value);
50void sim_remote_backlight(int value);
51#endif
44#endif 52#endif
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index ac6f37c8c9..28d8239c22 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -32,6 +32,9 @@
32/* Define this for S/PDIF input available */ 32/* Define this for S/PDIF input available */
33#define HAVE_SPDIF_IN 33#define HAVE_SPDIF_IN
34 34
35/* Define this for LCD backlight available */
36#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
37
35#ifndef SIMULATOR 38#ifndef SIMULATOR
36 39
37/* Define this if you have a SH7034 */ 40/* Define this if you have a SH7034 */
@@ -83,9 +86,6 @@
83/* Software controlled LED */ 86/* Software controlled LED */
84#define CONFIG_LED LED_REAL 87#define CONFIG_LED LED_REAL
85 88
86/* Define this for LCD backlight available */
87#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
88
89/* define this if the unit can be powered or charged via USB */ 89/* define this if the unit can be powered or charged via USB */
90#define HAVE_USB_POWER 90#define HAVE_USB_POWER
91 91
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index ef13380538..1327be7e27 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -38,6 +38,9 @@
38 38
39#define CONFIG_LCD LCD_S1D15E06 39#define CONFIG_LCD LCD_S1D15E06
40 40
41/* Define this for LCD backlight available */
42#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
43
41/* Define this if you have a software controlled poweroff */ 44/* Define this if you have a software controlled poweroff */
42#define HAVE_SW_POWEROFF 45#define HAVE_SW_POWEROFF
43 46
@@ -77,9 +80,6 @@
77/* The size of the flash ROM */ 80/* The size of the flash ROM */
78#define FLASH_SIZE 0x200000 81#define FLASH_SIZE 0x200000
79 82
80/* Define this for LCD backlight available */
81#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
82
83/* Define this to the CPU frequency */ 83/* Define this to the CPU frequency */
84#define CPU_FREQ 11289600 84#define CPU_FREQ 11289600
85 85
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index d67973c0b3..fd001a470e 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -31,6 +31,9 @@
31 31
32#define CONFIG_LCD LCD_S1D15E06 32#define CONFIG_LCD LCD_S1D15E06
33 33
34/* Define this for LCD backlight available */
35#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
36
34/* Define this if you have a software controlled poweroff */ 37/* Define this if you have a software controlled poweroff */
35#define HAVE_SW_POWEROFF 38#define HAVE_SW_POWEROFF
36 39
@@ -72,9 +75,6 @@
72/* The size of the flash ROM */ 75/* The size of the flash ROM */
73#define FLASH_SIZE 0x200000 76#define FLASH_SIZE 0x200000
74 77
75/* Define this for LCD backlight available */
76#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
77
78/* Define this to the CPU frequency */ 78/* Define this to the CPU frequency */
79#define CPU_FREQ 11289600 79#define CPU_FREQ 11289600
80 80
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 256cdeac77..5524a55dc0 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -36,6 +36,9 @@
36/* Define this if you have an remote lcd */ 36/* Define this if you have an remote lcd */
37#define HAVE_REMOTE_LCD 37#define HAVE_REMOTE_LCD
38 38
39/* Define this for LCD backlight available */
40#define CONFIG_BACKLIGHT BL_IRIVER_H300 /* port controlled PWM */
41
39/* Define this if you have a software controlled poweroff */ 42/* Define this if you have a software controlled poweroff */
40#define HAVE_SW_POWEROFF 43#define HAVE_SW_POWEROFF
41 44
@@ -69,9 +72,6 @@
69/* The size of the flash ROM */ 72/* The size of the flash ROM */
70#define FLASH_SIZE 0x400000 73#define FLASH_SIZE 0x400000
71 74
72/* Define this for LCD backlight available */
73#define CONFIG_BACKLIGHT BL_IRIVER_H300 /* port controlled PWM */
74
75/* Define this to the CPU frequency */ 75/* Define this to the CPU frequency */
76#define CPU_FREQ 11289600 76#define CPU_FREQ 11289600
77 77
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 0e1637d765..c1068b06eb 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -38,6 +38,9 @@
38/* Define this if you have the WM8975 audio codec */ 38/* Define this if you have the WM8975 audio codec */
39#define HAVE_WM8975 39#define HAVE_WM8975
40 40
41/* Define this for LCD backlight available */
42#define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */
43
41#ifndef SIMULATOR 44#ifndef SIMULATOR
42 45
43/* Define this if you have a PortalPlayer PP5020 */ 46/* Define this if you have a PortalPlayer PP5020 */
@@ -60,9 +63,6 @@
60/* The start address index for ROM builds */ 63/* The start address index for ROM builds */
61#define ROM_START 0x00000000 64#define ROM_START 0x00000000
62 65
63/* Define this for LCD backlight available */
64#define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */
65
66/* Define this to the CPU frequency */ 66/* Define this to the CPU frequency */
67#define CPU_FREQ 11289600 67#define CPU_FREQ 11289600
68 68
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index 3423079be0..99eb67b5bf 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -38,6 +38,9 @@
38/* Define this if you have the WM8975 audio codec */ 38/* Define this if you have the WM8975 audio codec */
39#define HAVE_WM8975 39#define HAVE_WM8975
40 40
41/* Define this for LCD backlight available */
42#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */
43
41#ifndef SIMULATOR 44#ifndef SIMULATOR
42 45
43/* The Nano actually has a PP5021 - but it's register compatible with 46/* The Nano actually has a PP5021 - but it's register compatible with
@@ -62,9 +65,6 @@
62/* The start address index for ROM builds */ 65/* The start address index for ROM builds */
63#define ROM_START 0x00000000 66#define ROM_START 0x00000000
64 67
65/* Define this for LCD backlight available */
66#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */
67
68/* Define this to the CPU frequency */ 68/* Define this to the CPU frequency */
69#define CPU_FREQ 11289600 69#define CPU_FREQ 11289600
70 70
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h
index e12e2234e1..f3b1bbddd7 100644
--- a/firmware/export/config-player.h
+++ b/firmware/export/config-player.h
@@ -20,6 +20,9 @@
20/* Define this if you have a DAC3550A */ 20/* Define this if you have a DAC3550A */
21#define HAVE_DAC3550A 21#define HAVE_DAC3550A
22 22
23/* Define this for LCD backlight available */
24#define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */
25
23#ifndef SIMULATOR 26#ifndef SIMULATOR
24 27
25/* Define this if you have a SH7034 */ 28/* Define this if you have a SH7034 */
@@ -70,9 +73,6 @@
70/* Software controlled LED */ 73/* Software controlled LED */
71#define CONFIG_LED LED_REAL 74#define CONFIG_LED LED_REAL
72 75
73/* Define this for LCD backlight available */
74#define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */
75
76#define CONFIG_LCD LCD_SSD1801 76#define CONFIG_LCD LCD_SSD1801
77 77
78#define BOOTFILE_EXT "mod" 78#define BOOTFILE_EXT "mod"
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index c674b63996..32c29b2ec5 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -26,6 +26,9 @@
26/* Define this for S/PDIF input available */ 26/* Define this for S/PDIF input available */
27#define HAVE_SPDIF_IN 27#define HAVE_SPDIF_IN
28 28
29/* Define this for LCD backlight available */
30#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
31
29#ifndef SIMULATOR 32#ifndef SIMULATOR
30 33
31/* Define this if you have a SH7034 */ 34/* Define this if you have a SH7034 */
@@ -74,9 +77,6 @@
74/* Software controlled LED */ 77/* Software controlled LED */
75#define CONFIG_LED LED_REAL 78#define CONFIG_LED LED_REAL
76 79
77/* Define this for LCD backlight available */
78#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
79
80/* Define this for S/PDIF output available */ 80/* Define this for S/PDIF output available */
81#define HAVE_SPDIF_OUT 81#define HAVE_SPDIF_OUT
82 82
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 1de321799e..fbe99812dc 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -29,6 +29,9 @@
29/* Define this for S/PDIF input available */ 29/* Define this for S/PDIF input available */
30#define HAVE_SPDIF_IN 30#define HAVE_SPDIF_IN
31 31
32/* Define this for LCD backlight available */
33#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
34
32#ifndef SIMULATOR 35#ifndef SIMULATOR
33 36
34/* Define this if you have a SH7034 */ 37/* Define this if you have a SH7034 */
@@ -83,9 +86,6 @@
83/* Software controlled LED */ 86/* Software controlled LED */
84#define CONFIG_LED LED_REAL 87#define CONFIG_LED LED_REAL
85 88
86/* Define this for LCD backlight available */
87#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
88
89/* define this if the unit can be powered or charged via USB */ 89/* define this if the unit can be powered or charged via USB */
90#define HAVE_USB_POWER 90#define HAVE_USB_POWER
91 91
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index 6d5091fc66..491e055b17 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -30,8 +30,6 @@
30#define STYLE_INVERT 1 30#define STYLE_INVERT 1
31 31
32extern void lcd_remote_init(void); 32extern void lcd_remote_init(void);
33extern void lcd_remote_backlight_on(void);
34extern void lcd_remote_backlight_off(void);
35extern int lcd_remote_default_contrast(void); 33extern int lcd_remote_default_contrast(void);
36extern void lcd_remote_set_contrast(int val); 34extern void lcd_remote_set_contrast(int val);
37extern void lcd_remote_emireduce(bool state); 35extern void lcd_remote_emireduce(bool state);
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index ed3f42287c..72a9b90e78 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -448,7 +448,7 @@ static int runcurrent(void)
448 current = CURRENT_USB; 448 current = CURRENT_USB;
449 } 449 }
450 450
451#ifndef BOOTLOADER 451#if defined(CONFIG_BACKLIGHT) && !defined(BOOTLOADER)
452 if ((backlight_get_timeout() == 1) /* LED always on */ 452 if ((backlight_get_timeout() == 1) /* LED always on */
453#ifdef HAVE_CHARGE_CTRL 453#ifdef HAVE_CHARGE_CTRL
454 || (charger_inserted() && backlight_get_on_when_charging()) 454 || (charger_inserted() && backlight_get_on_when_charging())
@@ -915,13 +915,11 @@ void shutdown_hw(void)
915#elif HAVE_TLV320 915#elif HAVE_TLV320
916 tlv320_close(); 916 tlv320_close();
917#endif 917#endif
918#if CONFIG_KEYPAD == ONDIO_PAD
919 backlight_off(); 918 backlight_off();
920 sleep(1);
921 lcd_set_contrast(0); 919 lcd_set_contrast(0);
922#endif
923#ifdef HAVE_REMOTE_LCD 920#ifdef HAVE_REMOTE_LCD
924 lcd_remote_backlight_off(); 921 remote_backlight_off();
922 lcd_remote_set_contrast(0);
925#endif 923#endif
926 power_off(); 924 power_off();
927#endif /* #ifndef SIMULATOR */ 925#endif /* #ifndef SIMULATOR */