linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: rtq6752: fix reg reset behavior
@ 2021-07-16  3:55 cy_huang
  2021-07-16 15:05 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: cy_huang @ 2021-07-16  3:55 UTC (permalink / raw)
  To: broonie; +Cc: lgirdwood, linux-kernel, axel.lin, ChiYuan Huang

From: ChiYuan Huang <cy_huang@richtek.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@richtek.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: rtq6752: fix reg reset behavior
  2021-07-16  3:55 [PATCH] regulator: rtq6752: fix reg reset behavior cy_huang
@ 2021-07-16 15:05 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-07-16 15:05 UTC (permalink / raw)
  To: cy_huang; +Cc: Mark Brown, lgirdwood, linux-kernel, ChiYuan Huang, axel.lin

On Fri, 16 Jul 2021 11:55:46 +0800, cy_huang wrote:
> 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.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: rtq6752: fix reg reset behavior
      commit: 513d14045a2dad0bf202b7d4c07a2ca2afdba0b4

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-16 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16  3:55 [PATCH] regulator: rtq6752: fix reg reset behavior cy_huang
2021-07-16 15:05 ` Mark Brown

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).