1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
11 * Additional work by Martin Ritter (2007) and Thomas Martitz (2008)
12 * for backlight thread fading
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
36 #include "backlight.h"
39 #ifdef HAVE_REMOTE_LCD
40 #include "lcd-remote.h"
43 #include "backlight-target.h"
46 #if !defined(BOOTLOADER)
47 /* The whole driver should be built */
48 #define BACKLIGHT_FULL_INIT
51 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
52 int backlight_brightness
= DEFAULT_BRIGHTNESS_SETTING
;
55 #ifdef USE_BACKLIGHT_SW_FADING
56 #include "backlight-thread-fading.h"
59 /* TODO: find a better way to do it but we need a kernel thread somewhere to
61 extern void screen_dump(void);
63 static inline void _backlight_on(void)
68 static inline void _backlight_off(void)
73 static inline void _backlight_set_brightness(int val
)
78 static inline void _buttonlight_on(void)
82 static inline void _buttonlight_off(void)
86 static inline void _buttonlight_set_brightness(int val
)
90 #ifdef HAVE_REMOTE_LCD
91 static inline void _remote_backlight_on(void)
93 sim_remote_backlight(100);
96 static inline void _remote_backlight_off(void)
98 sim_remote_backlight(0);
100 #endif /* HAVE_REMOTE_LCD */
102 #endif /* SIMULATOR */
104 #if defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT)
109 #ifdef HAVE_REMOTE_LCD
111 REMOTE_BACKLIGHT_OFF
,
113 #if defined(_BACKLIGHT_FADE_BOOST) || defined(_BACKLIGHT_FADE_ENABLE)
114 BACKLIGHT_FADE_FINISH
,
116 #ifdef HAVE_LCD_SLEEP
119 #ifdef HAVE_BUTTON_LIGHT
123 #ifdef BACKLIGHT_DRIVER_CLOSE
128 static void backlight_thread(void);
129 static long backlight_stack
[DEFAULT_STACK_SIZE
/sizeof(long)];
130 static const char backlight_thread_name
[] = "backlight";
131 static struct event_queue backlight_queue
;
132 #ifdef BACKLIGHT_DRIVER_CLOSE
133 static struct thread_entry
*backlight_thread_p
= NULL
;
136 static int backlight_timer SHAREDBSS_ATTR
;
137 static int backlight_timeout SHAREDBSS_ATTR
;
138 static int backlight_timeout_normal
= 5*HZ
;
140 static int backlight_timeout_plugged
= 5*HZ
;
142 #ifdef HAS_BUTTON_HOLD
143 static int backlight_on_button_hold
= 0;
146 #ifdef HAVE_BUTTON_LIGHT
147 static int buttonlight_timer
;
148 int _buttonlight_timeout
= 5*HZ
;
150 /* Update state of buttonlight according to timeout setting */
151 static void buttonlight_update_state(void)
153 buttonlight_timer
= _buttonlight_timeout
;
155 /* Buttonlight == OFF in the setting? */
156 if (buttonlight_timer
< 0)
158 buttonlight_timer
= 0; /* Disable the timeout */
165 /* external interface */
166 void buttonlight_on(void)
168 queue_remove_from_head(&backlight_queue
, BUTTON_LIGHT_ON
);
169 queue_post(&backlight_queue
, BUTTON_LIGHT_ON
, 0);
172 void buttonlight_off(void)
174 queue_post(&backlight_queue
, BUTTON_LIGHT_OFF
, 0);
177 void buttonlight_set_timeout(int value
)
179 _buttonlight_timeout
= HZ
* value
;
180 buttonlight_update_state();
183 #endif /* HAVE_BUTTON_LIGHT */
185 #ifdef HAVE_REMOTE_LCD
186 static int remote_backlight_timer
;
187 static int remote_backlight_timeout
;
188 static int remote_backlight_timeout_normal
= 5*HZ
;
190 static int remote_backlight_timeout_plugged
= 5*HZ
;
192 #ifdef HAS_REMOTE_BUTTON_HOLD
193 static int remote_backlight_on_button_hold
= 0;
195 #endif /* HAVE_REMOTE_LCD */
197 #ifdef HAVE_LCD_SLEEP
198 #ifdef HAVE_LCD_SLEEP_SETTING
199 const signed char lcd_sleep_timeout_value
[10] =
201 -1, 0, 5, 10, 15, 20, 30, 45, 60, 90
203 static int lcd_sleep_timeout
= 10*HZ
;
205 /* Target defines needed value */
206 static const int lcd_sleep_timeout
= LCD_SLEEP_TIMEOUT
;
209 static int lcd_sleep_timer
= 0;
211 void backlight_lcd_sleep_countdown(bool start
)
215 /* Cancel the LCD sleep countdown */
220 /* Start LCD sleep countdown */
221 if (lcd_sleep_timeout
< 0)
223 lcd_sleep_timer
= 0; /* Setting == Always */
228 lcd_sleep_timer
= lcd_sleep_timeout
;
231 #endif /* HAVE_LCD_SLEEP */
233 #ifdef USE_BACKLIGHT_SW_FADING
234 static int backlight_fading_type
= (FADING_UP
|FADING_DOWN
);
235 static int backlight_fading_state
= NOT_FADING
;
239 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
240 /* backlight fading */
241 #define BL_PWM_INTERVAL 5 /* Cycle interval in ms */
242 #define BL_PWM_BITS 8
243 #define BL_PWM_COUNT (1<<BL_PWM_BITS)
245 /* s15.16 fixed point variables */
246 static int32_t bl_fade_in_step
= ((BL_PWM_INTERVAL
*BL_PWM_COUNT
)<<16)/300;
247 static int32_t bl_fade_out_step
= ((BL_PWM_INTERVAL
*BL_PWM_COUNT
)<<16)/2000;
248 static int32_t bl_dim_fraction
= 0;
250 static int bl_dim_target
= 0;
251 static int bl_dim_current
= 0;
252 static enum {DIM_STATE_START
, DIM_STATE_MAIN
} bl_dim_state
= DIM_STATE_START
;
253 static bool bl_timer_active
= false;
255 static void backlight_isr(void)
257 int timer_period
= (TIMER_FREQ
*BL_PWM_INTERVAL
/1000);
260 switch (bl_dim_state
)
263 case DIM_STATE_START
:
264 bl_dim_current
= bl_dim_fraction
>> 16;
266 if (bl_dim_current
> 0 && bl_dim_current
< BL_PWM_COUNT
)
269 timer_period
= (timer_period
* bl_dim_current
) >> BL_PWM_BITS
;
270 bl_dim_state
= DIM_STATE_MAIN
;
277 _backlight_off_isr();
278 if (bl_dim_current
== bl_dim_target
)
281 if (bl_dim_current
< bl_dim_target
)
283 bl_dim_fraction
= MIN(bl_dim_fraction
+ bl_fade_in_step
,
286 else if (bl_dim_current
> bl_dim_target
)
288 bl_dim_fraction
= MAX(bl_dim_fraction
- bl_fade_out_step
, 0);
292 /* Dim main screen */
294 _backlight_off_isr();
295 timer_period
= (timer_period
* (BL_PWM_COUNT
- bl_dim_current
))
297 bl_dim_state
= DIM_STATE_START
;
302 #if defined(_BACKLIGHT_FADE_BOOST) || defined(_BACKLIGHT_FADE_ENABLE)
303 queue_post(&backlight_queue
, BACKLIGHT_FADE_FINISH
, 0);
306 bl_timer_active
= false;
309 timer_set_period(timer_period
);
312 static void backlight_switch(void)
314 if (bl_dim_target
> (BL_PWM_COUNT
/2))
316 _backlight_on_normal();
317 bl_dim_fraction
= (BL_PWM_COUNT
<<16);
321 _backlight_off_normal();
326 static void backlight_release_timer(void)
328 #ifdef _BACKLIGHT_FADE_BOOST
332 bl_timer_active
= false;
336 static void backlight_dim(int value
)
338 /* protect from extraneous calls with the same target value */
339 if (value
== bl_dim_target
)
342 bl_dim_target
= value
;
347 if (timer_register(0, backlight_release_timer
, 2, 0, backlight_isr
350 #ifdef _BACKLIGHT_FADE_BOOST
351 /* Prevent cpu frequency changes while dimming. */
354 bl_timer_active
= true;
360 static void _backlight_on(void)
362 #ifdef HAVE_LCD_SLEEP
363 backlight_lcd_sleep_countdown(false);
366 if (bl_fade_in_step
> 0)
368 #ifdef _BACKLIGHT_FADE_ENABLE
369 _backlight_hw_enable(true);
371 backlight_dim(BL_PWM_COUNT
);
375 bl_dim_target
= BL_PWM_COUNT
;
376 bl_dim_fraction
= (BL_PWM_COUNT
<<16);
377 _backlight_on_normal();
381 static void _backlight_off(void)
383 if (bl_fade_out_step
> 0)
389 bl_dim_target
= bl_dim_fraction
= 0;
390 _backlight_off_normal();
393 #ifdef HAVE_LCD_SLEEP
394 backlight_lcd_sleep_countdown(true);
398 void backlight_set_fade_in(int value
)
401 bl_fade_in_step
= ((BL_PWM_INTERVAL
*BL_PWM_COUNT
)<<16) / value
;
406 void backlight_set_fade_out(int value
)
409 bl_fade_out_step
= ((BL_PWM_INTERVAL
*BL_PWM_COUNT
)<<16) / value
;
411 bl_fade_out_step
= 0;
413 #endif /* defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) */
415 #ifdef USE_BACKLIGHT_SW_FADING
417 void backlight_set_fade_out(bool value
)
420 backlight_fading_type
|= FADING_DOWN
;
422 backlight_fading_type
&= FADING_UP
;
425 void backlight_set_fade_in(bool value
)
428 backlight_fading_type
|= FADING_UP
;
430 backlight_fading_type
&= FADING_DOWN
;
433 static void backlight_set_up_fade_up(void)
435 if (backlight_fading_type
& FADING_UP
)
437 if (backlight_fading_state
== NOT_FADING
)
439 /* make sure the backlight is at lowest level */
442 backlight_fading_state
= FADING_UP
;
446 backlight_fading_state
= NOT_FADING
;
447 _backlight_fade_update_state(backlight_brightness
);
449 _backlight_set_brightness(backlight_brightness
);
453 static void backlight_set_up_fade_down(void)
455 if (backlight_fading_type
& FADING_DOWN
)
457 backlight_fading_state
= FADING_DOWN
;
461 backlight_fading_state
= NOT_FADING
;
462 _backlight_fade_update_state(MIN_BRIGHTNESS_SETTING
-1);
464 /* h300/x5/d2 go to the last known brightness level at backight_on(),which
465 * should be the lowest level to keep fading up glitch free
466 * sansa e200/c200 make the backlight on only by setting the brightness,
467 * so this step would be noticeable */
468 #if !defined(SANSA_E200) && !defined(SANSA_C200)
469 _backlight_set_brightness(MIN_BRIGHTNESS_SETTING
);
473 #endif /* USE_BACKLIGHT_SW_FADING */
475 /* Update state of backlight according to timeout setting */
476 static void backlight_update_state(void)
478 #ifdef HAS_BUTTON_HOLD
479 if ((backlight_on_button_hold
!= 0)
480 #ifdef HAVE_REMOTE_LCD_AS_MAIN
481 && remote_button_hold()
486 backlight_timeout
= (backlight_on_button_hold
== 2) ? 0 : -1;
487 /* always on or always off */
491 if (power_input_present())
492 backlight_timeout
= backlight_timeout_plugged
;
495 backlight_timeout
= backlight_timeout_normal
;
497 /* Backlight == OFF in the setting? */
498 if (UNLIKELY(backlight_timeout
< 0))
500 backlight_timer
= 0; /* Disable the timeout */
501 #ifdef USE_BACKLIGHT_SW_FADING
502 backlight_set_up_fade_down();
503 /* necessary step to issue fading down when the setting is selected */
504 queue_post(&backlight_queue
, SYS_TIMEOUT
, 0);
511 backlight_timer
= backlight_timeout
;
512 #if defined(USE_BACKLIGHT_SW_FADING)
513 backlight_set_up_fade_up();
520 #ifdef HAVE_REMOTE_LCD
521 /* Update state of remote backlight according to timeout setting */
522 static void remote_backlight_update_state(void)
524 #ifdef HAS_REMOTE_BUTTON_HOLD
525 if (remote_button_hold() && (remote_backlight_on_button_hold
!= 0))
526 remote_backlight_timeout
= (remote_backlight_on_button_hold
== 2)
527 ? 0 : -1; /* always on or always off */
531 if (power_input_present())
532 remote_backlight_timeout
= remote_backlight_timeout_plugged
;
535 remote_backlight_timeout
= remote_backlight_timeout_normal
;
537 /* Backlight == OFF in the setting? */
538 if (remote_backlight_timeout
< 0)
540 remote_backlight_timer
= 0; /* Disable the timeout */
541 _remote_backlight_off();
545 remote_backlight_timer
= remote_backlight_timeout
;
546 _remote_backlight_on();
549 #endif /* HAVE_REMOTE_LCD */
551 void backlight_thread(void)
553 struct queue_event ev
;
558 #if defined(USE_BACKLIGHT_SW_FADING)
559 if (backlight_fading_state
)
560 queue_wait_w_tmo(&backlight_queue
, &ev
, FADE_DELAY
);
563 queue_wait(&backlight_queue
, &ev
);
568 { /* These events must always be processed */
569 #ifdef _BACKLIGHT_FADE_BOOST
570 case BACKLIGHT_FADE_FINISH
:
574 #ifdef _BACKLIGHT_FADE_ENABLE
575 case BACKLIGHT_FADE_FINISH
:
576 _backlight_hw_enable((bl_dim_current
|bl_dim_target
) != 0);
581 /* Here for now or else the aggressive init messes up scrolling */
582 #ifdef HAVE_REMOTE_LCD
583 case SYS_REMOTE_PLUGGED
:
588 case SYS_REMOTE_UNPLUGGED
:
591 #elif defined HAVE_REMOTE_LCD_AS_MAIN
592 case SYS_REMOTE_PLUGGED
:
597 case SYS_REMOTE_UNPLUGGED
:
600 #endif /* HAVE_REMOTE_LCD/ HAVE_REMOTE_LCD_AS_MAIN */
601 #endif /* !SIMULATOR */
603 /* This one here too for lack of a better place */
608 case SYS_USB_CONNECTED
:
609 /* Tell the USB thread that we are safe */
610 DEBUGF("backlight_thread got SYS_USB_CONNECTED\n");
611 usb_acknowledge(SYS_USB_CONNECTED_ACK
);
614 case SYS_USB_DISCONNECTED
:
615 usb_acknowledge(SYS_USB_DISCONNECTED_ACK
);
618 #ifdef BACKLIGHT_DRIVER_CLOSE
619 /* Get out of here */
628 { /* These events are only processed if backlight isn't locked */
629 #ifdef HAVE_REMOTE_LCD
630 case REMOTE_BACKLIGHT_ON
:
631 remote_backlight_update_state();
634 case REMOTE_BACKLIGHT_OFF
:
635 remote_backlight_timer
= 0; /* Disable the timeout */
636 _remote_backlight_off();
638 #endif /* HAVE_REMOTE_LCD */
641 backlight_update_state();
645 backlight_timer
= 0; /* Disable the timeout */
646 #ifndef USE_BACKLIGHT_SW_FADING
649 backlight_set_up_fade_down();
650 #endif /* USE_BACKLIGHT_SW_FADING */
652 #ifdef HAVE_LCD_SLEEP
657 #ifdef HAVE_BUTTON_LIGHT
658 case BUTTON_LIGHT_ON
:
659 buttonlight_update_state();
662 case BUTTON_LIGHT_OFF
:
663 buttonlight_timer
= 0;
668 case SYS_POWEROFF
: /* Lock backlight on poweroff so it doesn't */
669 locked
= true; /* go off before power is actually cut. */
672 case SYS_CHARGER_CONNECTED
:
673 case SYS_CHARGER_DISCONNECTED
:
675 backlight_update_state();
676 #ifdef HAVE_REMOTE_LCD
677 remote_backlight_update_state();
680 #if defined(USE_BACKLIGHT_SW_FADING)
682 if ((_backlight_fade_step(backlight_fading_state
)))
683 backlight_fading_state
= NOT_FADING
;
685 #endif /* USE_BACKLIGHT_SW_FADING */
690 static void backlight_tick(void)
694 if(--backlight_timer
== 0)
699 #ifdef HAVE_LCD_SLEEP
700 else if(lcd_sleep_timer
)
702 if(--lcd_sleep_timer
== 0)
704 /* Queue on bl thread or freeze! */
705 queue_post(&backlight_queue
, LCD_SLEEP
, 0);
708 #endif /* HAVE_LCD_SLEEP */
709 #ifdef HAVE_REMOTE_LCD
710 if(remote_backlight_timer
)
712 if(--remote_backlight_timer
== 0)
714 remote_backlight_off();
717 #endif /* HAVE_REMOVE_LCD */
718 #ifdef HAVE_BUTTON_LIGHT
719 if (buttonlight_timer
)
721 if (--buttonlight_timer
== 0)
726 #endif /* HAVE_BUTTON_LIGHT */
729 void backlight_init(void)
731 queue_init(&backlight_queue
, true);
734 if (_backlight_init())
736 # ifdef HAVE_BACKLIGHT_PWM_FADING
737 /* If backlight is already on, don't fade in. */
738 bl_dim_target
= BL_PWM_COUNT
;
739 bl_dim_fraction
= (BL_PWM_COUNT
<<16);
743 /* Leave all lights as set by the bootloader here. The settings load will
744 * call the appropriate backlight_set_*() functions, only changing light
745 * status if necessary. */
746 #ifdef BACKLIGHT_DRIVER_CLOSE
749 create_thread(backlight_thread
, backlight_stack
,
750 sizeof(backlight_stack
), 0, backlight_thread_name
751 IF_PRIO(, PRIORITY_USER_INTERFACE
)
753 tick_add_task(backlight_tick
);
756 #ifdef BACKLIGHT_DRIVER_CLOSE
757 void backlight_close(void)
759 struct thread_entry
*thread
= backlight_thread_p
;
761 /* Wait for thread to exit */
765 backlight_thread_p
= NULL
;
767 queue_post(&backlight_queue
, BACKLIGHT_QUIT
, 0);
770 #endif /* BACKLIGHT_DRIVER_CLOSE */
772 void backlight_on(void)
774 queue_remove_from_head(&backlight_queue
, BACKLIGHT_ON
);
775 queue_post(&backlight_queue
, BACKLIGHT_ON
, 0);
778 void backlight_off(void)
780 queue_post(&backlight_queue
, BACKLIGHT_OFF
, 0);
783 /* returns true when the backlight is on,
784 * and optionally when it's set to always off. */
785 bool is_backlight_on(bool ignore_always_off
)
787 return (backlight_timer
> 0) /* countdown */
788 || (backlight_timeout
== 0) /* always on */
789 || ((backlight_timeout
< 0) && !ignore_always_off
);
792 /* return value in ticks; 0 means always on, <0 means always off */
793 int backlight_get_current_timeout(void)
795 return backlight_timeout
;
798 void backlight_set_timeout(int value
)
800 backlight_timeout_normal
= HZ
* value
;
801 backlight_update_state();
805 void backlight_set_timeout_plugged(int value
)
807 backlight_timeout_plugged
= HZ
* value
;
808 backlight_update_state();
810 #endif /* CONFIG_CHARGING */
812 #ifdef HAS_BUTTON_HOLD
813 /* Hold button change event handler. */
814 void backlight_hold_changed(bool hold_button
)
816 if (!hold_button
|| (backlight_on_button_hold
> 0))
817 /* if unlocked or override in effect */
821 void backlight_set_on_button_hold(int index
)
823 if ((unsigned)index
>= 3)
824 /* if given a weird value, use default */
827 backlight_on_button_hold
= index
;
828 backlight_update_state();
830 #endif /* HAS_BUTTON_HOLD */
832 #ifdef HAVE_LCD_SLEEP_SETTING
833 void lcd_set_sleep_after_backlight_off(int index
)
835 if ((unsigned)index
>= sizeof(lcd_sleep_timeout_value
))
836 /* if given a weird value, use default */
839 lcd_sleep_timeout
= HZ
* lcd_sleep_timeout_value
[index
];
841 if (backlight_timer
> 0 || backlight_get_current_timeout() == 0)
842 /* Timer will be set when bl turns off or bl set to on. */
845 /* Backlight is Off */
846 if (lcd_sleep_timeout
< 0)
847 lcd_sleep_timer
= 1; /* Always - sleep next tick */
849 lcd_sleep_timer
= lcd_sleep_timeout
; /* Never, other */
851 #endif /* HAVE_LCD_SLEEP_SETTING */
853 #ifdef HAVE_REMOTE_LCD
854 void remote_backlight_on(void)
856 queue_post(&backlight_queue
, REMOTE_BACKLIGHT_ON
, 0);
859 void remote_backlight_off(void)
861 queue_post(&backlight_queue
, REMOTE_BACKLIGHT_OFF
, 0);
864 void remote_backlight_set_timeout(int value
)
866 remote_backlight_timeout_normal
= HZ
* value
;
867 remote_backlight_update_state();
871 void remote_backlight_set_timeout_plugged(int value
)
873 remote_backlight_timeout_plugged
= HZ
* value
;
874 remote_backlight_update_state();
876 #endif /* CONFIG_CHARGING */
878 #ifdef HAS_REMOTE_BUTTON_HOLD
879 /* Remote hold button change event handler. */
880 void remote_backlight_hold_changed(bool rc_hold_button
)
882 if (!rc_hold_button
|| (remote_backlight_on_button_hold
> 0))
883 /* if unlocked or override */
884 remote_backlight_on();
887 void remote_backlight_set_on_button_hold(int index
)
889 if ((unsigned)index
>= 3)
890 /* if given a weird value, use default */
893 remote_backlight_on_button_hold
= index
;
894 remote_backlight_update_state();
896 #endif /* HAS_REMOTE_BUTTON_HOLD */
898 /* return value in ticks; 0 means always on, <0 means always off */
899 int remote_backlight_get_current_timeout(void)
901 return remote_backlight_timeout
;
904 /* returns true when the backlight is on, and
905 * optionally when it's set to always off */
906 bool is_remote_backlight_on(bool ignore_always_off
)
908 return (remote_backlight_timer
> 0) /* countdown */
909 || (remote_backlight_timeout
== 0) /* always on */
910 || ((remote_backlight_timeout
< 0) && !ignore_always_off
);
913 #endif /* HAVE_REMOTE_LCD */
915 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
916 void backlight_set_brightness(int val
)
918 if (val
< MIN_BRIGHTNESS_SETTING
)
919 val
= MIN_BRIGHTNESS_SETTING
;
920 else if (val
> MAX_BRIGHTNESS_SETTING
)
921 val
= MAX_BRIGHTNESS_SETTING
;
923 backlight_brightness
= val
;
924 _backlight_set_brightness(val
);
925 #ifdef USE_BACKLIGHT_SW_FADING
926 /* receive backlight brightness */
927 _backlight_fade_update_state(val
);
930 #endif /* HAVE_BACKLIGHT_BRIGHTNESS */
932 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
933 void buttonlight_set_brightness(int val
)
935 if (val
< MIN_BRIGHTNESS_SETTING
)
936 val
= MIN_BRIGHTNESS_SETTING
;
937 else if (val
> MAX_BRIGHTNESS_SETTING
)
938 val
= MAX_BRIGHTNESS_SETTING
;
940 _buttonlight_set_brightness(val
);
942 #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
944 #else /* !defined(HAVE_BACKLIGHT) || !defined(BACKLIGHT_FULL_INIT)
945 -- no backlight, empty dummy functions */
947 #if defined(HAVE_BACKLIGHT) && !defined(BACKLIGHT_FULL_INIT)
948 void backlight_init(void)
950 (void)_backlight_init();
955 void backlight_on(void) {}
956 void backlight_off(void) {}
957 void buttonlight_on(void) {}
958 void backlight_set_timeout(int value
) {(void)value
;}
960 bool is_backlight_on(bool ignore_always_off
)
962 (void)ignore_always_off
;
965 #ifdef HAVE_REMOTE_LCD
966 void remote_backlight_on(void) {}
967 void remote_backlight_off(void) {}
968 void remote_backlight_set_timeout(int value
) {(void)value
;}
970 bool is_remote_backlight_on(bool ignore_always_off
)
972 (void)ignore_always_off
;
975 #endif /* HAVE_REMOTE_LCD */
976 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
977 void backlight_set_brightness(int val
) { (void)val
; }
979 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
980 void buttonlight_set_brightness(int val
) { (void)val
; }
982 #endif /* defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT) */