Add USB PID for Ipod Classic as incompatible variant of the Video. Remove PID for...
[Rockbox.git] / firmware / backlight.c
blob4a00f86f392ed0c253c30cbec208fd56bbb5751e
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"
33 #include "lcd.h"
35 #ifdef HAVE_REMOTE_LCD
36 #include "lcd-remote.h"
37 #endif
38 #ifndef SIMULATOR
39 #include "backlight-target.h"
40 #endif
42 #ifdef SIMULATOR
43 /* TODO: find a better way to do it but we need a kernel thread somewhere to
44 handle this */
45 extern void screen_dump(void);
47 static inline void _backlight_on(void)
49 sim_backlight(100);
52 static inline void _backlight_off(void)
54 sim_backlight(0);
57 static inline void _backlight_set_brightness(int val)
59 (void)val;
62 static inline void _buttonlight_on(void)
66 static inline void _buttonlight_off(void)
70 static inline void _buttonlight_set_brightness(int val)
72 (void)val;
74 #ifdef HAVE_REMOTE_LCD
75 static inline void _remote_backlight_on(void)
77 sim_remote_backlight(100);
80 static inline void _remote_backlight_off(void)
82 sim_remote_backlight(0);
84 #endif /* HAVE_REMOTE_LCD */
86 #endif /* SIMULATOR */
88 #if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER)
90 enum {
91 BACKLIGHT_ON,
92 BACKLIGHT_OFF,
93 #ifdef HAVE_REMOTE_LCD
94 REMOTE_BACKLIGHT_ON,
95 REMOTE_BACKLIGHT_OFF,
96 #endif
97 #if defined(_BACKLIGHT_FADE_BOOST) || defined(_BACKLIGHT_FADE_ENABLE)
98 BACKLIGHT_FADE_FINISH,
99 #endif
100 #ifdef HAVE_LCD_SLEEP
101 LCD_SLEEP,
102 #endif
103 #ifdef HAVE_BUTTON_LIGHT
104 BUTTON_LIGHT_ON,
105 BUTTON_LIGHT_OFF,
106 #endif
109 static void backlight_thread(void);
110 static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
111 static const char backlight_thread_name[] = "backlight";
112 static struct event_queue backlight_queue;
114 static int backlight_timer SHAREDBSS_ATTR;
115 static int backlight_timeout SHAREDBSS_ATTR;
116 static int backlight_timeout_normal = 5*HZ;
117 #if CONFIG_CHARGING
118 static int backlight_timeout_plugged = 5*HZ;
119 #endif
120 #ifdef HAS_BUTTON_HOLD
121 static int backlight_on_button_hold = 0;
122 #endif
124 #ifdef HAVE_BUTTON_LIGHT
125 static int buttonlight_timer;
126 int _buttonlight_timeout = 5*HZ;
128 /* Update state of buttonlight according to timeout setting */
129 static void buttonlight_update_state(void)
131 buttonlight_timer = _buttonlight_timeout;
133 /* Buttonlight == OFF in the setting? */
134 if (buttonlight_timer < 0)
136 buttonlight_timer = 0; /* Disable the timeout */
137 _buttonlight_off();
139 else
140 _buttonlight_on();
143 /* external interface */
144 void buttonlight_on(void)
146 queue_remove_from_head(&backlight_queue, BUTTON_LIGHT_ON);
147 queue_post(&backlight_queue, BUTTON_LIGHT_ON, 0);
150 void buttonlight_off(void)
152 queue_post(&backlight_queue, BUTTON_LIGHT_OFF, 0);
155 void buttonlight_set_timeout(int value)
157 _buttonlight_timeout = HZ * value;
158 buttonlight_update_state();
161 #endif
163 #ifdef HAVE_REMOTE_LCD
164 static int remote_backlight_timer;
165 static int remote_backlight_timeout;
166 static int remote_backlight_timeout_normal = 5*HZ;
167 #if CONFIG_CHARGING
168 static int remote_backlight_timeout_plugged = 5*HZ;
169 #endif
170 #ifdef HAS_REMOTE_BUTTON_HOLD
171 static int remote_backlight_on_button_hold = 0;
172 #endif
173 #endif
175 #ifdef HAVE_LCD_SLEEP
176 const signed char lcd_sleep_timeout_value[10] =
178 -1, 0, 5, 10, 15, 20, 30, 45, 60, 90
180 int _lcd_sleep_timer;
181 int _lcd_sleep_timeout = 10*HZ;
182 #endif
184 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
185 /* backlight fading */
186 #define BL_PWM_INTERVAL 5 /* Cycle interval in ms */
187 #define BL_PWM_BITS 8
188 #define BL_PWM_COUNT (1<<BL_PWM_BITS)
190 /* s15.16 fixed point variables */
191 static int32_t bl_fade_in_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/300;
192 static int32_t bl_fade_out_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/2000;
193 static int32_t bl_dim_fraction = 0;
195 static int bl_dim_target = 0;
196 static int bl_dim_current = 0;
197 static enum {DIM_STATE_START, DIM_STATE_MAIN} bl_dim_state = DIM_STATE_START;
198 static bool bl_timer_active = false;
200 static void backlight_isr(void)
202 int timer_period = (TIMER_FREQ*BL_PWM_INTERVAL/1000);
203 bool idle = false;
205 switch (bl_dim_state)
207 /* New cycle */
208 case DIM_STATE_START:
209 bl_dim_current = bl_dim_fraction >> 16;
211 if (bl_dim_current > 0 && bl_dim_current < BL_PWM_COUNT)
213 _backlight_on_isr();
214 timer_period = (timer_period * bl_dim_current) >> BL_PWM_BITS;
215 bl_dim_state = DIM_STATE_MAIN;
217 else
219 if (bl_dim_current)
220 _backlight_on_isr();
221 else
222 _backlight_off_isr();
223 if (bl_dim_current == bl_dim_target)
224 idle = true;
226 if (bl_dim_current < bl_dim_target)
228 bl_dim_fraction = MIN(bl_dim_fraction + bl_fade_in_step,
229 (BL_PWM_COUNT<<16));
231 else if (bl_dim_current > bl_dim_target)
233 bl_dim_fraction = MAX(bl_dim_fraction - bl_fade_out_step, 0);
235 break;
237 /* Dim main screen */
238 case DIM_STATE_MAIN:
239 _backlight_off_isr();
240 timer_period = (timer_period * (BL_PWM_COUNT - bl_dim_current))
241 >> BL_PWM_BITS;
242 bl_dim_state = DIM_STATE_START;
243 break ;
245 if (idle)
247 #if defined(_BACKLIGHT_FADE_BOOST) || defined(_BACKLIGHT_FADE_ENABLE)
248 queue_post(&backlight_queue, BACKLIGHT_FADE_FINISH, 0);
249 #endif
250 timer_unregister();
251 bl_timer_active = false;
253 else
254 timer_set_period(timer_period);
257 static void backlight_switch(void)
259 if (bl_dim_target > (BL_PWM_COUNT/2))
261 _backlight_on_normal();
262 bl_dim_fraction = (BL_PWM_COUNT<<16);
264 else
266 _backlight_off_normal();
267 bl_dim_fraction = 0;
271 static void backlight_release_timer(void)
273 #ifdef _BACKLIGHT_FADE_BOOST
274 cpu_boost(false);
275 #endif
276 timer_unregister();
277 bl_timer_active = false;
278 backlight_switch();
281 static void backlight_dim(int value)
283 /* protect from extraneous calls with the same target value */
284 if (value == bl_dim_target)
285 return;
287 bl_dim_target = value;
289 if (bl_timer_active)
290 return ;
292 if (timer_register(0, backlight_release_timer, 2, 0, backlight_isr
293 IF_COP(, CPU)))
295 #ifdef _BACKLIGHT_FADE_BOOST
296 /* Prevent cpu frequency changes while dimming. */
297 cpu_boost(true);
298 #endif
299 bl_timer_active = true;
301 else
302 backlight_switch();
305 static void _backlight_on(void)
307 if (bl_fade_in_step > 0)
309 #ifdef _BACKLIGHT_FADE_ENABLE
310 _backlight_hw_enable(true);
311 #endif
312 backlight_dim(BL_PWM_COUNT);
314 else
316 bl_dim_target = BL_PWM_COUNT;
317 bl_dim_fraction = (BL_PWM_COUNT<<16);
318 _backlight_on_normal();
320 #ifdef HAVE_LCD_SLEEP
321 _lcd_sleep_timer = 0; /* LCD should be awake already */
322 #endif
325 static void _backlight_off(void)
327 if (bl_fade_out_step > 0)
329 backlight_dim(0);
331 else
333 bl_dim_target = bl_dim_fraction = 0;
334 _backlight_off_normal();
336 #ifdef HAVE_LCD_SLEEP
337 /* Start LCD sleep countdown */
338 if (_lcd_sleep_timeout < 0)
340 _lcd_sleep_timer = 0; /* Setting == Always */
341 lcd_sleep();
343 else
344 _lcd_sleep_timer = _lcd_sleep_timeout;
345 #endif
348 void backlight_set_fade_in(int value)
350 if (value > 0)
351 bl_fade_in_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16) / value;
352 else
353 bl_fade_in_step = 0;
356 void backlight_set_fade_out(int value)
358 if (value > 0)
359 bl_fade_out_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16) / value;
360 else
361 bl_fade_out_step = 0;
363 #endif /* defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) */
365 /* Update state of backlight according to timeout setting */
366 static void backlight_update_state(void)
368 #ifdef HAS_BUTTON_HOLD
369 if ((backlight_on_button_hold != 0)
370 #ifdef HAVE_REMOTE_LCD_AS_MAIN
371 && remote_button_hold()
372 #else
373 && button_hold()
374 #endif
376 backlight_timeout = (backlight_on_button_hold == 2) ? 0 : -1;
377 /* always on or always off */
378 else
379 #endif
380 #if CONFIG_CHARGING
381 if (charger_inserted()
382 #ifdef HAVE_USB_POWER
383 || usb_powered()
384 #endif
386 backlight_timeout = backlight_timeout_plugged;
387 else
388 #endif
389 backlight_timeout = backlight_timeout_normal;
391 /* Backlight == OFF in the setting? */
392 if (backlight_timeout < 0)
394 backlight_timer = 0; /* Disable the timeout */
395 _backlight_off();
397 else
399 backlight_timer = backlight_timeout;
400 _backlight_on();
404 #ifdef HAVE_REMOTE_LCD
405 /* Update state of remote backlight according to timeout setting */
406 static void remote_backlight_update_state(void)
408 #ifdef HAS_REMOTE_BUTTON_HOLD
409 if (remote_button_hold() && (remote_backlight_on_button_hold != 0))
410 remote_backlight_timeout = (remote_backlight_on_button_hold == 2)
411 ? 0 : -1; /* always on or always off */
412 else
413 #endif
414 #if CONFIG_CHARGING
415 if (charger_inserted()
416 #ifdef HAVE_USB_POWER
417 || usb_powered()
418 #endif
420 remote_backlight_timeout = remote_backlight_timeout_plugged;
421 else
422 #endif
423 remote_backlight_timeout = remote_backlight_timeout_normal;
425 /* Backlight == OFF in the setting? */
426 if (remote_backlight_timeout < 0)
428 remote_backlight_timer = 0; /* Disable the timeout */
429 _remote_backlight_off();
431 else
433 remote_backlight_timer = remote_backlight_timeout;
434 _remote_backlight_on();
437 #endif /* HAVE_REMOTE_LCD */
439 void backlight_thread(void)
441 struct queue_event ev;
442 bool locked = false;
444 while(1)
446 queue_wait(&backlight_queue, &ev);
447 switch(ev.id)
448 { /* These events must always be processed */
449 #ifdef _BACKLIGHT_FADE_BOOST
450 case BACKLIGHT_FADE_FINISH:
451 cpu_boost(false);
452 break;
453 #endif
454 #ifdef _BACKLIGHT_FADE_ENABLE
455 case BACKLIGHT_FADE_FINISH:
456 _backlight_hw_enable((bl_dim_current|bl_dim_target) != 0);
457 break;
458 #endif
460 #ifndef SIMULATOR
461 /* Here for now or else the aggressive init messes up scrolling */
462 #ifdef HAVE_REMOTE_LCD
463 case SYS_REMOTE_PLUGGED:
464 lcd_remote_on();
465 lcd_remote_update();
466 break;
468 case SYS_REMOTE_UNPLUGGED:
469 lcd_remote_off();
470 break;
471 #elif defined HAVE_REMOTE_LCD_AS_MAIN
472 case SYS_REMOTE_PLUGGED:
473 lcd_on();
474 lcd_update();
475 break;
477 case SYS_REMOTE_UNPLUGGED:
478 lcd_off();
479 break;
480 #endif /* HAVE_REMOTE_LCD/ HAVE_REMOTE_LCD_AS_MAIN */
481 #endif /* !SIMULATOR */
482 #ifdef SIMULATOR
483 /* This one here too for lack of a better place */
484 case SYS_SCREENDUMP:
485 screen_dump();
486 break;
487 #endif
488 case SYS_USB_CONNECTED:
489 /* Tell the USB thread that we are safe */
490 DEBUGF("backlight_thread got SYS_USB_CONNECTED\n");
491 usb_acknowledge(SYS_USB_CONNECTED_ACK);
492 break;
494 case SYS_USB_DISCONNECTED:
495 usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
496 break;
498 if (locked)
499 continue;
501 switch(ev.id)
502 { /* These events are only processed if backlight isn't locked */
503 #ifdef HAVE_REMOTE_LCD
504 case REMOTE_BACKLIGHT_ON:
505 remote_backlight_update_state();
506 break;
508 case REMOTE_BACKLIGHT_OFF:
509 remote_backlight_timer = 0; /* Disable the timeout */
510 _remote_backlight_off();
511 break;
512 #endif /* HAVE_REMOTE_LCD */
514 case BACKLIGHT_ON:
515 backlight_update_state();
516 break;
518 case BACKLIGHT_OFF:
519 backlight_timer = 0; /* Disable the timeout */
520 _backlight_off();
521 break;
523 #ifdef HAVE_LCD_SLEEP
524 case LCD_SLEEP:
525 lcd_sleep();
526 break;
527 #endif
528 #ifdef HAVE_BUTTON_LIGHT
529 case BUTTON_LIGHT_ON:
530 buttonlight_update_state();
531 break;
533 case BUTTON_LIGHT_OFF:
534 buttonlight_timer = 0;
535 _buttonlight_off();
536 break;
537 #endif
539 case SYS_POWEROFF: /* Lock backlight on poweroff so it doesn't */
540 locked = true; /* go off before power is actually cut. */
541 /* fall through */
542 #if CONFIG_CHARGING
543 case SYS_CHARGER_CONNECTED:
544 case SYS_CHARGER_DISCONNECTED:
545 #endif
546 backlight_update_state();
547 #ifdef HAVE_REMOTE_LCD
548 remote_backlight_update_state();
549 #endif
550 break;
552 } /* end while */
555 static void backlight_tick(void)
557 if(backlight_timer)
559 backlight_timer--;
560 if(backlight_timer == 0)
562 backlight_off();
565 #ifdef HAVE_LCD_SLEEP
566 else if(_lcd_sleep_timer)
568 _lcd_sleep_timer--;
569 if(_lcd_sleep_timer == 0)
571 /* Queue on bl thread or freeze! */
572 queue_post(&backlight_queue, LCD_SLEEP, 0);
575 #endif /* HAVE_LCD_SLEEP */
577 #ifdef HAVE_REMOTE_LCD
578 if(remote_backlight_timer)
580 remote_backlight_timer--;
581 if(remote_backlight_timer == 0)
583 remote_backlight_off();
586 #endif /* HAVE_REMOVE_LCD */
587 #ifdef HAVE_BUTTON_LIGHT
588 if (buttonlight_timer)
590 buttonlight_timer--;
591 if (buttonlight_timer == 0)
593 buttonlight_off();
596 #endif /* HAVE_BUTTON_LIGHT */
599 void backlight_init(void)
601 queue_init(&backlight_queue, true);
603 #ifndef SIMULATOR
604 if (_backlight_init())
606 # ifdef HAVE_BACKLIGHT_PWM_FADING
607 /* If backlight is already on, don't fade in. */
608 bl_dim_target = BL_PWM_COUNT;
609 bl_dim_fraction = (BL_PWM_COUNT<<16);
610 # endif
612 #endif
613 /* Leave all lights as set by the bootloader here. The settings load will
614 * call the appropriate backlight_set_*() functions, only changing light
615 * status if necessary. */
617 create_thread(backlight_thread, backlight_stack,
618 sizeof(backlight_stack), 0, backlight_thread_name
619 IF_PRIO(, PRIORITY_USER_INTERFACE)
620 IF_COP(, CPU));
621 tick_add_task(backlight_tick);
624 void backlight_on(void)
626 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
627 queue_post(&backlight_queue, BACKLIGHT_ON, 0);
630 void backlight_off(void)
632 queue_post(&backlight_queue, BACKLIGHT_OFF, 0);
635 /* returns true when the backlight is on,
636 * and optionally when it's set to always off. */
637 bool is_backlight_on(bool ignore_always_off)
639 return (backlight_timer > 0) /* countdown */
640 || (backlight_timeout == 0) /* always on */
641 || ((backlight_timeout < 0) && !ignore_always_off);
644 /* return value in ticks; 0 means always on, <0 means always off */
645 int backlight_get_current_timeout(void)
647 return backlight_timeout;
650 void backlight_set_timeout(int value)
652 backlight_timeout_normal = HZ * value;
653 backlight_update_state();
656 #if CONFIG_CHARGING
657 void backlight_set_timeout_plugged(int value)
659 backlight_timeout_plugged = HZ * value;
660 backlight_update_state();
662 #endif /* CONFIG_CHARGING */
664 #ifdef HAS_BUTTON_HOLD
665 /* Hold button change event handler. */
666 void backlight_hold_changed(bool hold_button)
668 if (!hold_button || (backlight_on_button_hold > 0))
669 /* if unlocked or override in effect */
670 backlight_on();
673 void backlight_set_on_button_hold(int index)
675 if ((unsigned)index >= 3)
676 /* if given a weird value, use default */
677 index = 0;
679 backlight_on_button_hold = index;
680 backlight_update_state();
682 #endif /* HAS_BUTTON_HOLD */
684 #ifdef HAVE_LCD_SLEEP
685 void lcd_set_sleep_after_backlight_off(int index)
687 if ((unsigned)index >= sizeof(lcd_sleep_timeout_value))
688 /* if given a weird value, use default */
689 index = 3;
691 _lcd_sleep_timeout = HZ * lcd_sleep_timeout_value[index];
693 if (backlight_timer > 0 || backlight_get_current_timeout() == 0)
694 /* Timer will be set when bl turns off or bl set to on. */
695 return;
697 /* Backlight is Off */
698 if (_lcd_sleep_timeout < 0)
699 _lcd_sleep_timer = 1; /* Always - sleep next tick */
700 else
701 _lcd_sleep_timer = _lcd_sleep_timeout; /* Never, other */
703 #endif /* HAVE_LCD_SLEEP */
705 #ifdef HAVE_REMOTE_LCD
706 void remote_backlight_on(void)
708 queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, 0);
711 void remote_backlight_off(void)
713 queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, 0);
716 void remote_backlight_set_timeout(int value)
718 remote_backlight_timeout_normal = HZ * value;
719 remote_backlight_update_state();
722 #if CONFIG_CHARGING
723 void remote_backlight_set_timeout_plugged(int value)
725 remote_backlight_timeout_plugged = HZ * value;
726 remote_backlight_update_state();
728 #endif /* CONFIG_CHARGING */
730 #ifdef HAS_REMOTE_BUTTON_HOLD
731 /* Remote hold button change event handler. */
732 void remote_backlight_hold_changed(bool rc_hold_button)
734 if (!rc_hold_button || (remote_backlight_on_button_hold > 0))
735 /* if unlocked or override */
736 remote_backlight_on();
739 void remote_backlight_set_on_button_hold(int index)
741 if ((unsigned)index >= 3)
742 /* if given a weird value, use default */
743 index = 0;
745 remote_backlight_on_button_hold = index;
746 remote_backlight_update_state();
748 #endif /* HAS_REMOTE_BUTTON_HOLD */
750 /* return value in ticks; 0 means always on, <0 means always off */
751 int remote_backlight_get_current_timeout(void)
753 return remote_backlight_timeout;
756 /* returns true when the backlight is on, and
757 * optionally when it's set to always off */
758 bool is_remote_backlight_on(bool ignore_always_off)
760 return (remote_backlight_timer > 0) /* countdown */
761 || (remote_backlight_timeout == 0) /* always on */
762 || ((remote_backlight_timeout < 0) && !ignore_always_off);
765 #endif /* HAVE_REMOTE_LCD */
767 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
768 void backlight_set_brightness(int val)
770 if (val < MIN_BRIGHTNESS_SETTING)
771 val = MIN_BRIGHTNESS_SETTING;
772 else if (val > MAX_BRIGHTNESS_SETTING)
773 val = MAX_BRIGHTNESS_SETTING;
775 _backlight_set_brightness(val);
777 #endif /* HAVE_BACKLIGHT_BRIGHTNESS */
779 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
780 void buttonlight_set_brightness(int val)
782 if (val < MIN_BRIGHTNESS_SETTING)
783 val = MIN_BRIGHTNESS_SETTING;
784 else if (val > MAX_BRIGHTNESS_SETTING)
785 val = MAX_BRIGHTNESS_SETTING;
787 _buttonlight_set_brightness(val);
789 #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
791 #else /* !defined(HAVE_BACKLIGHT) || defined(BOOTLOADER)
792 -- no backlight, empty dummy functions */
794 #if defined(BOOTLOADER) && defined(HAVE_BACKLIGHT)
795 void backlight_init(void)
797 (void)_backlight_init();
798 _backlight_on();
800 #endif
802 void backlight_on(void) {}
803 void backlight_off(void) {}
804 void buttonlight_on(void) {}
805 void backlight_set_timeout(int value) {(void)value;}
807 bool is_backlight_on(bool ignore_always_off)
809 (void)ignore_always_off;
810 return true;
812 #ifdef HAVE_REMOTE_LCD
813 void remote_backlight_on(void) {}
814 void remote_backlight_off(void) {}
815 void remote_backlight_set_timeout(int value) {(void)value;}
817 bool is_remote_backlight_on(bool ignore_always_off)
819 (void)ignore_always_off;
820 return true;
822 #endif /* HAVE_REMOTE_LCD */
823 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
824 void backlight_set_brightness(int val) { (void)val; }
825 #endif
826 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
827 void buttonlight_set_brightness(int val) { (void)val; }
828 #endif
829 #endif /* defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER) */