2008-02-15 14:21:06

by Liam Girdwood

[permalink] [raw]
Subject: [PATCH 0/4] Voltage and current regulator framework

This patch series provides a generic framework to allow device drivers
to control voltage and current regulators on SoC based devices (e.g.
phones, gps, media players).

The intention is to allow systems to dynamically control regulator
output in order to save power and prolong battery life. This applies to
both voltage regulators (where voltage output is controllable) and
current sinks (where current output is controllable).

The framework is designed around SoC based devices but may also be
relevant to non SoC devices. It's also been designed against two Power
Management ICs (PMICs) currently on the market - namely the Freescale
MC13783 and the Wolfson WM8350. However it is quite generic and should
apply to all PMICs.

The framework provides several interfaces :-

1. Client or Consumer driver API.

This uses a similar API to the kernel clock interface in that client
or consumer drivers can get and put a regulator (like they can with
clocks atm) and get/set voltage, current, mode, enable and disable. This
should allow clients complete control over their supply voltage and
current. This API also compiles out if not in use so drivers can be
reused in systems with no PMIC power control.

2. Regulator driver API.

This allows regulator drivers to register their regulators and provide
operations to the core. It also has a notifier call chain for
propagating regulator events to clients.

3. Platform API.

This API is for platform/device specific code and allows the creation
of voltage/current domains (with constraints) for each regulator. It can
provide regulator constraints that will prevent device damage through
over voltage or over current caused by buggy client drivers. It also
allows the creation of a regulator tree whereby some regulators are
supplied by others (similar to a clock tree).

4. Userspace.

The framework also exports a lot of useful voltage/current data to
userspace via sysfs. This could be used to monitor device and regulator
power and status.

Fwiw, there is code in our public git tree that currently shows this API
in use:-

http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-audioplus.git;a=shortlog;h=imx31

All the relevant files are under include/linux/regulator and
drivers/regulator. There are client drivers here :-

http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-audioplus.git;a=blob;f=arch/arm/mach-mx3/cpufreq.c;h=77f03d85fef6b29b0ca2e820d38d9ebb068e7bf7;hb=imx31

http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-audioplus.git;a=blob;f=drivers/leds/leds-wm8350.c;h=a81bbf9154b4de13c029aee0613294562a03f506;hb=imx31

http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-audioplus.git;a=blob;f=drivers/video/backlight/wm8350_bl.c;h=3eafb83683b7f242ec78ff620431307c25e23202;hb=imx31

http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-audioplus.git;a=blob;f=sound/soc/imx/imx32ads-wm8350.c;h=aae347ac556203fbdb64d71f4dc0be7df250767a;hb=imx31

Patch follows.

Liam


2008-02-15 15:24:54

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 0/4] Voltage and current regulator framework

On Fri, Feb 15, 2008 at 02:10:41PM +0000, Liam Girdwood wrote:
> This patch series provides a generic framework to allow device drivers
> to control voltage and current regulators on SoC based devices (e.g.
> phones, gps, media players).
>
> The intention is to allow systems to dynamically control regulator
> output in order to save power and prolong battery life. This applies to
> both voltage regulators (where voltage output is controllable) and
> current sinks (where current output is controllable).
>
> The framework is designed around SoC based devices but may also be
> relevant to non SoC devices. It's also been designed against two Power
> Management ICs (PMICs) currently on the market - namely the Freescale
> MC13783 and the Wolfson WM8350. However it is quite generic and should
> apply to all PMICs.

General comments related to your patch submission - not to the code.

- Each patch should have a descriptive subject for the said patch.
The headlines you use below looks fine for this.
- Tag each subject with name of the framework so it is obvious
they belong to the same area.
Note that the numbers will be lost when the patches are applied to git.
- Each patch should contain a description of what it contains
and why it is needed.
You seem to have it written but it is 'hidden' in the 0/4
mail that will not go into git - so the info is hard to find when
the patches goes in.
- Each patch should contain a diffstat before the actual patch so
it is obvious what is touched by the patch.
- The patches should not break the build.
As your patches did not include any Makefile / Kconfig fragments
I gues you have no issues here.
It is typical to split up patches like you have done and apply
the MAkefile/Kconfig bits as the final patch to make sure the kernel
continue to build.

Sam

2008-02-15 15:27:17

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 0/4] Voltage and current regulator framework

On Fri, Feb 15, 2008 at 04:24:51PM +0100, Sam Ravnborg wrote:
> On Fri, Feb 15, 2008 at 02:10:41PM +0000, Liam Girdwood wrote:
> > This patch series provides a generic framework to allow device drivers
> > to control voltage and current regulators on SoC based devices (e.g.
> > phones, gps, media players).
> >
> > The intention is to allow systems to dynamically control regulator
> > output in order to save power and prolong battery life. This applies to
> > both voltage regulators (where voltage output is controllable) and
> > current sinks (where current output is controllable).
> >
> > The framework is designed around SoC based devices but may also be
> > relevant to non SoC devices. It's also been designed against two Power
> > Management ICs (PMICs) currently on the market - namely the Freescale
> > MC13783 and the Wolfson WM8350. However it is quite generic and should
> > apply to all PMICs.
>
> General comments related to your patch submission - not to the code.

And please run your patches through scripts/checkpatch.pl and fix
the obvious issues.

Sam