public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* regulator: adding enable control to fixed regulator interface
@ 2009-07-30 12:20 Roger Quadros
  2009-07-30 12:36 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Roger Quadros @ 2009-07-30 12:20 UTC (permalink / raw)
  To: broonie; +Cc: lrg, linux-kernel

hi Mark,

I have the following use-case scenario for a fixed voltage regulator.


Supply ----->| Regulator |-------> Peripheral

                  ^ EN
                  |
GPIO -------------


The regulator's enable pin is controlled by a GPIO of the CPU.

What is the best way to implement this within the regulator framework?
Writing a regulator driver is one solution but I'm sure there must be
many instances like this and writing a driver for each case is not
that nice.

I want to use the fixed regulator driver but this does not have
regulator enable/disable control.

Isn't it a good idea to have enable/disable control for the current
implementation of the fixed voltage regulator i.e. drivers/regulator/fixed.c ?

The regulator enabling/disabling functionality can be implemented by
platform code and the required function pointers could be passed through
fixed_voltage_config structure.

If this looks OK, I can send you a patch to implement this functionality.

cheers,
-roger

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regulator: adding enable control to fixed regulator interface
  2009-07-30 12:20 regulator: adding enable control to fixed regulator interface Roger Quadros
@ 2009-07-30 12:36 ` Mark Brown
  2009-07-30 12:52   ` Roger Quadros
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-07-30 12:36 UTC (permalink / raw)
  To: Roger Quadros; +Cc: lrg, linux-kernel

On Thu, Jul 30, 2009 at 03:20:24PM +0300, Roger Quadros wrote:

[Cut description of GPIO-switched regulator.]

> What is the best way to implement this within the regulator framework?
> Writing a regulator driver is one solution but I'm sure there must be
> many instances like this and writing a driver for each case is not
> that nice.

Only one driver should be needed even if a new driver is implemented for
this - we already have an abstracted API for GPIOs in the form of
gpiolib (see drivers/gpio) so the driver can just take in platform data
with the gpio number and a voltage as platform data.

> I want to use the fixed regulator driver but this does not have
> regulator enable/disable control.

> Isn't it a good idea to have enable/disable control for the current
> implementation of the fixed voltage regulator i.e. drivers/regulator/fixed.c ?

It should be possible to do it with platform data for the fixed voltage
regulator, though without looking at the code I can't say for certain if
it'd be easier to just add a separate driver rather than have the
conditional code to handle cases both with and without GPIO.  I'd expect
it'll be fine to combine, though.

> The regulator enabling/disabling functionality can be implemented by
> platform code and the required function pointers could be passed through
> fixed_voltage_config structure.

I don't see any need for platform code to provide callbacks here given
the existing gpiolib abstraction.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regulator: adding enable control to fixed regulator interface
  2009-07-30 12:36 ` Mark Brown
@ 2009-07-30 12:52   ` Roger Quadros
  2009-07-30 12:55     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Roger Quadros @ 2009-07-30 12:52 UTC (permalink / raw)
  To: Mark Brown; +Cc: lrg, linux-kernel

On Thu, Jul 30, 2009 at 3:36 PM, Mark
Brown<broonie@opensource.wolfsonmicro.com> wrote:
> On Thu, Jul 30, 2009 at 03:20:24PM +0300, Roger Quadros wrote:
>
> [Cut description of GPIO-switched regulator.]
>
>> What is the best way to implement this within the regulator framework?
>> Writing a regulator driver is one solution but I'm sure there must be
>> many instances like this and writing a driver for each case is not
>> that nice.
>
> Only one driver should be needed even if a new driver is implemented for
> this - we already have an abstracted API for GPIOs in the form of
> gpiolib (see drivers/gpio) so the driver can just take in platform data
> with the gpio number and a voltage as platform data.
>

Yes using gpiolib makes sense. In this case we need to obtain GPIO number
and enabling polarity (active high/low) through platform data.

>> I want to use the fixed regulator driver but this does not have
>> regulator enable/disable control.
>
>> Isn't it a good idea to have enable/disable control for the current
>> implementation of the fixed voltage regulator i.e. drivers/regulator/fixed.c ?
>
> It should be possible to do it with platform data for the fixed voltage
> regulator, though without looking at the code I can't say for certain if
> it'd be easier to just add a separate driver rather than have the
> conditional code to handle cases both with and without GPIO.  I'd expect
> it'll be fine to combine, though.
>
>> The regulator enabling/disabling functionality can be implemented by
>> platform code and the required function pointers could be passed through
>> fixed_voltage_config structure.
>
> I don't see any need for platform code to provide callbacks here given
> the existing gpiolib abstraction.
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regulator: adding enable control to fixed regulator interface
  2009-07-30 12:52   ` Roger Quadros
@ 2009-07-30 12:55     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-07-30 12:55 UTC (permalink / raw)
  To: Roger Quadros; +Cc: lrg, linux-kernel

On Thu, Jul 30, 2009 at 03:52:55PM +0300, Roger Quadros wrote:

> Yes using gpiolib makes sense. In this case we need to obtain GPIO number
> and enabling polarity (active high/low) through platform data.

Yes, you will need to add to the platform data.  I'd just not expect to
see any function pointers required.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-30 12:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-30 12:20 regulator: adding enable control to fixed regulator interface Roger Quadros
2009-07-30 12:36 ` Mark Brown
2009-07-30 12:52   ` Roger Quadros
2009-07-30 12:55     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox