[PATCH 01/10] am335x, guardian: Enable backlight
Gireesh.Hiremath at in.bosch.com
Gireesh.Hiremath at in.bosch.com
Wed Jan 6 16:31:47 CET 2021
From: Gireesh Hiremath <Gireesh.Hiremath at in.bosch.com>
Enable backlight,set brightness value and dimming frequency
Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath at in.bosch.com>
---
board/bosch/guardian/board.c | 26 ++++++++++++++++++++++++++
include/configs/am335x_guardian.h | 1 +
2 files changed, 27 insertions(+)
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c
index f3e616d21c..a34262bd13 100644
--- a/board/bosch/guardian/board.c
+++ b/board/bosch/guardian/board.c
@@ -245,6 +245,31 @@ 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)
{
int ret;
@@ -261,6 +286,7 @@ int board_late_init(void)
return ret;
}
+ lcdbacklight_en();
return 0;
}
#endif /* CONFIG_BOARD_LATE_INIT */
diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h
index c34c07a493..236be1a093 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -57,6 +57,7 @@
MEM_LAYOUT_ENV_SETTINGS \
BOOTENV \
GUARDIAN_DEFAULT_PROD_ENV \
+ "backlight_brightness=50\0" \
"bootubivol=rootfs\0" \
"distro_bootcmd=" \
"setenv autoload no; " \
--
2.20.1
More information about the U-Boot
mailing list