public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Mark Brown <broonie@sirena.org.uk>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF
Date: Thu, 13 Nov 2008 11:40:15 -0800	[thread overview]
Message-ID: <200811131140.15646.david-b@pacbell.net> (raw)
In-Reply-To: <20081112112525.GA8767@sirena.org.uk>

On Wednesday 12 November 2008, Mark Brown wrote:
> On Mon, Nov 10, 2008 at 08:56:19PM -0800, David Brownell wrote:
> > On Monday 10 November 2008, Mark Brown wrote:
>
> > > regulator_disable() needn't imply that the regulator will actually be
> > > off -
> 
> > Would you say that also for regulator_ops.disable() though?
> 
> If we ignore regulator_force_disable() (which isn't used yet) for the
> moment I'd actually say that in your case with non-software enables it's
> reasonable for it to still be powered by some other part of the system.

I'll read that as a "yes"...

... but I don't know what you mean by "non-software enables".  Maybe you
mean "non-Linux"?  One of the other inputs would normally be controlled
by software -- just not from Linux.  Maybe it'd help if you think about
a system structured like:

  - one ARM running Linux for UI, Internet access, etc
  - another one running some realtime cell modem firmware
  - both coordinating through a PMIC

So the regulator's hardware ENABLE signal is is fed by an OR gate from
both CPUs.  Similarly with a signal that's high to put the regulator
in "normal" mode (else it goes into low-current "standby" when enabled).

Those two signals (enable, normal-mode) would be under software control.
Or hardware ... the key point is that some inputs aren't from Linux.


> Mainly because it's proably easier to just ignore the other enables than
> it is to explain to the rest of the system that there are others it
> can't know about.

My recently posted v2 of this patch solves this easily enough.

It suffices to have one method report the actual hardware state
(if that includes OFF as well as NORMAL, STANDBY, etc) ... that
seems to be what you mean by calling one value "primary".  Others
can report what Linux has requested.

And having regulator_ops.get_mode() be the call to report that
hardware state is straightforward.  Especially once you consider
that the actual state *will* be what Linux requested, except in
cases like:  (a) shared regulators, like the scenario above, for
which I suspect twl4030 is the first case in Linux; (b) hardware
fault handling, like overcurrent/overtemp shutdown; and maybe
(c) "smart" regulators that switch modes automatically.

That seems to be a minimal-disruption change.

 
> > > > 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:
> 
> > > ...this sounds like the same thing done in hardware.
> 
> > Seems to me more like a three input OR gate.  No counters.  ;)
> > At least, if you ignore the additional arbitration between
> > ACTIVE, STANDBY, and OFF modes.  (Highest one wins...)
> 
> Logically that's what the regulator API is doing, it's just that
> currently it doesn't support reconfiguration of shared regulators.

Not entirely true.  In this case the issue is exposing regulator
output state ... the regulator_ops suffice for inputs, which would
combine with other inputs to determine the actual regulator state
that's reported using by regulator_ops.get_mode().


> If 
> you remember the pre-submission versions you looked at they had support
> for computing the most restrictive voltage constraint from multiple
> clients, this sounds like the same thing done in hardware for the
> regulator mode.

Yes ... the current "Dynamic Regulator Mode Switching" (DRMS) code
does some of that:  the point of having different client handles
is that those handles can encapsulate different load constraints.
And then when the load changes, the requested mode can change.


> The view of the regulator API is that the operating configuration of the
> regulator (including not only the mode but also the voltage or current)
> is done separately to enabling or disabling it.

OK, but configuration inputs to the regulator drivers are
a different issue from how to expose regulator state.

It seems we've almost converged on the result of get_mode()
being that regulator state output, which is a function of more
than just the inputs from Linux.


> The expectation when writing this was that anything 
> software controlled would be fully software controlled.

The problem is that the current code *also* ignores the fact
that hardware status is a function of more inputs than just
those from Linux.  Like thermal shutdown from overcurrent.
The configuration inputs might be fine, but the output of
a regulator necessarily incorporates other inputs.

The top reason to display system state in sysfs is to support
troubleshooting ... and hiding the actual system state makes
that needlessly difficult.

- Dave

  parent reply	other threads:[~2008-11-13 19:48 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
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 [this message]
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=200811131140.15646.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=broonie@sirena.org.uk \
    --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