History log of /drivers/regulator/gpio-regulator.c
Revision Date Author Comments
1f5a9623eb4300a722eab2f6c6a31a194c804cec 13-Feb-2014 Heiko Stuebner <heiko.stuebner@bqreaders.com> regulator: gpio-regulator: fix forgotten gpios-states reading

Commit 934624d6e9f0 ("regulator: gpio-regulator: do not open-code counting
and access of dt array elements") forgot to convert the recently added
gpios-states property using the same pattern.

Convert this instance to use the of-helpers too, resolving the build error.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bqreaders.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
934624d6e9f0b3d41557c4105c286e8daeaadb4e 12-Feb-2014 Heiko Stuebner <heiko.stuebner@bqreaders.com> regulator: gpio-regulator: do not open-code counting and access of dt array elements

Open coding the counting of elements in a dt-property is abstracted by the newly
introduced of_property_count_uXX_elems functions. Additionally the raw iteration
over the states element exposes the endian conversion and dtb-format details,
which according to Mark Rutland "would be nice to limit [...] to of_ helper
functions".

Thus change gpio-regulator to use the helper for element counting and
of_property_read_u32_index for retrieval of individual values.

This makes it possible to remove the raw access to the states property entirely.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bqreaders.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
5676ddc5c62861467582b10b88aadb25ea9c3b52 12-Feb-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> regulator: gpio: print warning if gpios <-> gpios-states mismatch on DT

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
0094050d783bbadffe83effef11a0bda901153ce 31-Jan-2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> regulator: gpio: add gpios-status for DT

config->gpios[x].flags indicates initial pin status,
and it will be used for drvdata->state
on gpio_regulator_probe().
But, current of_get_gpio_regulator_config() doesn't care
about this flags.
This patch adds new gpios-status property in order to
care about initial pin status.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9c25960cbba1fb452adf6a7b9d740fc4358f7d92 24-Jan-2014 Fabio Estevam <fabio.estevam@freescale.com> regulator: gpio-regulator: Remove unneeded OOM error message

There is no need to print an OOM message after devm_kzalloc, since there is
a generic OOM message in place.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9eb9d3150bd941be2f2e370e0081736d9d51e31b 05-Dec-2013 Mark Brown <broonie@linaro.org> regulator: gpio: Warn if an invalid regulator-type is supplied

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
5b1ada83bae7d689cf1fe76eb1bdd058ea84a97c 05-Dec-2013 Mark Brown <broonie@linaro.org> regulator: gpio: Don't require a regulator-type property

Since essentially all GPIO controlled regulators are voltage regulators
make the regulator-type property optional, defaulting to voltage.

Signed-off-by: Mark Brown <broonie@linaro.org>
251b9c21d26ca9d210e7673f0819ee1f6c19402a 09-Nov-2013 Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> regulator: gpio-regulator: Don't oops on missing regulator-type property

Catch missing regulator-type property in DT and return an error
gracefully instead of deferencing a NULL pointer and crashing.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
6653efb75dcac8fc61191cba9bd6dda99137bc44 04-Oct-2013 Sachin Kamat <sachin.kamat@linaro.org> regulator: gpio: Remove redundant break

'break' after goto has no effect. Remove it.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
dff91d0b721bf8f036c1071a8f16a7effaa87514 30-Jul-2013 Jingoo Han <jg1.han@samsung.com> regulator: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
a451405fcdf4048aa46c80ede25b36eba27ba3ec 28-Jan-2013 Axel Lin <axel.lin@ingics.com> regulator: gpio-regulator: Staticize of_get_gpio_regulator_config()

of_get_gpio_regulator_config() is only used in gpio-regulator.c, make it static.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
655efa0ff202484ac1ec43156b98373b53a77eb3 28-Jan-2013 Axel Lin <axel.lin@ingics.com> regulator: gpio-regulator: Use of_gpio_count()

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
3d68dfe32472fc74cabaa576feb69c3e03f9d4cf 21-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Drivers: regulator: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Liam Girdwood <lrg@ti.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3708903ee60b1b89cbeee00cbc76e9fdbcbbed2e 10-Dec-2012 Lee Jones <lee.jones@linaro.org> regulator: gpio-regulator: gpio_set_value should use cansleep

If it's possible for gpio_set_value to sleep, we should be using
the *_cansleep call instead. This patch fixes multiple warnings
from gpiolib.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ad0b8b9e82b63ad2cc5e6822448adc897f49a5c4 10-Dec-2012 Lee Jones <lee.jones@linaro.org> regulator: gpio-regulator: Fix logical error in for() loop

The cond-statement of this particular for() loop will always be
true as long as at least one voltage-shifting GPIO is present.
If it wasn't for the break below, we'd be stuck in a forever loop.
This patch inserts the correct cond-statement into the statement.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ec4f7b88b4a89253ec922d48f77b269ce5cffc2c 04-Dec-2012 Axel Lin <axel.lin@ingics.com> regulator: gpio-regulator: Add ifdef CONFIG_OF guard for regulator_gpio_of_match

Use of_match_ptr and add ifdef CONFIG_OF guard for regulator_gpio_of_match.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
8dc995f56ef7aedb41873fdeaa1971f3aa166ebd 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> regulator: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
a5023574d120ca3b9337cedd4e27de90cae9aff7 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> regulator: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
5eb9f2b96381ac3fa4a5910c37213c1cb62e9c65 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> regulator: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
216f2b9c95ac6e4f00b08df807bc4454434a9afb 14-Nov-2012 Lee Jones <lee.jones@linaro.org> regulator: gpio-regulator: Catch 'no states property' misuse

A selection of voltage or current values (AKA states) should always
be specified when using a GPIO regulator. If there are no switchable
states then the fixed regulators should be used instead.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
f8a9f757cb425c4784b80b001c7a77c7810b499f 12-Nov-2012 Frank Li <Frank.Li@freescale.com> regulator: gpio-regulator: fix can't find regulator node in dt

Need initilize of_node in regulator config when register regulator,
otherwise regulator driver think it is no-dt device.

in regulator_dev_lookup
list_for_each_entry(r, &regulator_list, list)
if (r->dev.parent &&
node == r->dev.of_node)
return r

r->dev.of_noe will be zero if miss config in cfg.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
006694d099e86e5a928fb39bdea280ab42c9d59c 15-Oct-2012 Lee Jones <lee.jones@linaro.org> regulator: gpio-regulator: Allow use of GPIO controlled regulators though DT

Here we provide the GPIO Regulator driver with Device Tree capability, so
that when a platform is booting with DT instead of platform data we can
still make full use of it.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
eb0c5686b3c6332892b3eb5d8bb9eb04f943cb25 08-Aug-2012 Heiko Stübner <heiko@sntech.de> regulator: gpio-regulator: Split setting of voltages and currents

Originally gpio-regulator used the first item of its state list
that matched the given voltage or current range.

Commit 4dbd8f63f0 (regulator: gpio-regulator: Set the smallest voltage/current
in the specified range) changed this, to make the selection independent of
the ordering of the state list.

But selecting the minimal value is only true for voltage regulators.
For current regulators the maximum in the given range should be
selected instead.

Therefore split the previous common selection function into specific
functions for voltage and current regulators.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
4b7c948f558bf1d51aa25a6f621056c0acf45228 04-Jul-2012 Axel Lin <axel.lin@gmail.com> regulator: gpio-regulator: Use core GPIO enable support

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
a2a8222be8385818ade54554a50f7904ed0e506f 04-Jul-2012 Axel Lin <axel.lin@gmail.com> regulator: gpio-regulator: Set enable enable_time in regulator_desc

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
b0e4d7bf8b5704904a5d138d81a8ec8b7145767f 03-Jun-2012 Heiko Stübner <heiko@sntech.de> regulator: gpio-regulator: populate selector from set_voltage

This was missing until now and the underlying
_regulator_do_set_voltage is using this value when calling list_voltage.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
00926369b745fb0c1e5c27cec35f6adc9752f2c4 03-Jun-2012 Heiko Stübner <heiko@sntech.de> regulator: gpio-regulator: Fix finding of smallest value

Commit 4dbd8f63f07a (regulator: gpio-regulator: Set the smallest
voltage/current in the specified range) forgot to set the newly
introduced best_val.

Therefore it stayed always at INT_MAX thus breaking the setting
of the voltage.

Included is also an init value for target, as warnings about
a possibly uninitialised target started appearing with this fix.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
7d4be2f5ad223942577c2319153b86592f3da5b2 03-Jun-2012 Heiko Stübner <heiko@sntech.de> regulator: gpio-regulator: do not pass drvdata pointer as reference

Commit c172708d38a4 (regulator: core: Use a struct to pass in
regulator runtime configuration) added the drvdata pointer
only per reference to the new config array in the gpio-regulator.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
6c9eeb0f5cac0d9fd05c138f1eec86a7f70630ce 18-Apr-2012 Axel Lin <axel.lin@gmail.com> regulator: Remove unneeded include of linux/delay.h from regulator drivers

All the drivers that need delay for the regulator voltage output voltage to
stabilize after being enabled or after being set to a new value has been
converted to implement enable_time and set_voltage_time_sel callbacks.
Then regulator core will take care of the necessary delay.

For the drivers that don't need the delay, don't need to include linux/delay.h.
This patch removes the unneeded include of linux/delay.h in regulator drivers.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
c172708d38a401b2f3f841dfcd862b469fa0b670 04-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com> regulator: core: Use a struct to pass in regulator runtime configuration

Rather than adding new arguments to regulator_register() every time we
want to add a new bit of dynamic information at runtime change the function
to take these via a struct. By doing this we avoid needing to do further
changes like the recent addition of device tree support which required each
regulator driver to be updated to take an additional parameter.

The regulator_desc which should (mostly) be static data is still passed
separately as most drivers are able to configure this statically at build
time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
02b552160f955a6dd6a54600f262365dc8916d69 04-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com> regulator: gpio-regulator: Basic devm_kzalloc() conversion

There's some other allocations but they're not so trivial as they use
kmemdup() and kstrdup().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
4dbd8f63f07a9e945f053d61d6f313ad98dda39d 22-Mar-2012 Axel Lin <axel.lin@gmail.com> regulator: gpio-regulator: Set the smallest voltage/current in the specified range

Do not assume the gpio regulator states map is sorted in any order.
This patch ensures we always set the smallest voltage/current that falls within
the specified range.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
156843470c4b9ea9698cc245d2cff769b3784088 23-Nov-2011 Rajendra Nayak <rnayak@ti.com> regulator: Fix compile break due to missing arguments to regulator_register

The commit 2c043bcbf287 ("regulator: pass additional of_node to
regulator_register()") caused a compile break because it missed
updating the regulator_register() call in gpio-regulator.c with
the additional parameter (NULL).

The compile break as reported by Stephen Rothwell with the
x86_64 allmodconfig looked like this

drivers/regulator/gpio-regulator.c: In function 'gpio_regulator_probe':
drivers/regulator/gpio-regulator.c:287:8: error: too few arguments to function 'regulator_register'
include/linux/regulator/driver.h:215:23: note: declared here

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ecc37edf7b670616a9dc78a0bdd4911a22d551ec 11-Oct-2011 Mark Brown <broonie@opensource.wolfsonmicro.com> regulator: Add module.h include to gpio-regulator

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
3f0292ae8bb100cc8f96106a3de277df48134887 05-Oct-2011 Heiko Stübner <heiko@sntech.de> regulator: Add driver for gpio-controlled regulators

This patch adds support for regulators that can be controlled via gpios.

Examples for such regulators are the TI-tps65024x voltage regulators
with 4 fixed and 1 runtime-switchable voltage regulators
or the TI-bq240XX charger regulators.

The number of controlling gpios is not limited, the mapping between
voltage/current and target gpio state is done via the states map
and the driver can be used for either voltage or current regulators.

A mapping for a regulator with two GPIOs could look like:

gpios = {
{ .gpio = GPIO1, .flags = GPIOF_OUT_INIT_HIGH, .label = "gpio name 1" },
{ .gpio = GPIO2, .flags = GPIOF_OUT_INIT_LOW, .label = "gpio name 2" },
}

The flags element of the gpios array determines the initial state of
the gpio, set during probe. The initial state of the regulator is also
calculated from these values

states = {
{ .value = volt_or_cur1, .gpios = (0 << 1) | (0 << 0) },
{ .value = volt_or_cur2, .gpios = (0 << 1) | (1 << 0) },
{ .value = volt_or_cur3, .gpios = (1 << 1) | (0 << 0) },
{ .value = volt_or_cur4, .gpios = (1 << 1) | (1 << 0) },
}

The target-state for the n-th gpio is determined by the n-th bit
in the bitfield of the target-value.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>