Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Brownell
Date: Monday, November 10, 2008 - 8:43 am

On Monday 10 November 2008, Liam Girdwood wrote:

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.



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.



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).



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.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Sun Nov 9, 4:31 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, Liam Girdwood, (Mon Nov 10, 6:14 am)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Mon Nov 10, 8:43 am)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Mon Nov 10, 9:56 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Wed Nov 12, 2:42 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, Liam Girdwood, (Wed Nov 12, 3:23 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Wed Nov 12, 5:00 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Thu Nov 13, 12:40 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Fri Nov 14, 6:15 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Sun Nov 16, 1:28 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Sun Nov 16, 3:58 pm)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Thu Jan 15, 12:03 am)
[patch 2.6.29-rc] regulator: add get_status(), David Brownell, (Thu Jan 15, 12:03 am)
Re: [patch 2.6.29-rc] regulator: add get_status(), Liam Girdwood, (Thu Jan 15, 5:04 am)
Re: [patch 2.6.29-rc] regulator: add get_status(), Mark Brown, (Thu Jan 15, 5:40 am)
Re: [patch 2.6.29-rc] regulator: add get_status(), Liam Girdwood, (Thu Jan 15, 5:50 am)
Re: [patch 2.6.29-rc] regulator: add get_status(), David Brownell, (Thu Jan 15, 8:35 am)
Re: [patch 2.6.29-rc] regulator: add get_status(), Mark Brown, (Thu Jan 15, 9:05 am)
Re: [patch 2.6.29-rc] regulator: add get_status(), David Brownell, (Thu Jan 15, 9:54 am)
Re: [patch 2.6.29-rc] regulator: add get_status(), David Brownell, (Thu Jan 15, 11:11 am)
Re: [patch 2.6.29-rc] regulator: add get_status(), Mark Brown, (Thu Jan 15, 11:24 am)
Re: [patch 2.6.28-rc3] regulator: add REGULATOR_MODE_OFF, David Brownell, (Thu Jan 15, 3:32 pm)