[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a8ee4ae5532b67a5aef0f6e482cb37f5efbd8952.1715848512.git.mazziesaccount@gmail.com>
Date: Thu, 16 May 2024 11:53:46 +0300
From: Matti Vaittinen <mazziesaccount@...il.com>
To: Matti Vaittinen <mazziesaccount@...il.com>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
Cc: Matti Vaittinen <mazziesaccount@...il.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] regulator: don't cache vsel to ensure voltage setting
Some PMICs treat the vsel_reg same as apply-bit. Eg, when voltage range
is changed, the new voltage setting is not taking effect until the vsel
register is written.
Force the vsel value to be written to hardware even if the old selector
was same as the new (but range changed) by using regmap_write_bits() and
not the regmap_update_bits().
Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
---
I have a feeling this same thing should be done with the apply-bit
writes. I just wonder why no-one has reported problems with it. Maybe
all the hardware with the apply bit has 'self clearing' apply register
marked as volatile? Anyways, I'll leave it out of this patch because I
have no hardware to test the apply-bit stuff, and as I haven't seen any
problem reports about it.
---
drivers/regulator/helpers.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
index d49268336553..28c2f40b19cc 100644
--- a/drivers/regulator/helpers.c
+++ b/drivers/regulator/helpers.c
@@ -211,8 +211,14 @@ int regulator_set_voltage_sel_pickable_regmap(struct regulator_dev *rdev,
if (ret)
return ret;
- ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
- rdev->desc->vsel_mask, sel);
+ /*
+ * Some PMICs treat the vsel_reg same as apply-bit. Force it
+ * to be written even if the old selector were same as the new
+ * (but range changed) by using regmap_write_bits() and not the
+ * regmap_update_bits().
+ */
+ ret = regmap_write_bits(rdev->regmap, rdev->desc->vsel_reg,
+ rdev->desc->vsel_mask, sel);
}
if (ret)
--
2.44.0
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists