public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] regulator: max77802: set opmode to normal if off is read from hw
@ 2014-08-26 11:37 Javier Martinez Canillas
  2014-08-26 15:44 ` Doug Anderson
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Javier Martinez Canillas @ 2014-08-26 11:37 UTC (permalink / raw)
  To: Mark Brown
  Cc: Doug Anderson, Olof Johansson, Yuvaraj Kumar C D,
	linux-samsung-soc, linux-kernel, Javier Martinez Canillas

The max77802 driver reads the default operating mode (opmode)
set for regulators when enabled from the hardware registers.

But if a regulator is disabled and the system warm restarted,
the hardware reports OFF as the opmode so the regulator is
not enabled. Default to operating mode NORMAL if OFF is read
from the hardware register.

Reported-by: Yuvaraj Cd <yuvaraj.lkml@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---

This patch fixes the issue reported in https://lkml.org/lkml/2014/8/25/69

 drivers/regulator/max77802.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index ad1caa9..967e109 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -540,7 +540,17 @@ static int max77802_pmic_probe(struct platform_device *pdev)
 		config.of_node = pdata->regulators[i].of_node;
 
 		ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val);
-		max77802->opmode[id] = val >> shift & MAX77802_OPMODE_MASK;
+		val = val >> shift & MAX77802_OPMODE_MASK;
+
+		/*
+		 * If the regulator is disabled and the system warm rebooted,
+		 * the hardware reports OFF as the regulator operating mode.
+		 * Default to operating mode NORMAL in that case.
+		 */
+		if (val == MAX77802_OPMODE_OFF)
+			max77802->opmode[id] = MAX77802_OPMODE_NORMAL;
+		else
+			max77802->opmode[id] = val;
 
 		rdev = devm_regulator_register(&pdev->dev,
 					       &regulators[i], &config);
-- 
2.0.1


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

end of thread, other threads:[~2014-08-28 10:02 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-26 11:37 [PATCH 1/1] regulator: max77802: set opmode to normal if off is read from hw Javier Martinez Canillas
2014-08-26 15:44 ` Doug Anderson
2014-08-27  6:47 ` Yuvaraj Kumar
2014-08-27 17:51 ` Mark Brown
2014-08-27 18:32 ` Tomasz Figa
2014-08-27 18:37   ` Mark Brown
2014-08-27 18:39     ` Tomasz Figa
2014-08-27 18:47       ` Mark Brown
2014-08-27 18:52         ` Tomasz Figa
2014-08-27 19:15           ` Mark Brown
2014-08-27 19:21             ` Tomasz Figa
2014-08-27 19:44               ` Mark Brown
2014-08-27 19:58                 ` Tomasz Figa
2014-08-27 20:25                   ` Mark Brown
2014-08-27 20:41                     ` Tomasz Figa
2014-08-27 21:03                       ` Tomasz Figa
2014-08-27 22:44                         ` Javier Martinez Canillas
2014-08-28  8:28                           ` Mark Brown
2014-08-28  9:59                             ` Javier Martinez Canillas
2014-08-28 10:01                               ` Mark Brown
2014-08-27 21:03                       ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox