Skip to content

Commit cc5d04d

Browse files
mansrojeda
authored andcommitted
auxdisplay: charlcd: make backlight initial state configurable
The charlcd driver currently flashes the backlight once on init. This may not be desirable. Thus, add options for turning the backlight off or on as well. Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
1 parent c917172 commit cc5d04d

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

drivers/auxdisplay/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,27 @@ config PANEL_BOOT_MESSAGE
445445
An empty message will only clear the display at driver init time. Any other
446446
printf()-formatted message is valid with newline and escape codes.
447447

448+
choice
449+
prompt "Backlight initial state"
450+
default CHARLCD_BL_FLASH
451+
452+
config CHARLCD_BL_OFF
453+
bool "Off"
454+
help
455+
Backlight is initially turned off
456+
457+
config CHARLCD_BL_ON
458+
bool "On"
459+
help
460+
Backlight is initially turned on
461+
462+
config CHARLCD_BL_FLASH
463+
bool "Flash"
464+
help
465+
Backlight is flashed briefly on init
466+
467+
endchoice
468+
448469
endif # AUXDISPLAY
449470

450471
config PANEL

drivers/auxdisplay/charlcd.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,14 @@ static void charlcd_puts(struct charlcd *lcd, const char *s)
769769
#define LCD_INIT_TEXT "Linux-" UTS_RELEASE "\n"
770770
#endif
771771

772+
#ifdef CONFIG_CHARLCD_BL_ON
773+
#define LCD_INIT_BL "\x1b[L+"
774+
#elif defined(CONFIG_CHARLCD_BL_FLASH)
775+
#define LCD_INIT_BL "\x1b[L*"
776+
#else
777+
#define LCD_INIT_BL "\x1b[L-"
778+
#endif
779+
772780
/* initialize the LCD driver */
773781
static int charlcd_init(struct charlcd *lcd)
774782
{
@@ -790,7 +798,7 @@ static int charlcd_init(struct charlcd *lcd)
790798
return ret;
791799

792800
/* display a short message */
793-
charlcd_puts(lcd, "\x1b[Lc\x1b[Lb\x1b[L*" LCD_INIT_TEXT);
801+
charlcd_puts(lcd, "\x1b[Lc\x1b[Lb" LCD_INIT_BL LCD_INIT_TEXT);
794802

795803
/* clear the display on the next device opening */
796804
priv->must_clear = true;

0 commit comments

Comments
 (0)