Skip to content

Commit 02fbabd

Browse files
Fabrice Gasnierbroonie
authored andcommitted
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: 0cdbf48 ("regulator: Add support for stm32-vrefbuf") Signed-off-by: Fabrice Gasnier <[email protected]> Message-Id: <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent a5b0cda commit 02fbabd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/regulator/stm32-vrefbuf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int stm32_vrefbuf_disable(struct regulator_dev *rdev)
8888
}
8989

9090
val = readl_relaxed(priv->base + STM32_VREFBUF_CSR);
91-
val = (val & ~STM32_ENVR) | STM32_HIZ;
91+
val &= ~STM32_ENVR;
9292
writel_relaxed(val, priv->base + STM32_VREFBUF_CSR);
9393

9494
pm_runtime_mark_last_busy(priv->dev);
@@ -175,6 +175,7 @@ static const struct regulator_desc stm32_vrefbuf_regu = {
175175
.volt_table = stm32_vrefbuf_voltages,
176176
.n_voltages = ARRAY_SIZE(stm32_vrefbuf_voltages),
177177
.ops = &stm32_vrefbuf_volt_ops,
178+
.off_on_delay = 1000,
178179
.type = REGULATOR_VOLTAGE,
179180
.owner = THIS_MODULE,
180181
};

0 commit comments

Comments
 (0)