From: David Brownell <david-b@pacbell.net>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: broonie@opensource.wolfsonmicro.com, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF
Date: Mon, 10 Nov 2008 07:43:34 -0800 [thread overview]
Message-ID: <200811100743.34741.david-b@pacbell.net> (raw)
In-Reply-To: <1226322857.6727.117.camel@vega.slimlogic.co.uk>
On Monday 10 November 2008, Liam Girdwood wrote:
> On Sun, 2008-11-09 at 15:31 -0800, David Brownell wrote:
> > From: David Brownell <dbrownell@users.sourceforge.net>
> >
> > The regulator framework needs to expose an OFF mode for regulators
> > with a single state machine. Example: TWL4030 regulators each
> > have a status register exposing the current mode, which will be
> > either ACTIVE, STANDBY, or OFF. But regulator_ops.get_mode()
> > currently has no way to report that third (OFF) mode.
>
> OFF is currently not a regulator operating mode but is a regulator
> operating state (e.g. state is either ON or OFF).
The regulator itself supports exactly three states/modes.
You seem to imply that the programming interface should be
exposing four -- {ACTIVE, STANDBY } x { ON, OFF } -- which
doesn't reflect how the hardware works.
See below; the key conceptual problem in this interface is
probably the assumption that the Linux CPU isn't sharing
control over the regulator. So regulator_disable() can't
imply REGULATOR_MODE_OFF ... another CPU may need to keep
it in some other state.
> The modes define the
> ON (supplying power) operating modes supported by a regulator.
> I should probably add some more docs/comments here......
Seems to me more like this is a "fix the interface" case
instead of a "document the problem" one. It's not that
the implication was unclear ... but that it won't work.
> I assume the TWL4030's ACTIVE and STANDBY modes supply power and
> probably all share the same register/bits with OFF (thus making
> it more tightly coupled in the hardware).
It's *very* tightly coupled to the hardware. The regulator
state (active/standby/off) is determined by a vote between
three hardware request mechanisms ... the CPU running Linux
only gets one vote. Have a look at the docs[1], if you dare.
So for example when any of the three requestors asks for the
regulator to go ACTIVE it will do so. This means you can have
cases like:
- One CPU (running Linux, say) asks to disable() the regulator
* implemented by clearing that CPU's bit in a mask
* is_enabled() tests that bit and says "no, not enabled"
- Another CPU needs it active
* request might be coupled to the nSLEEP2 signal
* thus get_mode() will say it's ACTIVE
So you see why enable/disable is orthogonal to MODE_OFF.
It's true that it won't be OFF unless the Linux CPU is
not requesting it ("disabled" its request) ... but the
converse is false, because of the non-Linux requestor(s).
> The other two patches are fine. Would you be able to resend the first
> without the OFF mode patch changes.
I could, but I'd rather get the interface problem resolved
first. At this point, adding MODE_OFF is the only viable
option on the table...
- Dave
[1] http://focus.ti.com/docs/prod/folders/print/tps65950.html
"TPS65950" is a mouthful, so it's easier to say TWL5030
(equivalent part) or TWL4030 (predecessor part, which is
in more developers' hands).
The most relevant section of the doc seem to be chapter 5,
pp. 221-390 ... yes, some Linux-capable SOCs are smaller
and simpler chips; and no, I've not read it all either.
You'd want the TRM, 9+ MBytes, for programming info.
next prev parent reply other threads:[~2008-11-10 15:43 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-09 23:31 [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF David Brownell
2008-11-10 13:14 ` Liam Girdwood
2008-11-10 15:43 ` David Brownell [this message]
2008-11-10 16:56 ` Mark Brown
2008-11-11 4:56 ` David Brownell
2008-11-12 11:25 ` Mark Brown
2008-11-12 21:42 ` David Brownell
2008-11-12 23:09 ` Mark Brown
2008-11-12 22:23 ` Liam Girdwood
2008-11-13 0:00 ` David Brownell
2008-11-13 19:40 ` David Brownell
2008-11-13 21:53 ` Mark Brown
2008-11-15 1:15 ` David Brownell
2008-11-15 4:37 ` Mark Brown
2008-11-16 20:28 ` David Brownell
2008-11-16 22:58 ` David Brownell
2008-11-17 1:51 ` Mark Brown
2009-01-15 7:03 ` David Brownell
2009-01-15 12:29 ` Mark Brown
2009-01-15 22:32 ` David Brownell
2009-01-16 1:08 ` Mark Brown
2009-01-15 7:03 ` [patch 2.6.29-rc] regulator: add get_status() David Brownell
2009-01-15 12:04 ` Liam Girdwood
2009-01-15 12:40 ` Mark Brown
2009-01-15 12:50 ` Liam Girdwood
2009-01-15 15:35 ` David Brownell
2009-01-15 16:05 ` Mark Brown
2009-01-15 16:54 ` David Brownell
2009-01-15 18:11 ` David Brownell
2009-01-15 18:24 ` Mark Brown
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=200811100743.34741.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@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