u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: <Gireesh.Hiremath@in.bosch.com>
To: <u-boot@lists.denx.de>, <Gireesh.Hiremath@in.bosch.com>,
	<trini@konsulko.com>
Cc: <sjoerd.simons@collabora.co.uk>,
	<VinayKumar.Shettar@in.bosch.com>,
	<Govindaraji.Sivanantham@in.bosch.com>
Subject: [PATCH v4 12/18] am335x, guardian: Enable backlight
Date: Fri, 11 Jun 2021 16:13:44 +0000	[thread overview]
Message-ID: <20210611161350.2141-13-Gireesh.Hiremath@in.bosch.com> (raw)
In-Reply-To: <20210611161350.2141-1-Gireesh.Hiremath@in.bosch.com>

From: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>

Enable backlight, set brightness value and dimming frequency

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@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 f14ceaa1f9..4388ef70d2 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 */
diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h
index c76f9b26fb..73248292f2 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -59,6 +59,7 @@
 	BOOTENV \
 	GUARDIAN_DEFAULT_PROD_ENV \
 	"autoload=no\0" \
+	"backlight_brightness=50\0" \
 	"bootubivol=rootfs\0" \
 	"distro_bootcmd=" \
 		"setenv rootflags \"bulk_read,chk_data_crc\"; " \
-- 
2.20.1


  parent reply	other threads:[~2021-06-11 16:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 16:13 [PATCH v4 00/18] am335x, guardian: update board specific changes Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 01/18] configs: am335x_guardian: Enable clock driver Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 02/18] am335x, guardian: mem: Add board dependent mem values Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 03/18] configs: am335x_guardian: add ubi fastmap support Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 04/18] am335x, guardian: set tftp_load_addr in environment Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 05/18] configs: am335x_guardian: add memtest configs Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 06/18] am335x, guardian: Update pinmux configuration Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 07/18] am335x, guardian: set environment variable autoload to no Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 08/18] am335x, guardian: code cleanup and boot optimization Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 09/18] configs: am335x_guardian: set boot delay Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 10/18] configs: am335x_guardian: disable spl command Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 11/18] am335x, guardian: update swi logic Gireesh.Hiremath
2021-06-11 16:13 ` Gireesh.Hiremath [this message]
2021-06-11 16:13 ` [PATCH v4 13/18] configs: am335x_guardian: Enable display config Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 14/18] drivers: video: hx8238 fix build bug Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 15/18] am335x, guardian: Enable panel driver Himax HX8238D Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 16/18] am335x, guardian: software update available status is stored in AM3352 RTC scracth register Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 17/18] configs: am335x_guardian: Enable bootcount nvmem support Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 18/18] configs: am335x_guardian: add register maps support Gireesh.Hiremath
2021-07-14  6:52 ` [PATCH v4 00/18] am335x, guardian: update board specific changes Lokesh Vutla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210611161350.2141-13-Gireesh.Hiremath@in.bosch.com \
    --to=gireesh.hiremath@in.bosch.com \
    --cc=Govindaraji.Sivanantham@in.bosch.com \
    --cc=VinayKumar.Shettar@in.bosch.com \
    --cc=sjoerd.simons@collabora.co.uk \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).