Skip to contentSkip to conversation

regulator: imx-anatop: Set default voltage selector for vddpu

PATCH New Markus Pargmann 2 participants 4 messages Oct 6, 2014 – Oct 7, 2014 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 regulator: imx-anatop: Set default voltage selector for vddpu

The code reads the default voltage selector from its register. If the bootloader disables the regulator, the default voltage selector will be 0 which results in faulty behaviour of this regulator driver.

This patch sets a default voltage selector for vddpu if it is not set in the register.

---
 drivers/regulator/anatop-regulator.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/regulator/anatop-regulator.c +8 -0
index 4f730af70e7c..30e8d7ad5813 100644
@@ -283,6 +283,14 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 			sreg->sel = 0;
 			sreg->bypass = true;
 		}
+
+		/*
+		 * In case vddpu was disabled by the bootloader, we need to set
+		 * a sane default until imx6-cpufreq was probed and changes the
+		 * voltage to the correct value. In this case we set 1.25V.
+		 */
+		if (!sreg->sel && !strcmp(sreg->name, "vddpu"))
+			sreg->sel = 22;
 	} else {
 		rdesc->ops = &anatop_rops;
 	}
Signature · 1 line
2.1.0
#1 lore raw

PATCH 2/2 regulator: imx-anatop: Fail on invalid voltage selector

A '0' voltage selector is invalid and can't be used with this driver.

---
 drivers/regulator/anatop-regulator.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/regulator/anatop-regulator.c +5 -0
index 30e8d7ad5813..542d14ed48bb 100644
@@ -291,6 +291,11 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 		 */
 		if (!sreg->sel && !strcmp(sreg->name, "vddpu"))
 			sreg->sel = 22;
+
+		if (!sreg->sel) {
+			dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");
+			return -EINVAL;
+		}
 	} else {
 		rdesc->ops = &anatop_rops;
 	}
Signature · 1 line
2.1.0
maintainer
#2 lore raw

PATCH 2/2 regulator: imx-anatop: Fail on invalid voltage selector

Quoted 1 line · Markus Pargmann

A '0' voltage selector is invalid and can't be used with this driver.

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141007/1bd32dca/attachment.sig>

maintainer
#3 lore raw

PATCH 1/2 regulator: imx-anatop: Set default voltage selector for vddpu

In reply to Markus Pargmann
Quoted 3 lines · Markus Pargmann

The code reads the default voltage selector from its register. If the bootloader disables the regulator, the default voltage selector will be 0 which results in faulty behaviour of this regulator driver.

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141007/ae7d7892/attachment.sig>