aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/stm32-vrefbuf.c
diff options
context:
space:
mode:
authorFabrice Gasnier <fabrice.gasnier@st.com>2020-03-04 09:55:32 +0100
committerMark Brown <broonie@kernel.org>2020-03-04 13:57:28 +0000
commit02fbabd5f4ed182d2c616e49309f5a3efd9ec671 (patch)
tree50bae0825dfaca838567cea2d6cec1f24107e9b3 /drivers/regulator/stm32-vrefbuf.c
parentregulator: qcom_spmi: Fix docs for PM8004 (diff)
downloadlinux-dev-02fbabd5f4ed182d2c616e49309f5a3efd9ec671.tar.xz
linux-dev-02fbabd5f4ed182d2c616e49309f5a3efd9ec671.zip
regulator: stm32-vrefbuf: fix a possible overshoot when re-enabling
There maybe an overshoot, when disabling, then re-enabling vrefbuf too quickly. VREFBUF is used by ADC/DAC on some boards. When re-enabling too quickly, an overshoot on the reference voltage make the conversions inaccurate for a short period of time. - Don't put the VREFBUF in HiZ when disabling, to force an active discharge. - Enforce a 1ms OFF/ON delay Fixes: 0cdbf481e927 ("regulator: Add support for stm32-vrefbuf") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Message-Id: <1583312132-20932-1-git-send-email-fabrice.gasnier@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/regulator/stm32-vrefbuf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/regulator/stm32-vrefbuf.c b/drivers/regulator/stm32-vrefbuf.c
index bdfaf7edb75a..992bc18101ef 100644
--- a/drivers/regulator/stm32-vrefbuf.c
+++ b/drivers/regulator/stm32-vrefbuf.c
@@ -88,7 +88,7 @@ static int stm32_vrefbuf_disable(struct regulator_dev *rdev)
}
val = readl_relaxed(priv->base + STM32_VREFBUF_CSR);
- val = (val & ~STM32_ENVR) | STM32_HIZ;
+ val &= ~STM32_ENVR;
writel_relaxed(val, priv->base + STM32_VREFBUF_CSR);
pm_runtime_mark_last_busy(priv->dev);
@@ -175,6 +175,7 @@ static const struct regulator_desc stm32_vrefbuf_regu = {
.volt_table = stm32_vrefbuf_voltages,
.n_voltages = ARRAY_SIZE(stm32_vrefbuf_voltages),
.ops = &stm32_vrefbuf_volt_ops,
+ .off_on_delay = 1000,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
};