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: <20240712004556.15601-2-ansuelsmth@gmail.com>
Date: Fri, 12 Jul 2024 02:45:53 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Pavel Machek <pavel@....cz>,
	Lee Jones <lee@...nel.org>,
	linux-leds@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Christian Marangi <ansuelsmth@...il.com>
Subject: [PATCH v2 2/3] leds: leds-lp5569: Better handle enabling clock internal setting

Better handle enabling clock internal setting. In further testing it was
notice that internal clock config MUST be set before clock output config
or the LED CHIP might stop working.

This wasn't documented and was actually found on devices that have 2
chip chained where one chip provide clock for the other.

Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
---
 drivers/leds/leds-lp5569.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/leds/leds-lp5569.c b/drivers/leds/leds-lp5569.c
index b7a74d6c19ca..2b4f358bc63a 100644
--- a/drivers/leds/leds-lp5569.c
+++ b/drivers/leds/leds-lp5569.c
@@ -179,20 +179,25 @@ static int lp5569_post_init_device(struct lp55xx_chip *chip)
 
 	val = LP5569_DEFAULT_CONFIG;
 	val |= FIELD_PREP(LP5569_CP_MODE_MASK, chip->pdata->charge_pump_mode);
+	ret = lp55xx_write(chip, LP5569_REG_MISC, val);
+	if (ret)
+		return ret;
 
 	if (chip->pdata->clock_mode == LP55XX_CLOCK_INT) {
+		/* Internal clock MUST be configured before CLK output */
+		ret = lp55xx_update_bits(chip, LP5569_REG_MISC,
+					 LP5569_INTERNAL_CLK,
+					 LP5569_INTERNAL_CLK);
+		if (ret)
+			return ret;
+
 		ret = lp55xx_update_bits(chip, LP5569_REG_IO_CONTROL,
 					 LP5569_CLK_OUTPUT,
 					 LP5569_CLK_OUTPUT);
 		if (ret)
 			return ret;
-
-		val |= LP5569_INTERNAL_CLK;
 	}
 
-	ret = lp55xx_write(chip, LP5569_REG_MISC, val);
-	if (ret)
-		return ret;
 
 	return lp5569_init_program_engine(chip);
 }
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ