2022-03-28 11:58:21

by Jonathan Bakker

[permalink] [raw]
Subject: [PATCH] regulator: wm8994: Add an off-on delay for WM8994 variant

As per Table 130 of the wm8994 datasheet at [1], there is an off-on
delay for LDO1 and LDO2. In the wm8958 datasheet [2], I could not
find any reference to it. I could not find a wm1811 datasheet to
double-check there, but as no one has complained presumably it works
without it.

This solves the issue on Samsung Aries boards with a wm8994 where
register writes fail when the device is powered off and back-on
quickly.

[1] https://statics.cirrus.com/pubs/proDatasheet/WM8994_Rev4.6.pdf
[2] https://statics.cirrus.com/pubs/proDatasheet/WM8958_v3.5.pdf

Signed-off-by: Jonathan Bakker <[email protected]>
---
drivers/regulator/wm8994-regulator.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index cadea0344486..135fdf3f9fdd 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -70,7 +70,7 @@ static const struct regulator_ops wm8994_ldo2_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
};

-static const struct regulator_desc wm8994_ldo_desc[] = {
+static struct regulator_desc wm8994_ldo_desc[] = {
{
.name = "LDO1",
.id = 1,
@@ -167,6 +167,10 @@ static int wm8994_ldo_probe(struct platform_device *pdev)
ldo->init_data = *pdata->ldo[id].init_data;
}

+ /* WM8994 requires an off-on delay while others do not */
+ if (ldo->wm8994->type == WM8994)
+ wm8994_ldo_desc[id].off_on_delay = 36000;
+
/*
* At this point the GPIO descriptor is handled over to the
* regulator core and we need not worry about it on the
--
2.20.1