linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: anatop: Drop min dropout for bypass mode
@ 2020-03-03 14:24 Anson Huang
  2020-03-03 17:10 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Anson Huang @ 2020-03-03 14:24 UTC (permalink / raw)
  To: lgirdwood, broonie, linux-kernel; +Cc: Linux-imx

Some of anatop regulators support bypass mode, and in bypass mode,
minimum dropout is NOT required, the input voltage will be equal to
the output voltage. The minimum dropout value is ONLY necessary for
LDO enabled mode, so drop the minimum dropout for bypass mode to
avoid unexpected high voltage output from PMIC supplies.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/regulator/anatop-regulator.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index ca92b3d..1a775d9 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -22,6 +22,7 @@
 #define LDO_POWER_GATE			0x00
 #define LDO_FET_FULL_ON			0x1f
 
+#define LDO_MIN_DROPOUT_UV		125000
 struct anatop_regulator {
 	u32 delay_reg;
 	int delay_bit_shift;
@@ -128,6 +129,10 @@ static int anatop_regmap_set_bypass(struct regulator_dev *reg, bool enable)
 
 	sel = enable ? LDO_FET_FULL_ON : anatop_reg->sel;
 	anatop_reg->bypass = enable;
+	if (anatop_reg->bypass)
+		anatop_reg->rdesc.min_dropout_uV = 0;
+	else
+		anatop_reg->rdesc.min_dropout_uV = LDO_MIN_DROPOUT_UV;
 
 	return regulator_set_voltage_sel_regmap(reg, sel);
 }
@@ -246,7 +251,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 	rdesc->linear_min_sel = min_bit_val;
 	rdesc->vsel_reg = control_reg;
 	rdesc->vsel_mask = ((1 << vol_bit_width) - 1) << vol_bit_shift;
-	rdesc->min_dropout_uV = 125000;
+	rdesc->min_dropout_uV = LDO_MIN_DROPOUT_UV;
 
 	config.dev = &pdev->dev;
 	config.init_data = initdata;
@@ -268,6 +273,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 		if (sreg->sel == LDO_FET_FULL_ON) {
 			sreg->sel = 0;
 			sreg->bypass = true;
+			rdesc->min_dropout_uV = 0;
 		}
 
 		/*
-- 
2.7.4


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

end of thread, other threads:[~2020-03-03 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 14:24 [PATCH] regulator: anatop: Drop min dropout for bypass mode Anson Huang
2020-03-03 17:10 ` 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).