linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu
@ 2014-10-06 19:33 Markus Pargmann
  2014-10-06 19:33 ` [PATCH 2/2] regulator: imx-anatop: Fail on invalid voltage selector Markus Pargmann
  2014-10-07 11:51 ` [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Pargmann @ 2014-10-06 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/regulator/anatop-regulator.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 4f730af70e7c..30e8d7ad5813 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -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;
 	}
-- 
2.1.0

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

* [PATCH 2/2] regulator: imx-anatop: Fail on invalid voltage selector
  2014-10-06 19:33 [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu Markus Pargmann
@ 2014-10-06 19:33 ` Markus Pargmann
  2014-10-07 11:52   ` Mark Brown
  2014-10-07 11:51 ` [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Pargmann @ 2014-10-06 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/regulator/anatop-regulator.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 30e8d7ad5813..542d14ed48bb 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -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;
 	}
-- 
2.1.0

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

* [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu
  2014-10-06 19:33 [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu Markus Pargmann
  2014-10-06 19:33 ` [PATCH 2/2] regulator: imx-anatop: Fail on invalid voltage selector Markus Pargmann
@ 2014-10-07 11:51 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-10-07 11:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 06, 2014 at 09:33:36PM +0200, Markus Pargmann wrote:
> 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>

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

* [PATCH 2/2] regulator: imx-anatop: Fail on invalid voltage selector
  2014-10-06 19:33 ` [PATCH 2/2] regulator: imx-anatop: Fail on invalid voltage selector Markus Pargmann
@ 2014-10-07 11:52   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-10-07 11:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 06, 2014 at 09:33:37PM +0200, Markus Pargmann wrote:
> 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>

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

end of thread, other threads:[~2014-10-07 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-06 19:33 [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu Markus Pargmann
2014-10-06 19:33 ` [PATCH 2/2] regulator: imx-anatop: Fail on invalid voltage selector Markus Pargmann
2014-10-07 11:52   ` Mark Brown
2014-10-07 11:51 ` [PATCH 1/2] regulator: imx-anatop: Set default voltage selector for vddpu 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).