Commit Graph

827 Commits

Author SHA1 Message Date
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
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