lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230602-lm3630a_boost_frequency-v1-1-076472036d1a@mweigand.net>
Date:   Wed, 14 Jun 2023 21:08:52 +0200
From:   Maximilian Weigand <mweigand2017@...il.com>
To:     Lee Jones <lee@...nel.org>,
        Daniel Thompson <daniel.thompson@...aro.org>,
        Jingoo Han <jingoohan1@...il.com>,
        Helge Deller <deller@....de>, Pavel Machek <pavel@....cz>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Heiko Stuebner <heiko@...ech.de>
Cc:     dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org,
        devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-rockchip@...ts.infradead.org,
        Maximilian Weigand <mweigand@...igand.net>
Subject: [PATCH 1/3] backlight: lm3630a: add support for changing the boost
 frequency

From: Maximilian Weigand <mweigand@...igand.net>

The led driver supports changing the switching frequency of the boost
converter by two means: the base switching frequency can be changed from
500 kHz to 1 MHz, and a frequency shift can be activated, leading to
switching frequencies of 560 kHz or 1.12 Mhz, respectively.

Add this functionality to the led driver by introducing two dts entries
that control the boost frequency (500 kHz by default) and the frequency
shift (no shift by default).

Signed-off-by: Maximilian Weigand <mweigand@...igand.net>
---
 drivers/video/backlight/lm3630a_bl.c     | 9 ++++++++-
 include/linux/platform_data/lm3630a_bl.h | 5 +++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index d8c42acecb5d..1e8645694ab5 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -92,7 +92,7 @@ static int lm3630a_chip_init(struct lm3630a_chip *pchip)
 	/* set Cofig. register */
 	rval |= lm3630a_update(pchip, REG_CONFIG, 0x07, pdata->pwm_ctrl);
 	/* set boost control */
-	rval |= lm3630a_write(pchip, REG_BOOST, 0x38);
+	rval |= lm3630a_write(pchip, REG_BOOST, pdata->boost_ctrl);
 	/* set current A */
 	rval |= lm3630a_update(pchip, REG_I_A, 0x1F, 0x1F);
 	/* set current B */
@@ -528,6 +528,13 @@ static int lm3630a_probe(struct i2c_client *client)
 		pdata->ledb_max_brt = LM3630A_MAX_BRIGHTNESS;
 		pdata->leda_init_brt = LM3630A_MAX_BRIGHTNESS;
 		pdata->ledb_init_brt = LM3630A_MAX_BRIGHTNESS;
+		pdata->boost_ctrl = LM3630A_BOOST_CTRL_DEFAULT;
+
+		if (device_property_read_bool(pchip->dev, "ti,boost_frequency_shift"))
+			pdata->boost_ctrl |= LM3630A_BOOST_SHIFT_FREQ;
+
+		if (device_property_read_bool(pchip->dev, "ti,boost_use_1mhz"))
+			pdata->boost_ctrl |= LM3630A_BOOST_USE_1MHZ;
 
 		rval = lm3630a_parse_node(pchip, pdata);
 		if (rval) {
diff --git a/include/linux/platform_data/lm3630a_bl.h b/include/linux/platform_data/lm3630a_bl.h
index 530be9318711..fb5ffb906dcf 100644
--- a/include/linux/platform_data/lm3630a_bl.h
+++ b/include/linux/platform_data/lm3630a_bl.h
@@ -33,6 +33,9 @@ enum lm3630a_ledb_ctrl {
 };
 
 #define LM3630A_MAX_BRIGHTNESS 255
+#define LM3630A_BOOST_CTRL_DEFAULT 0x38
+#define LM3630A_BOOST_USE_1MHZ BIT(0)
+#define LM3630A_BOOST_SHIFT_FREQ BIT(1)
 /*
  *@...a_label    : optional led a label.
  *@...a_init_brt : led a init brightness. 4~255
@@ -44,6 +47,7 @@ enum lm3630a_ledb_ctrl {
  *@...b_ctrl     : led b disable, enable linear, enable exponential
  *@..._period    : pwm period
  *@..._ctrl      : pwm disable, bank a or b, active high or low
+ *@...st_ctrl    : boost converter control
  */
 struct lm3630a_platform_data {
 
@@ -60,6 +64,7 @@ struct lm3630a_platform_data {
 	/* pwm config. */
 	unsigned int pwm_period;
 	enum lm3630a_pwm_ctrl pwm_ctrl;
+	unsigned int boost_ctrl;
 };
 
 #endif /* __LINUX_LM3630A_H */

-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ