public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Linus Walleij <linus.ml.walleij@gmail.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Russell King <linux@arm.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] AB3100 regulator support v2
Date: Tue, 1 Sep 2009 11:23:24 +0100	[thread overview]
Message-ID: <20090901102324.GA21165@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <63386a3d0908310716x1a33a8fdpddedbaf24648216f@mail.gmail.com>

On Mon, Aug 31, 2009 at 04:16:15PM +0200, Linus Walleij wrote:
> 2009/8/31 Mark Brown <broonie@opensource.wolfsonmicro.com>:

> >> +     err = ab3100_get_register_interruptible(abreg->ab3100, abreg->regreg,
> >> +                                             &regval);

> > I did query last time if having these operations be interruptible is a
> > good idea - I can't see it helping robustness, it's not something that
> > other drivers are doing and it'd complicate things for all API users to
> > add handling for the error. I don't recall any discussion of the
> > thinking here?

> I recently renamed all the ab3100 accessor functions to *_interruptible
> to reflect the fact that the accessor mutex on ab3100 uses
> mutex_lock_interruptible() so this suffix should propagate so it is
> clear that stuff like -ERESTARTSYS can be returned.
> So the above errorcheck is probably bogus.

Oh, there's no noninterruptible version?  With the naming it looked like
there was.

> That said, I think the regulator paths are entirely in-kernel and
> under such circumstances that signals from userspace are blocked
> anyway. The problem is that the ab3100 is accessed by complex

The regulator API doesn't give any guarantees that signals can't be
delivered.

> userspace programs and I2C is sometimes slow so there is a need
> for being able to interrupt it, but I *could* go in and use an

While I2C isn't fast for the sorts of access regulators tend to do it's
not so slow as to make this critical.

> uniterruptable mutex if you prefer that, I'll ask around here if
> we should do this. Can the function name stand as it is for the time being?

> >> +static int ab3100_get_voltage_regulator_external(struct regulator_dev *reg)
> >> +{

> > Hrm.  I suspect that you either want to add some platform data to
> > specify the voltage as a plain number or just have boards use the
> > regulator supply mechanism with a fixed voltage regulator supplied by
> > this one if they need to specify the voltage of the supply.

> I was designing for it to be controllable but not controllable by the
> AB3100 driver, perhaps it is a regulator somewhere else here,
> defined in the board data. But I went for a fixed int member
> voltage setting for the time being, we can discuss that stuff later
> when I have some practical use for it.

I've got the same sort of external switch on the WM831x.  What I did
there was just not have the voltage at all.  The regulator API supports
chaining of regulators so one regulator is the supply for another so
what a board could do is set things up so that the switch on the PMIC is
the supply for an external regulator.  There's already a standard driver
for simple fixed voltage regulators and if the regulator is more complex
and supports variable voltages then it can use its normal driver.

> If this sequence is a dependency graph of regulators that need to
> have deps in all strange directions you get a directed graph
> http://en.wikipedia.org/wiki/Directed_graph
> Or you could limit yourself to a directed acyclic graph
> http://en.wikipedia.org/wiki/Directed_acyclic_graph
> in either case it's rather a delicate computational problem
> but I guess you're after a simple linear sequence here, like
> switch on A, B, C, D ... N in a special order?

The power sequencing provided by hardware designers is normally a simple
linear sequence of things to do to bring the system power up - normally
you'd bring some supplies up, wait for a given time period then bring
some more up and so on.  Sometimes there will be some handshaking
involved (waiting for "I've started" signals from components).  

> In my case it's actually not the switching-on or of that is
> the problem, it's more of putting some magic numbers
> into some registers in a special order (well, any order
> actually except for one register that is special).

> I'll see if I can think of something more elegant to
> make this more appealing, like tagging each default
> register value with a sequence number or so.

Are the magic numbers controlling things other than the settings that
are exposed through the regulator API?

  reply	other threads:[~2009-09-01 10:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-30 21:29 [PATCH 1/2] AB3100 regulator support v2 Linus Walleij
2009-08-31 12:44 ` Mark Brown
2009-08-31 14:16   ` Linus Walleij
2009-09-01 10:23     ` Mark Brown [this message]
2009-09-01 13:51     ` Russell King - ARM Linux
2009-09-01 22:05       ` Linus Walleij
2009-09-01 22:10         ` Linus Walleij
2009-09-01 22:10         ` Mark Brown
2009-09-01 13:47 ` Russell King - ARM Linux
2009-09-01 21:55   ` Linus Walleij

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=20090901102324.GA21165@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linus.ml.walleij@gmail.com \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=lrg@slimlogic.co.uk \
    --cc=sameo@linux.intel.com \
    /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