All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Mark Brown <broonie@sirena.org.uk>, Liam Girdwood <lrg@slimlogic.co.uk>
Cc: lkml <linux-kernel@vger.kernel.org>, OMAP <linux-omap@vger.kernel.org>
Subject: [patch 2.6.29-rc8 regulator-next] regulator: init fixes (v4)
Date: Sat, 14 Mar 2009 17:25:35 -0700	[thread overview]
Message-ID: <200903141725.35541.david-b@pacbell.net> (raw)
In-Reply-To: <20090312120119.GB24376@sirena.org.uk>

From: David Brownell <dbrownell@users.sourceforge.net>

Make the regulator setup code cope more consistently with
regulators left enabled by the bootloader ... making it act
as if the "boot_on" flag were being set by the boot loader
(as needed) instead of by Linux board init code (always).

This eliminates the other half of the bug whereby regulators
that were enabled during the boot sequence would be enabled
with enable count of zero ... preventing regulator_disable()
from working when called from drivers.  (The first half was
fixed by the "regulator: refcount fixes" patch, and related
specifically to the "boot_on" flag.)

One open issue involves systems that need to force a regulator
off at boot time -- the converse of today's "boot_on" flag. 
There can be arbitrarily long delays between system startup
and when a driver can be loaded to turn off the regulator,
during which power is being wasted.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/regulator/core.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -815,6 +815,14 @@ static int set_machine_constraints(struc
 			goto out;
 		}
 		rdev->use_count = 1;
+	} else if (ops->is_enabled) {
+		/* ... if the bootloader left it on, drivers need a
+		 * nonzero enable count else it can't be disabled.
+		 */
+		ret = ops->is_enabled(rdev);
+		if (ret > 0)
+			rdev->use_count = 1;
+		ret = 0;
 	}
 
 	print_constraints(rdev);


  reply	other threads:[~2009-03-15  0:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12  0:43 [patch 2.6.29-rc7 regulator-next] regulator: refcount fixes David Brownell
2009-03-12  2:32 ` [patch 2.6.29-rc7 regulator-next] regulator: init fixes David Brownell
2009-03-12 12:01   ` Mark Brown
2009-03-15  0:25     ` David Brownell [this message]
2009-03-15  0:37       ` [patch 2.6.29-rc8 regulator-next] regulator: init fixes (v4) Mark Brown
2009-03-15  4:05         ` David Brownell
2009-03-16 21:54           ` Mark Brown
2009-03-17 18:15             ` David Brownell
2009-03-17 20:08               ` Mark Brown
2009-03-18 19:25                 ` David Brownell
2009-03-18 20:33                   ` Mark Brown
2009-03-18 21:02                     ` David Brownell
2009-03-19 19:27                       ` Mark Brown
2009-03-18 21:14                     ` David Brownell
2009-03-18 21:14                       ` David Brownell
2009-03-19 16:59                       ` Mark Brown
2009-03-15  4:16     ` [patch 2.6.29-rc7 regulator-next] regulator: init fixes David Brownell
2009-03-12 10:37 ` [patch 2.6.29-rc7 regulator-next] regulator: refcount fixes Mark Brown
2009-03-12 20:35   ` David Brownell
2009-03-12 21:05     ` Mark Brown
2009-03-12 23:02       ` David Brownell
2009-03-13  1:38         ` Mark Brown
2009-03-14 21:29           ` David Brownell
2009-03-15  0:30             ` Mark Brown
2009-03-15  4:27               ` David Brownell
2009-03-12 10:56 ` Liam Girdwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200903141725.35541.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=broonie@sirena.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.