Age | Commit message (Collapse) | Author |
|
Regulator: Push lock out of _notifier_call_chain and into caller functions
(side effect of fixing deadlock in regulator_force_disable)
+ Add a voltage changed event.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
On Thu, 15 Jan 2009 16:10:22 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 14 Jan 2009 13:16:27 -0800
> David Brownell <david-b@pacbell.net> wrote:
>
> > From: David Brownell <dbrownell@users.sourceforge.net>
> >
> > Minor cleanup to the regulator set_mode sysfs support:
> > switch to sysfs_streq() in set_mode(), which is also
> > a code shrink. Use the same strings that get_mode()
> > uses, shrinking data too.
> >
> > Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> > ---
> > drivers/regulator/virtual.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > --- a/drivers/regulator/virtual.c
> > +++ b/drivers/regulator/virtual.c
> > @@ -226,13 +226,13 @@ static ssize_t set_mode(struct device *d
> > unsigned int mode;
> > int ret;
> >
> > - if (strncmp(buf, "fast", strlen("fast")) == 0)
> > + if (sysfs_streq(buf, "fast\n") == 0)
> > mode = REGULATOR_MODE_FAST;
> > - else if (strncmp(buf, "normal", strlen("normal")) == 0)
> > + else if (sysfs_streq(buf, "normal\n") == 0)
> > mode = REGULATOR_MODE_NORMAL;
> > - else if (strncmp(buf, "idle", strlen("idle")) == 0)
> > + else if (sysfs_streq(buf, "idle\n") == 0)
> > mode = REGULATOR_MODE_IDLE;
> > - else if (strncmp(buf, "standby", strlen("standby")) == 0)
> > + else if (sysfs_streq(buf, "standby\n") == 0)
> > mode = REGULATOR_MODE_STANDBY;
>
> we don't need the \n's, do we?
oh, it's for the string sharing. Sneaky.
I wonder how many people will try to fix that up for us?
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Based on previous LKML discussions:
* Update docs for regulator sysfs class attributes to highlight
the fact that all current attributes are intended to be control
inputs, including notably "state" and "opmode" which previously
implied otherwise.
* Define a new regulator driver get_status() method, which is the
first method reporting regulator outputs instead of inputs.
It can report on/off and error status; or instead of simply
"on", report the actual operating mode.
For the moment, this is a sysfs-only interface, not accessible to
regulator clients. Such clients can use the current notification
interfaces to detect errors, if the regulator reports them.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Minor cleanup to the regulator set_mode sysfs support:
switch to sysfs_streq() in set_mode(), which is also
a code shrink. Use the same strings that get_mode()
uses, shrinking data too.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Fix bounds checking of wm8350->pmic.led
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
This workaround was needed when regulator/ was not linked before both
power/ and usb/otg/ in drivers/Makefile. Now that it is even linked
before mfd/, this patch makes sure that bq24022 isn't probed before the
GPIO expander is set up.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
A pointer to wm8400_regulator_probe is passed to the core via
platform_driver_register and so the function must not disappear when the
.init sections are discarded. Otherwise (if also having HOTPLUG=y)
unbinding and binding a device to the driver via sysfs will result in an
oops as does a device being registered late.
An alternative to this patch is using platform_driver_probe instead of
platform_driver_register plus removing the pointer to the probe function
from the struct platform_driver.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Changes from V1:
- Removed support for suspend_enable & suspend_disable functions.
Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
Cc: Andy Green <andy@openmoko.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
|
|
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds:
leds: ledtrig-timer - on deactivation hardware blinking should be disabled
leds: Add suspend/resume to the core class
leds: Add WM8350 LED driver
leds: leds-pcs9532 - Move i2c work to a workqueque
leds: leds-pca9532 - fix memory leak and properly handle errors
leds: Fix wrong loop direction on removal in leds-ams-delta
leds: fix Cobalt Raq LED dependency
leds: Fix sparse warning in leds-ams-delta
leds: Fixup kdoc comment to match parameter names
leds: Make header variable naming consistent
leds: eds-pca9532: mark pca9532_event() static
leds: ALIX.2 LEDs driver
|
|
Prevent registration of duplicate "struct regulator" names.
They'd be unavailable, and clearly indicate something wrong.
[Edited to remove check for NULL consumer device until we have a
solution for things like cpufreq -- broonie]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
There are some minor textual changes in here as well, mostly to enable()
and disable() but the primary goal of these changes is to fix
misrenderings of the kerneldoc documentation for the regulator API.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
This is only the documentation that the kerneldoc system warns about.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Remove kerneldoc warnings that don't relate to missing documentation,
mostly by renaming parameters in the documentation to match their
actual names.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Some of the internal structures have no kerneldoc but the ** at the start
of the comment marking them for documentation. Remove the annotation
until some is added.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Calling set_machine_constraints before regulator device initialization
causes crash when constraints have apply_uV set.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Clean up the sysfs interface to regulators by only exposing the
attributes that can be properly displayed. For example: when a
particular regulator method is needed to display the value, only
create that attribute when that method exists.
This cleaned-up interface is much more comprehensible. Most
regulators only support a subset of the possible methods, so
often more than half the attributes would be meaningless. Many
"not defined" values are no longer necessary. (But handling
of out-of-range values still looks a bit iffy.)
Documentation is updated to reflect that few of the attributes
are *always* present, and to briefly explain why a regulator may
not have a given attribute.
This adds object code, about a dozen bytes more than was removed
by the preceding patch, but saves a bunch of per-regulator data
associated with the now-removed attributes. So there's a net
reduction in memory footprint.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Shrink regulator core by removing duplication in attribute printing
and probe() cleanup paths. Saves about 340 bytes (object) on ARM.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Minor bugfixes in handling of regulator modes:
- have the routine verifying regulator modes check against
the set of legal modes (!);
- have regulator_set_optimum_mode() verify the return value
of regulator_ops.get_optimum_mode(), like drms_uA_update();
- one call to regulator_ops.set_mode() treated zero as a
failure code; make this consistent with other callers.
Both regulator_set_mode() and regulator_set_optimum_mode() now
require valid_ops_mask to include REGULATOR_CHANGE_MODE; that
seems like a bugfix too.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Make the <linux/regulator.h> framework treat enable/disable call
pairs like the <linux/clk.h> and <linux/interrupt.h> frameworks do:
they're refcounted, so that different parts of a driver don't need
to put work into coordination that frameworks normally handle.
It's a minor object code shrink.
It also makes the regulator_is_disabled() kerneldoc say what it's
actually returning: return value is not a refcount, and may report
an error (e.g. I/O error from I2C).
It also fixes some minor regulator_put() goofage: removing unlocked
access to the enable state. (But still not making regulator put/get
match the refcounting pattern they invoke.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".
To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.
We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.
We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.
Thanks,
Kay
From: Kay Sievers <kay.sievers@vrfy.org>
Subject: regulator: struct device - replace bus_id with dev_name(), dev_set_name()
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
The voltage and current regulators on the WM8350 AudioPlus PMIC can be
used in concert to provide a power efficient LED driver. This driver
implements support for this within the standard LED class.
Platform initialisation code should configure the LED hardware in the
init callback provided by the WM8350 core driver. The callback should
use wm8350_isink_set_flash(), wm8350_dcdc25_set_mode() and
wm8350_dcdc_set_slot() to configure the operating parameters of the
regulators for their hardware and then then use wm8350_register_led() to
instantiate the LED driver.
This driver was originally written by Liam Girdwood, though it has been
extensively modified since then.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
|
|
Some WM8350 variants have fewer DCDCs and ISINKs. Identify these at
probe and refuse to use the absent DCDCs when running on these chips.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
|
|
Use menuconfig instead of flat configs so that you can disable/enable
regulator items with one selection. Also, use depends instead of
reverse selections to make life easier, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Changes the device registration part of the probe function to supply the
regulator device rather than its parent (the mfd device) as this caused
problems when the regulator core attempted to find constraints associated
with the regulators.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@kernel.org>
|
|
The WM8350 features six DCDC convertors (four buck and two boost), four
LDO voltage regulators and two constant current sinks. This driver adds
support for these through the regulator API.
This driver was written by Liam Girdwood with updates for submission
from Mark Brown.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Provide a new file 'name' in the regulator sysfs class with a human
readable name for the regulator for use in applications.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
The WM8400 provides two programmable DCDC step-down (buck) convertors
and four low-dropout (LDO) regulators. This driver provides support for
runtime managment of these in the standard regulator API.
Support for configuration of the suspend and hibernate mode behaviour
of the regulators is not yet included.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
If the machine constraints mark a regulator as always_on but this was
not done by the bootloader then enable the regulator when applying
constraints.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Try to find a human readable name for the regulator we're failing on and
print a specific diagnostic when we fail to set the suspend state.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
Since it is now mandatory to supply constraints via init_data on device
registration check for that when registering, saving us from oopsing
later on.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
This improves the machine level API in order to configure
regulator constraints and consumers as platform data and removes the
old string based API that required several calls to set up each regulator.
The intention is to create a struct regulator_init_data, populate
it's fields with constraints, consumers devices, etc and then register
the regulator device from board.c in the standard Linux way.
e.g. regulator LDO2 (supplying codec and sim) platform data.
/* regulator LDO2 consumer devices */
static struct regulator_consumer_supply ldo2_consumers[] = {
{
.dev = &platform_audio_device.dev,
.supply = "codec_avdd",
},
{
.dev = &platform_sim_device.dev,
.supply = "sim_vcc",
}
};
/* regulator LDO2 constraints */
static struct regulator_init_data ldo2_data = {
.constraints = {
.min_uV = 3300000,
.max_uV = 3300000,
.valid_modes_mask = REGULATOR_MODE_NORMAL,
.apply_uV = 1,
},
.num_consumer_supplies = ARRAY_SIZE(ldo2_consumers),
.consumer_supplies = ldo2_consumers,
};
/* machine regulator devices with thier consumers and constraints */
static struct platform_device wm8350_regulator_devices[] = {
{
.name = "wm8350-regulator",
.id = WM8350_LDO_2,
.dev = {
.platform_data = &ldo2_data,
},
},
};
Changes in detail:-
o Removed all const char* regulator config functions in machine API.
o Created new struct regulator_init_data to contain regulator
machine configuration constraints and consmuers.
o Changed set_supply(), set_machine_constraints(),
set_consumer_device_supply() to remove their string identifier
parameters. Also made them static and moved functions nearer top of
core.c.
o Removed no longer used inline func to_rdev()
o Added regulator_get_init_drvdata() to retrieve init data.
o Added struct device* as parameter to regulator_register().
o Changed my email address.
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
This adds a regulator driver for the TI bq24022 Single-Chip
Li-Ion Charger with its nCE and ISET2 pins connected to GPIOs.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
|
|
This patch adds kernel build support for the regulator core.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
|
|
This provides a virtual regulator test harness which exposes a sysfs
interface for setting power requirements, intended for test purposes only.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
|
|
This adds supports for regulator that are not software controlable. It allows
them to coexist in systems with mixed supplies.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
|
|
This adds the regulator framework core.
This framework is designed to provide a generic interface to voltage
and current regulators within the Linux kernel. It's intended to
provide voltage and current control to client or consumer drivers and
also provide status information to user space applications through a
sysfs interface.
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).
This framework safely compiles out if not selected so that client
drivers can still be used in systems with no software controllable
regulators.
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|