make the runtime view nicer.
[Rockbox.git] / firmware / backlight.c
blob1ec8bf0933fde4f1f8716abb95682f300e0ecb4b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include "config.h"
20 #include <stdlib.h>
21 #include "cpu.h"
22 #include "kernel.h"
23 #include "thread.h"
24 #include "i2c.h"
25 #include "debug.h"
26 #include "rtc.h"
27 #include "usb.h"
28 #include "power.h"
29 #include "system.h"
30 #include "button.h"
31 #include "timer.h"
32 #include "backlight.h"
34 #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
35 #include "lcd.h" /* for lcd_enable() and lcd_sleep() */
36 #endif
37 #ifdef HAVE_REMOTE_LCD
38 #include "lcd-remote.h"
39 #endif
40 #if defined(TARGET_TREE) && !defined(SIMULATOR)
41 #include "backlight-target.h"
42 #endif
44 #ifdef SIMULATOR
45 static inline void __backlight_on(void)
47 sim_backlight(100);
50 static inline void __backlight_off(void)
52 sim_backlight(0);
55 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
56 static inline void __backlight_set_brightness(int val)
58 (void)val;
60 #endif
62 #else
63 /* Basic low-level code that simply switches backlight on or off. Probably
64 * a nice candidate for inclusion in the target/ dir. */
65 #ifndef TARGET_TREE
66 static inline void __backlight_on(void)
68 #if CONFIG_BACKLIGHT == BL_RTC
69 /* Enable square wave */
70 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
71 #elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
72 and_b(~0x40, &PADRH); /* drive and set low */
73 or_b(0x40, &PAIORH);
74 #elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
75 or_b(0x40, &PADRH); /* drive it high */
76 #endif
79 static inline void __backlight_off(void)
81 #if CONFIG_BACKLIGHT == BL_RTC
82 /* Disable square wave */
83 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
84 #elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
85 and_b(~0x40, &PAIORH); /* let it float (up) */
86 #elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
87 and_b(~0x40, &PADRH); /* drive it low */
88 #endif
90 #endif
91 #endif /* SIMULATOR */
93 #if CONFIG_BACKLIGHT && !defined(BOOTLOADER)
95 const signed char backlight_timeout_value[19] =
97 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90
100 #define BACKLIGHT_ON 1
101 #define BACKLIGHT_OFF 2
102 #define REMOTE_BACKLIGHT_ON 3
103 #define REMOTE_BACKLIGHT_OFF 4
104 #define BACKLIGHT_UNBOOST_CPU 5
105 #ifdef HAVE_LCD_SLEEP
106 #define LCD_SLEEP 6
107 #endif
109 static void backlight_thread(void);
110 static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
111 #ifdef X5_BACKLIGHT_SHUTDOWN
112 #define BACKLIGHT_QUIT 256
113 #endif
114 static const char backlight_thread_name[] = "backlight";
115 static struct event_queue backlight_queue;
117 static int backlight_timer;
118 static int backlight_timeout = 5*HZ;
119 #if CONFIG_CHARGING
120 static int backlight_timeout_plugged = 5*HZ;
121 #endif
122 #ifdef HAS_BUTTON_HOLD
123 static int backlight_on_button_hold = 0;
124 #endif
126 #ifdef HAVE_REMOTE_LCD
127 static int remote_backlight_timer;
128 static int remote_backlight_timeout = 5*HZ;
129 #if CONFIG_CHARGING
130 static int remote_backlight_timeout_plugged = 5*HZ;
131 #endif
132 #ifdef HAS_REMOTE_BUTTON_HOLD
133 static int remote_backlight_on_button_hold = 0;
134 #endif
135 #endif
137 #ifdef HAVE_LCD_SLEEP
138 const signed char lcd_sleep_timeout_value[10] =
140 -1, 0, 5, 10, 15, 20, 30, 45, 60, 90
142 static int lcd_sleep_timer;
143 static int lcd_sleep_timeout = 10*HZ;
144 #endif
146 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
147 /* backlight fading */
148 #define BL_PWM_INTERVAL 5000 /* Cycle interval in s */
149 #define BL_PWM_COUNT 100
150 static const char backlight_fade_value[8] = { 0, 1, 2, 4, 6, 8, 10, 20 };
151 static int fade_in_count = 1;
152 static int fade_out_count = 4;
154 static bool bl_timer_active = false;
155 static int bl_dim_current = 0;
156 static int bl_dim_target = 0;
157 static int bl_pwm_counter = 0;
158 static volatile int bl_cycle_counter = 0;
159 static enum {DIM_STATE_START, DIM_STATE_MAIN} bl_dim_state = DIM_STATE_START;
161 static void backlight_isr(void)
163 int timer_period;
164 bool idle = false;
166 timer_period = TIMER_FREQ / 1000 * BL_PWM_INTERVAL / 1000;
167 switch (bl_dim_state)
169 /* New cycle */
170 case DIM_STATE_START:
171 bl_pwm_counter = 0;
172 bl_cycle_counter++;
174 if (bl_dim_current > 0 && bl_dim_current < BL_PWM_COUNT)
176 __backlight_on();
177 bl_pwm_counter = bl_dim_current;
178 timer_period = timer_period * bl_pwm_counter / BL_PWM_COUNT;
179 bl_dim_state = DIM_STATE_MAIN;
181 else
183 if (bl_dim_current)
184 __backlight_on();
185 else
186 __backlight_off();
187 if (bl_dim_current == bl_dim_target)
188 idle = true;
191 break ;
193 /* Dim main screen */
194 case DIM_STATE_MAIN:
195 __backlight_off();
196 bl_dim_state = DIM_STATE_START;
197 timer_period = timer_period * (BL_PWM_COUNT - bl_pwm_counter) / BL_PWM_COUNT;
198 break ;
201 if ((bl_dim_target > bl_dim_current) && (bl_cycle_counter >= fade_in_count))
203 bl_dim_current++;
204 bl_cycle_counter = 0;
207 if ((bl_dim_target < bl_dim_current) && (bl_cycle_counter >= fade_out_count))
209 bl_dim_current--;
210 bl_cycle_counter = 0;
213 if (idle)
215 #ifdef CPU_COLDFIRE
216 queue_post(&backlight_queue, BACKLIGHT_UNBOOST_CPU, 0);
217 #endif
218 timer_unregister();
219 bl_timer_active = false;
221 else
222 timer_set_period(timer_period);
225 static void backlight_switch(void)
227 if (bl_dim_target > (BL_PWM_COUNT/2))
229 __backlight_on();
230 bl_dim_current = BL_PWM_COUNT;
232 else
234 __backlight_off();
235 bl_dim_current = 0;
239 static void backlight_release_timer(void)
241 #ifdef CPU_COLDFIRE
242 cpu_boost(false);
243 #endif
244 timer_unregister();
245 bl_timer_active = false;
246 backlight_switch();
249 static void backlight_dim(int value)
251 /* protect from extraneous calls with the same target value */
252 if (value == bl_dim_target)
253 return;
255 bl_dim_target = value;
257 if (bl_timer_active)
258 return ;
260 if (timer_register(0, backlight_release_timer, 2, 0, backlight_isr))
262 #ifdef CPU_COLDFIRE
263 /* Prevent cpu frequency changes while dimming. */
264 cpu_boost(true);
265 #endif
266 bl_timer_active = true;
268 else
269 backlight_switch();
272 void backlight_set_fade_in(int index)
274 fade_in_count = backlight_fade_value[index];
277 void backlight_set_fade_out(int index)
279 fade_out_count = backlight_fade_value[index];
281 #endif /* defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) */
283 static void _backlight_on(void)
285 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
286 if (fade_in_count > 0)
287 backlight_dim(BL_PWM_COUNT);
288 else
290 bl_dim_target = bl_dim_current = BL_PWM_COUNT;
291 __backlight_on();
293 #elif defined(HAVE_BACKLIGHT_SET_FADING) && !defined(SIMULATOR)
294 /* call the enable from here - it takes longer than the disable */
295 lcd_enable(true);
296 __backlight_dim(false);
297 #else
298 __backlight_on();
299 #endif
300 #ifdef HAVE_LCD_SLEEP
301 lcd_sleep_timer = 0; /* LCD should be awake already */
302 #endif
305 static void _backlight_off(void)
307 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
308 if (fade_out_count > 0)
309 backlight_dim(0);
310 else
312 bl_dim_target = bl_dim_current = 0;
313 __backlight_off();
315 #elif defined(HAVE_BACKLIGHT_SET_FADING) && !defined(SIMULATOR)
316 __backlight_dim(true);
317 #else
318 __backlight_off();
319 #endif
321 #ifdef HAVE_LCD_SLEEP
322 /* Start LCD sleep countdown */
323 if (lcd_sleep_timeout < 0)
325 lcd_sleep_timer = 0; /* Setting == Always */
326 lcd_sleep();
328 else
329 lcd_sleep_timer = lcd_sleep_timeout;
330 #endif
333 #ifdef HAVE_REMOTE_LCD
334 #ifdef SIMULATOR
335 static void __remote_backlight_on(void)
337 sim_remote_backlight(100);
340 static void __remote_backlight_off(void)
342 sim_remote_backlight(0);
344 #endif /* SIMULATOR */
345 #endif /* HAVE_REMOTE_LCD */
347 /* Update state of backlight according to timeout setting */
348 static void backlight_update_state(void)
350 #if CONFIG_CHARGING
351 if (charger_inserted()
352 #ifdef HAVE_USB_POWER
353 || usb_powered()
354 #endif
356 backlight_timer = backlight_timeout_plugged;
357 else
358 #endif
359 backlight_timer = backlight_timeout;
361 /* Backlight == OFF in the setting? */
362 if (backlight_timer < 0)
364 backlight_timer = 0; /* Disable the timeout */
365 #ifdef HAS_BUTTON_HOLD
366 if (backlight_on_button_hold == 2 && button_hold())
367 return; /* Keep on if "On" */
368 #endif
369 _backlight_off();
371 else
373 #ifdef HAS_BUTTON_HOLD
374 if (backlight_on_button_hold == 1 && button_hold())
376 /* Keep off if "Off". */
377 backlight_timer = 0; /* Disable the timeout */
378 return;
380 #endif
381 _backlight_on();
385 #ifdef HAVE_REMOTE_LCD
386 /* Update state of remote backlight according to timeout setting */
387 static void remote_backlight_update_state(void)
389 #if CONFIG_CHARGING
390 if (charger_inserted()
391 #ifdef HAVE_USB_POWER
392 || usb_powered()
393 #endif
395 remote_backlight_timer = remote_backlight_timeout_plugged;
396 else
397 #endif
398 remote_backlight_timer = remote_backlight_timeout;
400 /* Backlight == OFF in the setting? */
401 if (remote_backlight_timer < 0)
403 remote_backlight_timer = 0; /* Disable the timeout */
404 #ifdef HAS_REMOTE_BUTTON_HOLD
405 if (remote_backlight_on_button_hold == 2 && remote_button_hold())
406 return; /* Keep on if "On" */
407 #endif
408 __remote_backlight_off();
410 else
412 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
413 if (remote_type() == REMOTETYPE_H300_NONLCD)
415 backlight_update_state();
417 else
418 #endif
420 #ifdef HAS_REMOTE_BUTTON_HOLD
421 if (remote_backlight_on_button_hold == 1 && remote_button_hold())
423 /* Keep off if "Off". */
424 remote_backlight_timer = 0; /* Disable the timeout */
425 return;
427 #endif
428 __remote_backlight_on();
432 #endif /* HAVE_REMOTE_LCD */
434 void backlight_thread(void)
436 struct event ev;
438 while(1)
440 queue_wait(&backlight_queue, &ev);
441 switch(ev.id)
443 #ifdef HAVE_REMOTE_LCD
444 case REMOTE_BACKLIGHT_ON:
445 remote_backlight_update_state();
446 break;
448 case REMOTE_BACKLIGHT_OFF:
449 remote_backlight_timer = 0; /* Disable the timeout */
450 #ifdef HAS_REMOTE_BUTTON_HOLD
451 if (remote_backlight_on_button_hold == 2 &&
452 remote_button_hold())
453 break; /* Keep on if "On" */
454 #endif
455 __remote_backlight_off();
456 break;
457 #endif /* HAVE_REMOTE_LCD */
459 case BACKLIGHT_ON:
460 backlight_update_state();
461 break;
463 case BACKLIGHT_OFF:
464 backlight_timer = 0; /* Disable the timeout */
465 #ifdef HAS_BUTTON_HOLD
466 if (backlight_on_button_hold == 2 && button_hold())
467 break; /* Keep on if "On" */
468 #endif
469 _backlight_off();
470 break;
472 #ifdef HAVE_LCD_SLEEP
473 case LCD_SLEEP:
474 lcd_sleep();
475 break;
476 #endif
478 #ifdef X5_BACKLIGHT_SHUTDOWN
479 case BACKLIGHT_QUIT:
480 remove_thread(NULL);
481 break;
482 #endif
484 #if defined(HAVE_BACKLIGHT_PWM_FADING) && defined(CPU_COLDFIRE) \
485 && !defined(SIMULATOR)
486 case BACKLIGHT_UNBOOST_CPU:
487 cpu_boost(false);
488 break;
489 #endif
491 case SYS_USB_CONNECTED:
492 /* Tell the USB thread that we are safe */
493 DEBUGF("backlight_thread got SYS_USB_CONNECTED\n");
494 usb_acknowledge(SYS_USB_CONNECTED_ACK);
495 break;
497 case SYS_USB_DISCONNECTED:
498 usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
499 break;
500 } /* end switch */
501 } /* end while */
504 static void backlight_tick(void)
506 #if CONFIG_CHARGING
507 static bool charger_was_inserted = false;
508 bool charger_is_inserted = charger_inserted()
509 #ifdef HAVE_USB_POWER
510 || usb_powered()
511 #endif
514 if( charger_was_inserted != charger_is_inserted )
516 backlight_on();
517 #ifdef HAVE_REMOTE_LCD
518 remote_backlight_on();
519 #endif
521 charger_was_inserted = charger_is_inserted;
522 #endif /* CONFIG_CHARGING */
524 if(backlight_timer)
526 backlight_timer--;
527 if(backlight_timer == 0)
529 backlight_off();
532 #ifdef HAVE_LCD_SLEEP
533 else if(lcd_sleep_timer)
535 lcd_sleep_timer--;
536 if(lcd_sleep_timer == 0)
538 /* Queue on bl thread or freeze! */
539 queue_post(&backlight_queue, LCD_SLEEP, 0);
542 #endif /* HAVE_LCD_SLEEP */
544 #ifdef HAVE_REMOTE_LCD
545 if(remote_backlight_timer)
547 remote_backlight_timer--;
548 if(remote_backlight_timer == 0)
550 remote_backlight_off();
553 #endif /* HAVE_REMOVE_LCD */
556 void backlight_init(void)
558 queue_init(&backlight_queue, true);
559 queue_set_irq_safe(&backlight_queue, true);
561 #ifdef SIMULATOR
562 /* do nothing */
563 #elif defined(__BACKLIGHT_INIT)
564 /* Remove the __BACKLIGHT_INIT references when __backlight_init is
565 available on all backlighted targets. Take them out of the
566 backlight-target.h files as well */
567 if (__backlight_init())
569 # if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
570 /* If backlight is already on, don't fade in. */
571 bl_dim_current = BL_PWM_COUNT;
572 bl_dim_target = BL_PWM_COUNT;
573 # endif
575 #elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
576 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
577 or_b(0x40, &PAIORH); /* ..and output */
578 #endif
579 backlight_on();
580 #ifdef HAVE_REMOTE_LCD
581 remote_backlight_on();
582 #endif
584 create_thread(backlight_thread, backlight_stack,
585 sizeof(backlight_stack), backlight_thread_name
586 IF_PRIO(, PRIORITY_SYSTEM)
587 IF_COP(, CPU, false));
588 tick_add_task(backlight_tick);
591 #ifdef X5_BACKLIGHT_SHUTDOWN
592 void x5_backlight_shutdown(void)
594 /* Turn on the screen and don't let anyone else mess with it. Called
595 from clean_shutdown in misc.c. */
596 queue_empty(&backlight_queue);
597 tick_remove_task(backlight_tick);
598 /* Next time the thread runs, if at all, it will just remove itself. */
599 queue_post(&backlight_queue, BACKLIGHT_QUIT, 0);
600 __backlight_on();
602 #endif /* X5_BACKLIGHT_SHUTDOWN */
604 void backlight_on(void)
606 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
607 queue_post(&backlight_queue, BACKLIGHT_ON, 0);
610 void backlight_off(void)
612 queue_post(&backlight_queue, BACKLIGHT_OFF, 0);
615 /* returns true when the backlight is on OR when it's set to always off */
616 bool is_backlight_on(void)
618 if (backlight_timer || backlight_get_current_timeout() <= 0)
619 return true;
620 else
621 return false;
624 /* return value in ticks; 0 means always on, <0 means always off */
625 int backlight_get_current_timeout(void)
627 #if CONFIG_CHARGING
628 if (charger_inserted()
629 #ifdef HAVE_USB_POWER
630 || usb_powered()
631 #endif
633 return backlight_timeout_plugged;
634 else
635 return backlight_timeout;
636 #else
637 return backlight_timeout;
638 #endif
641 void backlight_set_timeout(int index)
643 if((unsigned)index >= sizeof(backlight_timeout_value))
644 /* if given a weird value, use default */
645 index = 6;
646 backlight_timeout = HZ * backlight_timeout_value[index];
647 backlight_update_state();
650 #if CONFIG_CHARGING
651 void backlight_set_timeout_plugged(int index)
653 if((unsigned)index >= sizeof(backlight_timeout_value))
654 /* if given a weird value, use default */
655 index = 6;
656 backlight_timeout_plugged = HZ * backlight_timeout_value[index];
657 backlight_update_state();
659 #endif /* CONFIG_CHARGING */
661 #ifdef HAS_BUTTON_HOLD
662 /* Hold button change event handler. */
663 void backlight_hold_changed(bool hold_button)
665 /* Hold switch overrides all backlight behavior except when
666 set to "Normal" */
667 /* Queue or freeze */
668 if (hold_button && backlight_on_button_hold == 1)
669 backlight_off(); /* setting == Off */
670 else /* setting == On, Normal, no hold button, or anything else */
671 backlight_on();
674 void backlight_set_on_button_hold(int index)
676 if ((unsigned)index >= 3)
677 /* if given a weird value, use default */
678 index = 0;
680 if (index == backlight_on_button_hold)
681 return;
683 backlight_on_button_hold = index;
684 backlight_hold_changed(button_hold());
686 #endif /* HAS_BUTTON_HOLD */
688 #ifdef HAVE_LCD_SLEEP
689 void lcd_set_sleep_after_backlight_off(int index)
691 if ((unsigned)index >= sizeof(lcd_sleep_timeout_value))
692 /* if given a weird value, use default */
693 index = 3;
695 lcd_sleep_timeout = HZ * lcd_sleep_timeout_value[index];
697 if (backlight_timer > 0 || backlight_get_current_timeout() == 0)
698 /* Timer will be set when bl turns off or bl set to on. */
699 return;
701 /* Backlight is Off */
702 if (lcd_sleep_timeout < 0)
703 lcd_sleep_timer = 1; /* Always - sleep next tick */
704 else
705 lcd_sleep_timer = lcd_sleep_timeout; /* Never, other */
707 #endif /* HAVE_LCD_SLEEP */
709 #ifdef HAVE_REMOTE_LCD
710 void remote_backlight_on(void)
712 queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, 0);
715 void remote_backlight_off(void)
717 queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, 0);
720 void remote_backlight_set_timeout(int index)
722 if((unsigned)index >= sizeof(backlight_timeout_value))
723 /* if given a weird value, use default */
724 index=6;
725 remote_backlight_timeout = HZ * backlight_timeout_value[index];
726 remote_backlight_update_state();
729 #if CONFIG_CHARGING
730 void remote_backlight_set_timeout_plugged(int index)
732 if((unsigned)index >= sizeof(backlight_timeout_value))
733 /* if given a weird value, use default */
734 index=6;
735 remote_backlight_timeout_plugged = HZ * backlight_timeout_value[index];
736 remote_backlight_update_state();
738 #endif /* CONFIG_CHARGING */
740 #ifdef HAS_REMOTE_BUTTON_HOLD
741 /* Remote hold button change event handler. */
742 void remote_backlight_hold_changed(bool rc_hold_button)
744 /* Hold switch overrides all backlight behavior except when
745 set to "Normal" */
746 /* Queue or freeze */
747 if (rc_hold_button && remote_backlight_on_button_hold == 1)
748 remote_backlight_off(); /* setting == Off */
749 else /* setting == On, Normal, no hold button, or anything else */
750 remote_backlight_on();
754 void remote_backlight_set_on_button_hold(int index)
756 if ((unsigned)index >= 3)
757 /* if given a weird value, use default */
758 index = 0;
760 if (index == remote_backlight_on_button_hold)
761 return;
763 remote_backlight_on_button_hold = index;
764 remote_backlight_hold_changed(remote_button_hold());
766 #endif /* HAS_REMOTE_BUTTON_HOLD */
768 /* return value in ticks; 0 means always on, <0 means always off */
769 int remote_backlight_get_current_timeout(void)
771 #if CONFIG_CHARGING
772 if (charger_inserted()
773 #ifdef HAVE_USB_POWER
774 || usb_powered()
775 #endif
777 return remote_backlight_timeout_plugged;
778 else
779 return remote_backlight_timeout;
780 #else
781 return remote_backlight_timeout;
782 #endif
785 /* returns true when the backlight is on OR when it's set to always off */
786 bool is_remote_backlight_on(void)
788 if (remote_backlight_timer != 0 ||
789 remote_backlight_get_current_timeout() <= 0)
790 return true;
791 else
792 return false;
795 #endif /* HAVE_REMOTE_LCD */
797 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
798 void backlight_set_brightness(int val)
800 if (val < MIN_BRIGHTNESS_SETTING)
801 val = MIN_BRIGHTNESS_SETTING;
802 else if (val > MAX_BRIGHTNESS_SETTING)
803 val = MAX_BRIGHTNESS_SETTING;
805 __backlight_set_brightness(val);
807 #endif /* HAVE_BACKLIGHT_BRIGHTNESS */
809 #else /* (CONFIG_BACKLIGHT == 0) || defined(BOOTLOADER)
810 -- no backlight, empty dummy functions */
812 #if defined(BOOTLOADER) && CONFIG_BACKLIGHT
813 void backlight_init(void)
815 #ifdef __BACKLIGHT_INIT
816 __backlight_init();
817 __backlight_on();
818 #endif
820 #endif
822 void backlight_on(void) {}
823 void backlight_off(void) {}
824 void backlight_set_timeout(int index) {(void)index;}
825 bool is_backlight_on(void) {return true;}
826 #ifdef HAVE_REMOTE_LCD
827 void remote_backlight_on(void) {}
828 void remote_backlight_off(void) {}
829 void remote_backlight_set_timeout(int index) {(void)index;}
830 bool is_remote_backlight_on(void) {return true;}
831 #endif /* HAVE_REMOTE_LCD */
832 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
833 void backlight_set_brightness(int val) { (void)val; }
834 #endif
835 #endif /* CONFIG_BACKLIGHT && !defined(BOOTLOADER) */