diff options
author | Gireesh Hiremath | 2021-06-11 16:13:44 +0000 |
---|---|---|
committer | Lokesh Vutla | 2021-07-15 17:56:03 +0530 |
commit | ae628fb6dac3e18c4636121a3fdc11a9677ef5dd (patch) | |
tree | 203bc8e955d63ec25db711a30301a8f26de34419 /board/bosch/guardian | |
parent | d364926da3f9680cbaaabc7f976efe05b62d8c76 (diff) |
am335x, guardian: Enable backlight
Enable backlight, set brightness value and dimming frequency
Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-13-Gireesh.Hiremath@in.bosch.com
Diffstat (limited to 'board/bosch/guardian')
-rw-r--r-- | board/bosch/guardian/board.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index f14ceaa1f92..4388ef70d25 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -225,12 +225,38 @@ err: env_set("swi_status", "err"); } +void lcdbacklight_en(void) +{ + unsigned long brightness = env_get_ulong("backlight_brightness", 10, 50); + + if (brightness > 99 || brightness == 0) + brightness = 99; + + /* + * Brightness range: + * WLEDCTRL2 DUTY[6:0] + * + * 000 0000b = 1% + * 000 0001b = 2% + * ... + * 110 0010b = 99% + * 110 0011b = 100% + * + */ + + tps65217_reg_write(TPS65217_PROT_LEVEL_NONE, TPS65217_WLEDCTRL2, + brightness, 0xFF); + tps65217_reg_write(TPS65217_PROT_LEVEL_NONE, TPS65217_WLEDCTRL1, + brightness != 0 ? 0x0A : 0x02, 0xFF); +} + int board_late_init(void) { #ifdef CONFIG_LED_GPIO led_default_state(); #endif set_bootmode_env(); + lcdbacklight_en(); return 0; } #endif /* CONFIG_BOARD_LATE_INIT */ |