public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] regulator: Only enable disabled regulators on resume
@ 2015-03-02 20:40 Javier Martinez Canillas
  2015-03-03 17:24 ` Doug Anderson
  2015-03-08 19:38 ` Mark Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2015-03-02 20:40 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Doug Anderson, linux-kernel,
	Javier Martinez Canillas

After leaving from system wide suspend state, regulator_suspend_finish()
turn on regulators that may be turned off by regulator_suspend_prepare()
but it tries to enable all regulators that have an enable count > 0 or
that were marked as "always-on" regardless if those were disabled or not.

Trying to enable an already enabled regulator may cause issues so is
better to skip enabling regulators that were not disabled before suspend.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 drivers/regulator/core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f2452148c8da..8551400d57e4 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3816,9 +3816,11 @@ int regulator_suspend_finish(void)
 	list_for_each_entry(rdev, &regulator_list, list) {
 		mutex_lock(&rdev->mutex);
 		if (rdev->use_count > 0  || rdev->constraints->always_on) {
-			error = _regulator_do_enable(rdev);
-			if (error)
-				ret = error;
+			if (!_regulator_is_enabled(rdev)) {
+				error = _regulator_do_enable(rdev);
+				if (error)
+					ret = error;
+			}
 		} else {
 			if (!have_full_constraints())
 				goto unlock;
-- 
2.1.3


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

end of thread, other threads:[~2015-03-11 11:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-02 20:40 [PATCH 1/1] regulator: Only enable disabled regulators on resume Javier Martinez Canillas
2015-03-03 17:24 ` Doug Anderson
2015-03-03 19:05   ` Javier Martinez Canillas
2015-03-04 13:45     ` Javier Martinez Canillas
2015-03-08 19:38       ` Mark Brown
2015-03-09  7:40         ` Javier Martinez Canillas
2015-03-11 10:57           ` Mark Brown
2015-03-11 11:00             ` Javier Martinez Canillas
2015-03-08 19:38 ` Mark Brown

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