linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@sirena.org.uk>
To: David Brownell <david-b@pacbell.net>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>,
	lkml <linux-kernel@vger.kernel.org>,
	OMAP <linux-omap@vger.kernel.org>
Subject: Re: [patch 2.6.29-rc8 regulator-next] regulator: init fixes (v4)
Date: Wed, 18 Mar 2009 20:33:20 +0000	[thread overview]
Message-ID: <20090318203317.GA6299@sirena.org.uk> (raw)
In-Reply-To: <200903181225.11444.david-b@pacbell.net>

On Wed, Mar 18, 2009 at 12:25:11PM -0700, David Brownell wrote:
> On Tuesday 17 March 2009, Mark Brown wrote:

> > The drivers can essentially ignore the physical status of the regulator
> > when they start,

> That is, shared supplies should adopt a different model?

I think that's a bit strong, once we get past init the problem pretty
much goes away AFAICT.

> That approach can't be used with drivers, as for MMC slots,
> which need to ensure they start with a "power off" state as
> part of a clean reset/init sequence.

Pretty much.  They could cope if they used the enable/disable bounce
hack but if they urgently need to have a specific power state they won't
be able to cope with shared regulators anyway so it doesn't really make
any odds.

> Maybe "sharable" should be a regulator constraint flag, so
> the regulator framework can avoid committing nastiness like
> allocating multiple consumer handles for them.

Or vice versa - it's as much a property of the consumer driver that it
requires exclusivity.  From the point of view of the regulator API
there's very little difference between the two cases.

Note that for well behaved consumers that use mapped supply names we
already know about them all in advance anyway...

> > It will also work well with a 
> > late_initcall which disables any unreferenced regulators -

> The $SUBJECT patch will prevent such things from existing.

I sent a patch backing that specific change out along with the
late_initcall() patch.

> Also, regulator use that kicks in before that particular
> late_initcall will still see self-inconsistent state in
> the regulator framework ... of course, $SUBJECT patch (and
> its predecessors) is all about preventing self-inconsistency.

A driver that can cope with sharing the regulator is not going to be
able to observe anything here: it must always enable the regulator when
it is using it even if it is already enabled (since otherwise some other
consumer could cause it to be turned off) and it should expect that the
regulator might be enabled by something else.  It can't do an unbalanced
disable since otherwise it could be reversing an enable something else
did.  It's also not possible for it to inspect the use count.

If a consumer can't play with that model then I'm reasonably happy with
it having to state any additional requirements it has in some way - if
nothing else it gives us a bit of documentation about what's going on.

> That self-inconsistency doesn't seem to concern you much.

I think it's more that I'm viewing the use count as being useful
information which the API can take advantage of ("do any consumers
actually want this on right now?").  I think we should be able to handle
this without changing the use count and that this is preferable because
otherwise we make more work with shared consumers, which should be the
simplest case.

The trick is getting the non-shared regulators into sync with the
internal status, ideally without doing things like bouncing supplies
during init.  I think either using regulator_force_disable() or saying
that the consmer wants exclusive access on get and then bumping the use
count for it if the regulator is already enabled ought to cover it.
I've not thought the latter option through fully, though.

  reply	other threads:[~2009-03-18 20:33 UTC|newest]

Thread overview: 25+ 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     ` [patch 2.6.29-rc8 regulator-next] regulator: init fixes (v4) David Brownell
2009-03-15  0:37       ` 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 [this message]
2009-03-18 21:02                     ` David Brownell
2009-03-19 19:27                       ` Mark Brown
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=20090318203317.GA6299@sirena.org.uk \
    --to=broonie@sirena.org.uk \
    --cc=david-b@pacbell.net \
    --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 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).