Commit graph

903 commits

Author SHA1 Message Date
Laxman Dewangan 9a00630c3d regulator: tps62360: support force PWM mode via regulator mode
Change the mechanism of enabling the force PWM mode through
regulator set mode. This can be dynamically configured now.
In the REGULATOR_MODE_FAST the force PWM is enabled and in
REGULATOR_MODE_NORMAL the force PWM is disabled.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 18:03:04 +01:00
Axel Lin 70e5f6456c regulator: rc5t583: Convert to regulator_set_voltage_sel_regmap and regulator_map_voltage_linear
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 17:49:24 +01:00
Axel Lin 3209be1798 regulator: rc5t583: Convert to regulator_list_voltage_linear()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 17:49:13 +01:00
Axel Lin 40baecee48 regulator: max8649: Convert to regulator_set_voltage_sel_regmap and regulator_map_voltage_linear
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 17:34:48 +01:00
Axel Lin 0fb737b566 regulator: max8649: Convert to regulator_list_voltage_linear()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 17:34:48 +01:00
Axel Lin 817d8c2d9b regulator: max8649: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 17:34:47 +01:00
Axel Lin 0f65402b25 regulator: max8649: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 17:34:46 +01:00
Axel Lin be15411d97 regulator: tps62360: Fix build error due to missing semicolon
Fix below build error:
  CC [M]  drivers/regulator/tps62360-regulator.o
drivers/regulator/tps62360-regulator.c:351:1: error: expected ',' or ';' before 'extern'
make[2]: *** [drivers/regulator/tps62360-regulator.o] Error 1
make[1]: *** [drivers/regulator] Error 2
make: *** [drivers] Error 2

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 17:34:31 +01:00
Mark Brown b68b45d77d regulator: wm8994: Allow registration with no platform data
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 15:25:33 +01:00
Mark Brown b1a868310e regulator: core: Don't open code _regulator_is_enabled()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-14 15:25:19 +01:00
Mark Brown f0b067d9b6 regulator: wm831x-dcdc: Add missing checks for pdata before use
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 11:41:36 +01:00
Axel Lin cd8318cb9e regulator: max8925: Convert to set_voltage_sel() and map_voltage()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 11:00:40 +01:00
Axel Lin 4093e739f7 regulator: max8925: Convert to regulator_list_voltage_linear()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 11:00:39 +01:00
Axel Lin 3c8983b9ac regulator: max8925: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 11:00:39 +01:00
Mark Brown e81dba85c6 regulator: core: Release regulator-regulator supplies on error
If we fail while registering a regulator make sure we release the supply
for the regulator if there is one.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Cc: stable@vger.kernel.org
2012-05-14 09:31:35 +01:00
Axel Lin 41097afd64 regulator: tps62360: Convert to set_voltage_sel and regulator_map_voltage_linear
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 09:12:00 +01:00
Axel Lin 7f225ba585 regulator: tps62360: Convert to regulator_list_voltage_linear()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 09:11:51 +01:00
Axel Lin ccfcb1c3cf regulator: core: Ensure simple linear voltage mappings falls within the specified range
Integer division may truncate the result.
Use DIV_ROUND_UP to ensure simple linear voltage mappings falls within the
specified range.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 09:11:34 +01:00
Laxman Dewangan 684ae39b91 regulator: tps62360: add dt support
Add dt support for the pmu device tps62360 and
Add binding documentation with example.
With this patch driver will support both device-tree and
non-device tree registration.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-13 13:47:49 +01:00
Laxman Dewangan 8bdca009e6 regulator: tps62360: make init_data of platform data to pointer.
Convert platform data member regulator_init_data to pointer type.
This will avoid the copy of entire regualator init data into
platform data member when adding dt support and it can be achieve
by simple assignment:
pdata->init_data = of_get_regulator_init_data(dev, dev->of_node);

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-13 13:47:47 +01:00
Rhyland Klein 6790178f55 regulator: tps65910 regulator: add device tree support
Add devicetree based initialization support for TI tps65910 regulators.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-12 11:18:50 +01:00
Axel Lin 9447f35a1e regulator: da903x: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-12 11:12:41 +01:00
Axel Lin d4eb56a162 regulator: da903x: Fix list voltage for da9030 ldo14
da903x_list_voltage does not return correct voltage for da9030 ldo14.
Implement da9030_list_ldo14_voltage to return correct voltage for da9030 ldo14.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-12 11:12:41 +01:00
Mark Brown 5ceba7bab0 regulator: Staticise non-exported symbol s5m8767_opmode_reg
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-12 11:11:58 +01:00
Mark Brown c54a155d4d regulator: wm8400: Modernise driver
Update the driver to use all the regmap based helpers, saving a nice chunk
of code (especially for the DCDCs).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-12 11:11:48 +01:00
Mark Brown d31e954e07 regulator: wm831x: Convert to regulator_list_voltage_linear()
Only the alive LDOs can actually use this as all the other regulators have
two linear ranges.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-12 11:11:40 +01:00
Mark Brown bca7bbfff3 regulator: core: Allow drivers to set simple linear voltage maps as data
A lot of regulator hardware maps selectors on to voltages with a simple
linear mapping function

    selector = base + (selector * step size)

Provide off the shelf list_voltage() and map_voltage() operations which
use new min_uV and uV_step members in the regulator_desc to implement
this function.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-12 11:11:32 +01:00
Mark Brown e843fc4616 regulator: core: Allow regulators to provide a voltage to selector mapping
In order to allow more drivers to factor things out into data allow
drivers to provide a mapping function to convert voltages into selectors.
This allows any driver to use set_voltage_sel(). The existing mapping
based on iterating over list_voltage() is provided as an operation which
can be assigned to the new map_voltage() function though for ease of
transition it is treated as the default.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-12 11:11:23 +01:00
Mark Brown 5949a7e9ab Merge remote-tracking branch 'regulator/topic/drivers' into regulator-next
Conflicts:
	drivers/regulator/88pm8607.c (simple overlap with a bugfix in v3.4)
2012-05-12 11:10:25 +01:00
Mark Brown 178e43aef2 Merge remote-tracking branches 'regulator/topic/core', 'regulator/topic/regmap' and 'regulator/topic/register' into regulator-next 2012-05-12 11:09:47 +01:00
Mark Brown dcf701125e regulator: core: Warn on missing struct device
The core really wants a struct device to be supplied for regulators and
there's no reason this should be impossible so provide one so complain
if we didn't get one.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-10 10:48:37 +01:00
Mark Brown 0f82b6cf76 regulator: dummy: Specify a struct device
This will be becoming mandatory.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-10 10:48:28 +01:00
Mark Brown b7ca87884b regulator: wm831x: Register all normal regulators
Register all normal regulators rather than skipping unconfigured ones now
that the core can handle regulators without init data. Skip the boost and
isink regulators since they are normally controlled by other drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-10 00:51:10 +01:00
NeilBrown 411a2df509 regulator: twl-regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable.
The regulators in the twl4030 can provide some voltage settings
that are not offically supported.
These settings are disabled by default, but can be enabled with
  CONFIG_TWL4030_ALLOW_UNSUPPORTED=y
However
 - that config variable is not mentioned in any Kconfig so cannot
   be used, and
 - a global setting is clumsy - a per regulator setting would be
   better.

So define a new 'feature' flag that a board file can set to enable
these unsupported volatages for boards which need them.

This flag cannot (yet) be set using device-tree.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-09 10:04:33 +01:00
Axel Lin 1f904fd1cd regulator: tps65910: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-09 09:52:13 +01:00
Mark Brown 5d0526eade regulator: wm8994: Use main I2C device as struct device
This makes logging a bit clearer as it gives the actual bus location and
makes things like board hookup a bit smoother.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-08 18:41:07 +01:00
Laxman Dewangan 2935fb18aa regulator: tps62360: fix stylistic issue and optimize code
Fix multiple stylistic issue like:
- The print message should be not break into multiple line.
- line gap after variable declaration and statement.
- checkpatch error.
- some typo.

Some enhancement on error message printing to print error value
also along with proper text.

Avoid voltage_base conversion to microvolts every time.
Put init functions in init section.
Using efficient function inplace of calling multiple function
to reduce the code size.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-08 12:42:32 +01:00
Mark Brown 053fa1b752 regulator: wm831x-dcdc: Convert to gpio_request_one()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-07 18:23:50 +01:00
Mark Brown 09e3fd202d regulator: wm8994: Convert to gpio_request_one()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-07 18:23:44 +01:00
Laxman Dewangan a60cfce051 regulator: tps62360: Provide settling time for voltage change
Settling time is require when there is voltage output change.
Implement set_voltage_time_sel() callback which returns delay time
for voltage change to settle down to new value.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-07 15:21:53 +01:00
Laxman Dewangan 16ea003bd1 regulator: tps62360: enable register cache
Enable cache of device register using regmap cache RBTREE.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-07 15:21:53 +01:00
Mark Brown 968c2c1707 regulator: Actually free the regulator in devm_regulator_put()
It turns out that (quite surprisingly) devres_destroy() only undoes the
devres mapping, it doesn't destroy the underlying resource, meaning that
anything using devm_regulator_put() would leak. While we wait for the new
devres_release() which does what we want to get merged open code it in
devm_regulator_put().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-07 13:14:44 +01:00
Ying-Chun Liu (PaulLiu) 8e8a507c24 regulator: da9052: fix bug in device tree iteration loop
The driver of da9052 is buggy due to the iteration loop of device tree.
This patch fix the loop condition to make the driver work with device tree.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-07 12:51:36 +01:00
Laxman Dewangan 9a50dba509 regulator: fixed: add property for gpio open drain flag
Add property for the gpio flag open drain when registering
fixed regulator.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-07 12:31:05 +01:00
Axel Lin c006b21f7f regulator: 88pm8607: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-04 13:32:06 +01:00
Axel Lin 15b397d7e7 regulator: rc5t583: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-04 13:29:26 +01:00
Axel Lin 09812bc40c regulator: da9052: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-04 13:29:25 +01:00
Thierry Reding 62f6b08793 tps6586x: Add device tree support
This commit adds device tree support for the TPS6586x regulator.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-04 13:25:16 +01:00
Thierry Reding 1c8fa58f47 regulator: Add generic DT parsing for regulators
Looking up init data for regulators found on chips is a common operation
that can be handled in a generic way. The new helper function introduced
by this patch looks up the children of a given node by names specified
in a match table and fills that match table with information parsed from
the DT.

This is based on work by Rhyland Klein <rklein@nvidia.com>.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-04 13:25:15 +01:00
Mark Brown 82caa9780a regulator: wm831x-dcdc: Specify supply names
Allows hookup via normal consumer mechanisms.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 20:18:58 +01:00
Mark Brown f1aba13fbd regulator: wm831x-ldo: Set up supply names
Allows hookup via normal consumer mechanisms.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 20:18:56 +01:00
Axel Lin 9db7f05624 regulator: tps65912: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:27 +01:00
Axel Lin 0f80ea1499 regulator: max8998: Convert ot use devm_kzalloc
Also simplify the error handling to start unwind from the place
regulator_register fails.

No need to check rdev[i] is NULL or not before calling regulator_unregister.
regulator_unregister is safe if rdev is NULL,

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:27 +01:00
Axel Lin 8ae5767ba1 regulator: max8997: Convert ot use devm_kzalloc
Also simplify the error handling to start unwind from the place
regulator_register fails.

No need to check rdev[i] is NULL or not before calling regulator_unregister.
regulator_unregister is safe if rdev is NULL,

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:26 +01:00
Axel Lin 6c9eeb0f5c 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>
2012-04-23 13:20:26 +01:00
Axel Lin 23b7d09a3f regulator: max8997: Remove empty set_suspend_enable callback implementation
Since commit 8ac0e95 "regulator: core: Support setting suspend_[mode|voltage]
if set_suspend_[en|dis]able is NULL", now the regulator core can properly
handle the case set_suspend_enable callback is NULL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:25 +01:00
Axel Lin c245c087c5 regulator: max8997: Remove is_enabled callback implementation for max8997_charger_fixedstate_ops
If is_enabled callback is not implemented, the core assumes that the regulator
is on.

This is simpler than having a hack to retrun 1 in max8997_reg_is_enabled() if
max8997_get_enable_register() returns -EINVAL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:24 +01:00
Axel Lin 98667b4362 regulator: pcf50633: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:19:51 +01:00
Axel Lin 0d481f74ab regulator: da9052: Use generic regmap enable/disable operations
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:19:51 +01:00
Axel Lin ef26e0dbe8 regulator: 88pm8607: Use generic regmap enable/disable operations
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:19:50 +01:00
Axel Lin 11bb88ec22 regulator: pcf50633: Use generic regmap enable/disable operations
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:19:50 +01:00
Axel Lin a40a9c436b regulator: tps65910: Use generic regmap enable/disable operations
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:19:50 +01:00
Axel Lin 5bb6936c06 regulator: rc5t583: Use generic regmap enable/disable operations
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:19:50 +01:00
Axel Lin 94e85a3c5d regulator: s5m8767: Use DIV_ROUND_UP to calculate selector
Integer division may truncate the result.
Use DIV_ROUND_UP to ensure new voltage setting falls within specified range.

Also properly handle the case min_vol < desc->min to ensure we don't return
negative value for selector.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:18:10 +01:00
Axel Lin b9b49af5ef regulator: max8952: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-20 14:05:13 +01:00
Axel Lin 7c842a1d24 regulator: tps6507x: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-20 14:03:31 +01:00
Mark Brown 6492bc1b1a regulator: core: Optimise enable/disable path for always on regulators
If a regulator is always on for any reason then cache that when the
consumer is created and use it to optimise away the need to take locks
or recurse up the supply tree when consumers do enable or disable calls.
The scheduling of asynchronous work for bulk enables is also skipped.

We don't actually check if the device physically supports control on the
basis that constraints allowing status changes on physically always on
regulators are nonsensical anyway.

This is a very common pattern in hardware - it's normal to have some
power supplies that have either no software control or are critical to
system function - so many systems should be able to benefit.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-20 10:12:38 +01:00
Axel Lin 85960e7b3a regulator: virtual: Replace strict_strtol with kstrtol
strict_strtol is deprecated and results in a checkpatch warning.
Replace it with kstrtol.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-19 13:48:34 +01:00
Axel Lin a67f7e6b60 regulator: 88pm8607: Fix writting value to vol_reg in pm8607_set_voltage_sel
commit 4ca1e1d "regulator: Convert 88pm8607 to set_voltage_sel" accidentally
changed the value writing to vol_reg.
What we want is to write val instead of selector to vol_reg.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-19 13:45:19 +01:00
Axel Lin 06c4998be9 regulator: tps65090: Use generic regmap enable/disable operations
This patch converts tps65090 regulator driver to use generic regmap
enable/disable operations.

Also move struct tps65090 to include/linux/mfd/tps65090.h because
the regulator driver needs to access the rmap field of struct tps65090.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-18 17:42:04 +01:00
Axel Lin a81edbdeb6 regulator: virtual: Convert to use devm_* APIs
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-18 10:26:24 +01:00
Axel Lin 5abe0c4005 regulator: userspace-consumer: Convert to use devm_* APIs
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-18 10:26:24 +01:00
Axel Lin 62bc4d4a70 regulator: Convert max8997 to set_voltage_time_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-17 15:25:10 +01:00
Axel Lin 9e96b3a7ad regulator: Convert max8997 to get_voltage_sel
Also rename get_current_limit and set_current_limit callbacks
to max8997_get_current_limit and max8997_set_current_limit for
better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-17 15:25:10 +01:00
Axel Lin f55205f4d4 regulator: Fix the logic to ensure new voltage setting in valid range
I think this is a typo.
To ensure new voltage setting won't greater than desc->max,
the equation should be desc->min + desc->step * new_val <= desc->max.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2012-04-17 15:17:11 +01:00
Axel Lin 575f690dc4 regulator: max8660: Fix a memory leak due to missing devm_kzalloc conversion
commit 4d26f7 "regulator: max8660: Use devm_kzalloc()" missed to
replace kzalloc by devm_kzalloc. Fix it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-17 14:44:32 +01:00
Axel Lin 854ccbaee7 regulator: core: Add checking set_mode callback in regulator_set_optimum_mode
regulator_set_optimum_mode needs set_mode to properly work.
Add checking for set_mode callback in case it may be not implemented.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16 19:55:08 +01:00
Axel Lin ee7b19142d regulator: tps65023: Use generic regmap enable/disable operations
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16 19:53:37 +01:00
Mark Brown ca8c361b4a regulator: wm831x-ldo: Use generic regmap enable/disable operations
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:53:03 +01:00
Mark Brown 3d138fccc4 regulator: wm831x-dcdc: Use generic regmap enable/disable operations
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:52:51 +01:00
Mark Brown cd6dffb4c6 regulator: core: Provide standard enable operations for regmap users
Since the enable(), disable() and is_enabled() operations for most regmap
based regulators come down to reading and updating a single register bit
we can factor out the code and allow these drivers to just define which
bit to update using the enable_reg and enable_mask fields in their desc
and then use operations provided by the core.

As well as the code saving this opens the door to future optimisation of
the bulk operations - if the core can realise that we are updating a
single register for multiple regulators then it should be able to combine
these updates into a single physical operation.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:52:42 +01:00
Mark Brown 633b6fcd5a regulator: wm8994: Use core voltage selector operations
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:52:29 +01:00
Mark Brown ac663b472c regulator: wm831x-ldo: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:52:21 +01:00
Mark Brown 817436e72b regulator: wm831x-dcdc: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:52:13 +01:00
Mark Brown 4ab5b3d92c regulator: core: Provide regmap based voltage_sel operations
Since the voltage selector operations are intended to directly map a
bitfield in the device register map into regulator API operations the
code for implementing them is usually very standard we can save some
code by providing standard implementations for devices using the regmap
API.

Drivers using regmap can pass their regmap in in the regmap_config
struct, set vsel_reg and vsel_mask in their regulator_desc and then
use regulator_{get,set}_voltage_sel_regmap in their ops. This saves
a small amount of code from each driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:52:03 +01:00
Mark Brown 65b19ce6c2 regulator: core: Allow drivers to pass in a regmap
Since many regulators use regmap for register I/O and since there's quite
a few very common patterns in the code allow drivers to pass in a regmap
to the core for use in generic code.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:51:53 +01:00
Axel Lin 8ac0e95d64 regulator: core: Support setting suspend_[mode|voltage] if set_suspend_[en|dis]able is NULL
In current implementation, to support set_suspend_voltage and set_suspend_mode
the regulator code needs the regulator driver to implement both
set_suspend_enable and set_suspend_disable callbacks.

This patch removes this limitation. In the case set_suspend_enable and/or
set_suspend_disable are NULL, the regulator code assumes we don't need to
do any thing to enable/disable regulator when system is suspended and
then will continue to handle set_suspend_mode and set_suspend_voltage.

Currently the regulator core creates suspend state related sysfs entries only
if both set_suspend_enable and set_suspend_disable callbacks are not NULL.
A side-effect of this change is that the regulator core will create suspend
state related sysfs entries unconditionally now.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16 10:20:16 +01:00
Axel Lin 3f24f5ada6 regulator: core: Fix getting input_uV when supplied by another regulator
When supplied by another regulator, returns the supply regulator's output
voltage for inpu_uV.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16 10:19:30 +01:00
Mark Brown cd22a965c4 regulator: da9052: Directly include of.h
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16 09:54:24 +01:00
Mark Brown 9f29c9e30b regulator: wm8994: Convert to set_voltage_sel()
There's no need to implement set_voltage() as there is only a very small
range of selectors for the regulators in the WM8994 and the voltages are
not expected to vary frequently at runtime.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-15 12:07:50 +01:00
Ying-Chun Liu (PaulLiu) 88c84c14cc regulator: da9052: add device tree support
This patch adds device tree support for dialog regulators

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Ashish Jangam <ashish.jangam@kpitcummins.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 15:45:32 +01:00
Axel Lin 4d26f7d581 regulator: max8660: Use devm_kzalloc()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 09:59:39 +01:00
Axel Lin b7bd05b8d5 regulator: max1586: Use devm_kzalloc()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 09:59:39 +01:00
Axel Lin ef6bd5a3f1 regulator: isl6271a-regulator: Use devm_kzalloc()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 09:59:39 +01:00
Axel Lin 276909d359 regulator: Convert max8998 to set_voltage_time_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 09:54:45 +01:00
Axel Lin 7b4354b465 regulator: Convert max8998 to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 09:54:45 +01:00
Axel Lin b6f476c2c1 regulator: twl-regulator: Use twlreg_grp helper function
Since the twlreg_grp helper function is there, use it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 09:54:45 +01:00
Axel Lin 48c936d6da regulator: twl-regulator: Implement enable_time callback
Let regulator core do the necessary delay for us.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 09:54:45 +01:00
Mark Brown 32c8fad438 regulator: Appease smatch in regulator_register()
We don't support missing configs at all so segfaulting isn't that bad
but since we've got checks in the code move the dereference after them.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-11 10:19:12 +01:00
Axel Lin 9eb0c4218a regulator: Convert tps65xxx regulator drivers to use devm_kzalloc
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-11 10:16:50 +01:00