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-next>] [day] [month] [year] [list]
Date:   Fri, 16 Jul 2021 11:55:46 +0800
From:   cy_huang <u0084500@...il.com>
To:     broonie@...nel.org
Cc:     lgirdwood@...il.com, linux-kernel@...r.kernel.org,
        axel.lin@...ics.com, ChiYuan Huang <cy_huang@...htek.com>
Subject: [PATCH] regulator: rtq6752: fix reg reset behavior

From: ChiYuan Huang <cy_huang@...htek.com>

Reg will be reset in below two conditions.
1. 'Enable' pin from H to L.
2. Both PAVDD and NAVDD are all disabled.

And 'Enable' pin also control i2c communication capability.

This patch is to Seperate the if condition in enable/disable callback for
reg cache manipulation.

Signed-off-by: ChiYuan Huang <cy_huang@...htek.com>
---
Hi,
Normally, during testing, I consider only 'enable' will cause reg to be reset.
But after consulting our RD, this reset behavior not just 'Enable' H to L,
both powers are disabled, also.

This patch is used to fix this.
---
 drivers/regulator/rtq6752-regulator.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/rtq6752-regulator.c b/drivers/regulator/rtq6752-regulator.c
index 72a72aa..609d3fc 100644
--- a/drivers/regulator/rtq6752-regulator.c
+++ b/drivers/regulator/rtq6752-regulator.c
@@ -54,12 +54,14 @@ static int rtq6752_set_vdd_enable(struct regulator_dev *rdev)
 	int rid = rdev_get_id(rdev), ret;
 
 	mutex_lock(&priv->lock);
-	if (!priv->enable_flag && priv->enable_gpio) {
+	if (priv->enable_gpio) {
 		gpiod_set_value(priv->enable_gpio, 1);
 
 		usleep_range(RTQ6752_I2CRDY_TIMEUS,
 			     RTQ6752_I2CRDY_TIMEUS + 100);
+	}
 
+	if (!priv->enable_flag) {
 		regcache_cache_only(priv->regmap, false);
 		ret = regcache_sync(priv->regmap);
 		if (ret) {
@@ -86,12 +88,14 @@ static int rtq6752_set_vdd_disable(struct regulator_dev *rdev)
 	mutex_lock(&priv->lock);
 	priv->enable_flag &= ~BIT(rid);
 
-	if (!priv->enable_flag && priv->enable_gpio) {
+	if (!priv->enable_flag) {
 		regcache_cache_only(priv->regmap, true);
 		regcache_mark_dirty(priv->regmap);
+	}
 
+	if (priv->enable_gpio)
 		gpiod_set_value(priv->enable_gpio, 0);
-	}
+
 	mutex_unlock(&priv->lock);
 
 	return 0;
-- 
2.7.4

Powered by blists - more mailing lists