Commit graph

1628 commits

Author SHA1 Message Date
Lee Jones
d319310395 regulator: ab8500: Use regulator_list_voltage_table() to look-up voltages
The regulator framework offers a generic regulator_list_voltage_table()
function which can directly look-up a regulator's voltage capabilities
using a table provided through the desc structure. This patch ensures
that information is available.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:27 +01:00
Lee Jones
5fc9da6d37 regulator: ab8500: Remove the need for a 'delay' property
The regulator framework now has provisions to read a regulator's
start-up time via the 'enable_time' attribute. So let's remove all
'enable_time'/'delay' duplication and just stick with 'enable_time'
from now on.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:27 +01:00
Lee Jones
a4d68468ca regulator: ab8500: Set enable enable_time in regulator_desc
Allow the regulator framework to directly access the time it takes
any given regulator to settle. This saves time and code because
without it we would have to implement a dedication function to read
the value from elsewhere.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:26 +01:00
Zhenhua HUANG
684d5ce4af regulator: ab8500: Introduce aux5, aux6 regulators for AB8540
Introduce aux5, aux6 into ab8540 regulator framework.

Signed-off-by: Zhenhua HUANG <zhenhua.huang@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Maxime COQUELIN <maxime.coquelin@stericsson.com>
Reviewed-by: David PARIS <david.paris@stericsson.com>
Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:26 +01:00
Lee Jones
33aeb49e24 regulator: ab8500: Use a struct to select the good regulator configuration
At the probe use a structure to select the good regulator array from
from ab9540, ab8505, ab8540 or ab8500 configuration.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:25 +01:00
Axel Lin
37daa8aed1 regulator: ab8500-ext: Don't update info->is_enabled if write to register fails
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:05:39 +01:00
Axel Lin
1ec990c002 regulator: dbx500-prcmu: Remove operating_point from struct dbx500_regulator_info
operating_point is not used since the initial commit of db8500-prcmu driver,
remove it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:05:28 +01:00
Lee Jones
4c84b4ddd4 regulator: ab8500: Update vdmic, vamic[1|2] parameters for AB8540
Add voltage setting for vdmic; add LP mode setting for vamic1,2.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:01:44 +01:00
Lee Jones
3fe5228910 regulator: ab8500: Add mode operation for v-amic
v-amic1 and v-amic2 regulators have dedicated mode registers
and share the same mode bit. This patch adds special handling
for those regulators.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:01:43 +01:00
Lee Jones
d7607baf32 regulator: ab8500: Add new operations for Vaux3
In former functions, only can set Vaux3 to 2.91V, because the
highest bit of Vaux3 register is put into another register. So
add new expanded functions for Vaux3's operation.

Signed-off-by: zhang xiaomei <xiaomei.zhang@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:01:43 +01:00
Lee Jones
bd44e2cb4a regulator: ab8500: Also check for AB8505 based platforms
Ensure we initialise AB8505 external supply regulators.

Signed-off-by: Alexandre Torgue <alexandre.torgue@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Tested-by: Xiao Mei ZHANG <xiaomei.zhang@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:01:43 +01:00
Lee Jones
8a3b1b8703 regulator: ab8500: Add voltage selection for AUDIO and ANA on AB8505
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:01:42 +01:00
Rabin Vincent
f7eae37fcc regulator: ab8500: Don't register external regulators on AB8505
ExtSupply regulators are not included on AB8505 based platforms.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Tested-by: Marcus COOPER <marcus.xm.cooper@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:01:42 +01:00
Lee Jones
0b94641126 regulator: ab8500: Supply platform specific regulator id values
The regulator ID in the regulator info array should be the same
values as the position of the element within the array.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:01:42 +01:00
Lee Jones
0fe17e20a6 regulator: ab8500-ext: Add support for AB9540 regulators
Add the support for ab9540 external regulators.

Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 23:01:41 +01:00
Lee Jones
62ab411111 regulator: ab8500: Use regulator_list_voltage_table()
Following a recent move to regulator_list_voltage_table() for
all previous abx500 related platforms this converts all recent
platform updates over too.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 13:23:39 +01:00
Lee Jones
b080c78a4e regulator: ab8500: Update voltage handling for fixed voltage regulators
There are a few over-lapping methods for voltage selection operating
in the AB8500 regulator driver currently. This patch removes unused,
unnecessary variables from the regulator_info structures and provides
voltage tables for those regulators which have fixed voltages.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 13:23:38 +01:00
Lee Jones
ae0a9a3efc regulator: ab8500: Add support for the ab8540
To obtain full AB8540 regulator support, the AB8500 regulator driver
first needs to know its register layout and their initialisation values
for each. That information is provided via a couple of large data
structures which we provide here.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 13:23:38 +01:00
Lee Jones
547f384f33 regulator: ab8500: add support for ab8505
To obtain full AB8505 regulator support, the AB8500 regulator driver
first needs to know its register layout and their initialisation values
for each. That information is provided via a couple of large data
structures which we provide here.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 13:23:38 +01:00
Bengt Jonsson
a6324709ab regulator: ab8500-ext: Add support for AB8505/AB9540
The external regulator driver checks for old AB8500 HW
to apply a fix. This patch adds a check to see that
it is a AB8500 (not AB8505/AB9540).

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 13:23:37 +01:00
Lee Jones
ed3c138eb3 regulator: ab8500: Correct TVOUT regulator enable time
Update TVOUT regulator to match specification.

Was 10ms - changed to 500us.

Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bengt JONSSON <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 13:23:37 +01:00
Lee Jones
8e6a8d7d23 regulator: ab8500: Add support for the ab9540
To obtain full AB9540 regulator support, the AB8500 regulator driver
first needs to know its register layout and their initialisation values
for each. That information is provided via a couple of large data
structures which we provide here.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 13:23:37 +01:00
Lee Jones
b54969ac40 regulator: ab8500: Prepare the driver for additional platforms
More platforms are to be supported by the AB8500 regulator driver,
so in this patch we prepare for their arrival. Instead of using
the AB8500 settings blindly, we provide an infrastructure where
adding a new platform is as easy as providing a couple of platform
specific data structures.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 13:23:36 +01:00
Axel Lin
d67c42cc17 regulator: max1586: Constify v6_voltages_uv table
Make v6_voltages_uv to be const unsigned int.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-30 13:53:21 +00:00
Axel Lin
742a73259d regulator: ab8500: Update info->update_val only when successfully update register
Don't update info->update_val if write to the register fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-29 17:52:55 +00:00
Lee Jones
da0b0c47dc regulator: ab8500: Init debug from regulator driver
The purpose of this patch is to guarantee that ab8500-debug will
record the regulator registers before they are modified by the
ab8500 regulator driver.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-29 17:50:35 +00:00
Lee Jones
41a06aa738 regulator: ab8500: Remove USB regulator
The USB regulator is controlled by hardware. The software support
was only needed for early hardware (ED) which is no longer supported.

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-29 17:50:07 +00:00
Bengt Jonsson
18bc2b3930 regulator: ab8500-ext: Add HW request support
Support for HW request is added in the external regulator
driver. A flag in the board configuration can be set to
let HW control the regulator when there is no SW request.
This means that the regulator will be put in high power
mode when there is a SW request and in HW-request mode
otherwise.

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Mattias NILSSON <mattias.i.nilsson@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-29 17:49:09 +00:00
Lee Jones
d1a820011b regulator: ab8500-ext: New driver to control external regulators
The ABx500 is capable of controlling three external regulator supplies.
Most commonly on and off are supported, but if an external regulator
chipset or power supply supports high-power and low-power mode settings,
we can control those too.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-29 17:49:07 +00:00
Laxman Dewangan
504382c99d regulator: palmas: add input supply names
Palmas regulator support the different input supply pins for each of
the rails. Fill the regulator info data with their input supply pin
names.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-28 00:26:04 +00:00
Lee Jones
cc40dc2981 regulator: ab8500: Amend the update value for AB8500_LDO_INTCORE regulator
The issues probably originated from a typo in the initial submission.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-28 00:20:15 +00:00
Lee Jones
43a5911b3d regulator: ab8500: Clean out SoC registers
Clean out initialisation that is handled by SoC. Regulator
settings for Vpll (partly), Vsmps1, Vsmps2, Vsmps3 (partly),
Vrf1, Varm, Vape, Vbb, Vmod are cleaned out. They should not
be touched by the kernel.

We also update many of the initialisation values to be more
in-line with the current development efforts of ST-Ericsson
internal engineers.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-28 00:11:02 +00:00
Axel Lin
292349287f regulator: ab8500: Remove set_voltage_time_sel and delay setting
The data sheet does not specify time delay for voltage selection,
thus remove set_voltage_time_sel and delay setting.

Note, currently set_voltage_time_sel callback returns 0 due to missing
delay settings.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-27 23:17:10 +00:00
Axel Lin
530158b6d2 regulator: ab8500: Add missing enable_time settings
Base on the data provide by Bengt Jönsson, add below enable_time settings:

Worst case enable time from data sheet:
Vana: enable time = 140 us
Vaux1/2: enable time = 200 us
Vaux3: enable time = 450 us
Vintcore: enable time = 750 us
Vamic1/2: enable time = 500 us
Vdmic: enable time = 420 us
VTVout: enable time = 500 us
Vaudio: enable time = 140 us
Vusb: enable time = 150 us

This discussion thread is available at: https://lkml.org/lkml/2013/3/26/795

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-27 23:17:05 +00:00
Axel Lin
f71bf52808 regulator: ab8500: Don't update is_enabled flag in error paths
This avoid setting is_enabled flag to wrong status if enable/disable fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26 14:04:22 +00:00
Mark Brown
ce1bcb7eab regulator: arizona: Increase ramp delay for high current regulators
As per latest evaluation.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26 13:27:11 +00:00
Axel Lin
5689e83074 regulator: ab8500: Use regulator_list_voltage_linear for fixed voltage
Both ab8500_regulator_mode_ops and ab8500_regulator_ops do not have volt_table
setting, thus we can not use regulator_list_voltage_table for them.
However, they have min_uV setting with n_voltages = 1, so use
regulator_list_voltage_linear instead.

Also remove setting set_voltage_time_sel for ab8500_regulator_mode_ops.
It is used only for fixed voltage, so it does not need to implement
set_voltage_time_sel.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-25 10:19:52 +00:00
Axel Lin
328a536966 regulator: ab8500: Fix build error
Fix below build error:

  CC      drivers/regulator/ab8500.o
drivers/regulator/ab8500.c:500:23: error: 'ab8500_regulator_fixed_ops' undeclared here (not in a function)
drivers/regulator/ab8500.c: In function 'ab8500_regulator_probe':
drivers/regulator/ab8500.c:972:8: warning: assignment from incompatible pointer type [enabled by default]
make[2]: *** [drivers/regulator/ab8500.o] Error 1
make[1]: *** [drivers/regulator] Error 2
make: *** [drivers] Error 2

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-25 10:19:43 +00:00
Guennadi Liakhovetski
416d67599e regulator: as3711: add OF support
AS3711 regulator OF support only evaluates standard regulator DT
properties.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Reviwed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-25 01:08:09 +00:00
Ian Lartey
574651f0f8 regulator: palmas remove palmas-charger option from DT bindings
Signed-off-by: Ian Lartey <ian@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-25 01:07:25 +00:00
Maxime Ripard
167d41dce7 regulator: Fix typo in of_get_regulator function comments
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-25 01:06:35 +00:00
Bengt Jonsson
732805a563 regulator: ab8500: Separate regulator and MFD platform data
The ab8500 MFD should not have knowledge about regulator-
specific platform data like number of regulators and
regulator registers. As the regulator platform data is
about to grow with external regulators, this information
is moved to a new structure provided by the regulator
driver.

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Yvan FILLION <yvan.fillion@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-22 12:03:17 +01:00
Lee Jones
33bc8f46a8 regulator: ab8500: Another push to synchronise recent AB8500 developments
This patch ensures that many of the recent developments pertaining to
the AB8500 regulator device are propagated out into the public arena.
It aims to update some of the existing initialisation values in
accordance with internal ST-Ericsson code submissions. This single
patch was originally a collection of updates which have been squashed
together to aid with clarity.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-22 12:03:17 +01:00
Lee Jones
3c1b8438d4 ARM: ux500: regulators: Add mask for configuration
There is already before a register mask in the regulator driver
to allow some bits of a register to be initialized. The register
value is defined in the board configuration. This patch puts a
mask in the board configuration to specify which bits should
actually be altered. The purpose with this patch is to avoid
future mistakes when updating the allowed bits in the regulator
driver.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-22 12:03:16 +01:00
Bengt Jonsson
7ce4669c8f regulator: ab8500: Added get_optimum_mode on regulators with idle mode
With this change, Vtvout, Vintcore12, Vaux1, 2 and 3 regulators
support DRMS (Dynamic Regulator Mode Switching) which will
dynamically handle requests for max current consumption from
several consumers and select a suitable regulator mode.

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-22 12:03:16 +01:00
Emeric Vigier
bd28a15733 regulator: ab8500: Add set_mode/get_mode support
Signed-off-by: Ludovic Barré <ludovic.barre@stericsson.com>
Signed-off-by: Emeric Vigier <emeric.vigier@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bengt JONSSON <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-22 12:03:16 +01:00
Lee Jones
d79df329d0 regulator: ab8500: Further populate initialisation registers
This patch supplies access to some extra settings provided by the
AB8500 regulator device. We also update some of the existing
initialisation values in accordance with internal ST-Ericsson code
submissions. This single patch was originally a collection of updates
which have been squashed together to aid with clarity.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-22 12:03:16 +01:00
Alexandru Gheorghiu
eb8ad60991 regulator: fan53555: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR.
Patch found using coccinelle.

Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-20 14:30:12 +01:00
Laxman Dewangan
bbcf50b1d6 regulator: palmas: rename probe/remove callback functions
When palmas regulator probe creates stack dump during initialization
due to some crash, it prints the call trace as follows:
[3.166321] [<c028fa20>] (_regmap_read+0x5c/0xa8) from [<c028fab0>] (regmap_read+0x44/0x5c)
[3.174669] [<c028fab0>] (regmap_read+0x44/0x5c) from [<c023062c>] (palmas_probe+0x240/0x7d0)
[3.183193] [<c023062c>] (palmas_probe+0x240/0x7d0) from [<c0284064>] (platform_drv_probe+0x14/0x18)
[3.192322] [<c0284064>] (platform_drv_probe+0x14/0x18) from [<c0282ee4>] (driver_probe_device+0x104/0x214)
[3.202055] [<c0282ee4>] (driver_probe_device+0x104/0x214) from [<c028167c>] (bus_for_each_drv+0x5c/0x88)

The palmas_probe is current name but it helps on debugging if the
function name is more appropriate to the sub-module name.

Renaming the palmas_probe() to palmas_regulator_probe() and
palmas_remove() to palams_regulator_remove().

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-20 13:38:09 +01:00
Axel Lin
71f2146f6c regulator: palmas: Use of_property_read_bool to read "ti,warm-reset" DT property
It does not make sense to assign return value of of_property_read_u32() to
pdata->reg_init[idx]->warm_reset. Use of_property_read_bool() to read
"ti,warm-reset" DT property instead which will return correct setting
for pdata->reg_init[idx]->warm_reset.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-12 18:16:17 +00:00
Graeme Gregory
7be859f74c regulator: palmas correct dt parsing
Fix the DT parsing to agree with the bindings document. Some small changes
to the value names and also fix the handling of boolean values. They were
previously using prop = 1/0, now just use of_property_read_bool calls.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-08 17:34:04 +08:00
Axel Lin
ea88b132ac regulator: max8649: Use enable_is_inverted flag with regulator_enable_regmap and friends APIs
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-05 17:56:40 +08:00
Axel Lin
318c658b7c regulator: 88pm8607: Use enable_is_inverted flag with regulator_enable_regmap and friends APIs
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-05 17:56:40 +08:00
Axel Lin
51dcdafcb7 regulator: core: Add enable_is_inverted flag to indicate set enable_mask bits to disable
Add enable_is_inverted flag to indicate set enable_mask bits to disable
when using regulator_enable_regmap and friends APIs.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-05 17:56:39 +08:00
Mark Brown
8870d4029a Merge remote-tracking branch 'regulator/fix/twl' into tmp 2013-03-05 10:12:43 +08:00
Mark Brown
b2d6094924 Merge remote-tracking branch 'regulator/fix/palmas' into tmp 2013-03-05 10:12:41 +08:00
Mark Brown
6d62768468 Merge remote-tracking branch 'regulator/fix/doc' into tmp 2013-03-05 10:12:39 +08:00
Mark Brown
521e2e03b8 Merge remote-tracking branch 'regulator/fix/db8500' into tmp 2013-03-05 10:12:37 +08:00
Axel Lin
6673d66e5a regulator: tps6586x: Use dev_err rather than dev_warn for error message
tps6586x_regulator_set_slew_rate() returns -EINVAL when having slew rate
settings for other than SM0/1, thus use dev_err rather than dev_warn.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:58:46 +08:00
Guennadi Liakhovetski
0a4cccaa31 regulator: tps6586x: (cosmetic) simplify a conditional
of_node_put() is called on either branch of a conditional, simplify the
code by only calling it once.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:58:45 +08:00
Julia Lawall
720a9717bc regulator: s5m8767: adjust duplicate test
Delete successive tests to the same location.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@s exists@
local idexpression y;
expression x,e;
@@

*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
 { ... when forall
   return ...; }
... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\)
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
 { ... when forall
   return ...; }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:56:37 +08:00
J Keerthy
3c870e3f9d regulator: palmas: Change the DT node property names to follow the convention
DT node properties should not have "_". Replacing them by "-".

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:54:42 +08:00
Thiago Farina
9df19a5597 regulators: max8998.c: use dev_err() instead of printk()
Fixes the following checkpatch warning:

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...

Signed-off-by: Thiago Farina <tfarina@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:53:01 +08:00
Axel Lin
ad4928f1dc regulator: max8925: Remove unused parameter from max8925_regulator_dt_init
The info parameter is not used at all, remove it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:49:21 +08:00
Kim, Milo
407945fd78 regulator: lp8788-ldo: use ena_pin of regulator-core for external control
Regulator core driver provides enable GPIO control for enabling/disabling a
 regulator. Now, enable GPIO is shared among regulators.
 Use this internal working, so unnecessary code are removed.
 GPIO enable pin configurations are added in digital LDO and analog LDO drivers.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:37:57 +08:00
Kim, Milo
7b74d14924 regulator: core: use regulator_ena_pin member
The regulator_dev has regulator_enable_gpio structure.
 'ena_gpio' and 'ena_gpio_invert' were moved to in regulator_enable_gpio.

  regulator_dev   --->   regulator_enable_gpio
  .ena_gpio              .gpio
  .ena_gpio_invert       .ena_gpio_invert

  Pointer, 'ena_pin' is used for checking valid enable GPIO pin.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:37:57 +08:00
Kim, Milo
967cfb18c0 regulator: core: manage enable GPIO list
To support shared enable GPIO pin, replace GPIO code with new static functions

 Reference count: 'enable_count'
   Balance the reference count of each GPIO and actual pin control.
   The count is incremented with enabling GPIO.
   On the other hand, it is decremented on disabling GPIO.
   Actual GPIO pin is enabled at the initial use.(enable_count = 0)
   The pin is disabled if it is not used(shared) any more. (enable_count <=1)
   Regardless of the enable count, update GPIO state of the regulator.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:37:57 +08:00
Kim, Milo
f19b00da8e regulator: core: support shared enable GPIO concept
A Regulator can be enabled by external GPIO pin.
 This is configurable in the regulator_config.
 At this moment, the GPIO can be owned by only one regulator device.
 In some devices, multiple regulators are enabled by shared one GPIO pin.
 This patch extends this limitation, enabling shared enable GPIO of regulators.

 New list for enable GPIO: 'regulator_ena_gpio_list'
   This manages enable GPIO list.

 New structure for supporting shared enable GPIO: 'regulator_enable_gpio'
   The enable count is used for balancing GPIO control count.
   This count is incremented when GPIO is enabled.
   On the other hand, it's decremented when GPIO is disabled.

 Reference count: 'request_count'
   The reference count, 'request_count' is incremented/decremented on
   requesting/freeing the GPIO. This count makes sure only free the GPIO
   when it has no users.

 How it works
   If the GPIO is already used, skip requesting new GPIO usage.
   The GPIO is new one, request GPIO function and add it to the list of
   enable GPIO.
   This list is used for balancing enable GPIO count and pin control.

 Updating a GPIO and invert code moved
   'ena_gpio' and 'ena_gpio_invert' of the regulator_config were moved to
    new function, regulator_ena_gpio_request().
    Use regulator_enable_pin structure rather than regulator_dev.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 10:37:56 +08:00
Andrzej Hajda
fbe31057fa regulator: fixed regulator_bulk_enable unwinding code
Unwinding code disables all successfully enabled regulators.
Error is logged for every failed regulator.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01 20:03:46 +08:00
Axel Lin
d1924519fe regulator: twl: Remove TWL6030_FIXED_RESOURCE
TWL6030_FIXED_RESOURCE is not used now, remove it.

TWL6030_FIXED_RESOURCE is not used since commit e76ab829cc
"regulator: twl: Remove references to the twl4030 regulator"

twl6030_fixed_resource is removed by commit 029dd3cef
"regulator: twl: Remove another unused variable warning".

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01 16:13:20 +08:00
Axel Lin
4813dd0efc regulator: twl: Remove VDD1_VSEL_table and VDD2_VSEL_table
Since commit ba305e31 "regulator: twl: fix twl4030 support for smps regulators",
VDD1_VSEL_table and VDD2_VSEL_table are not used any more. Remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01 16:05:13 +08:00
Axel Lin
6949fbe5b2 regulator: twl: Convert twl4030ldo_ops to get_voltage_sel
This fixes an inconsistent behavior between list_voltage() and get_voltage()
because current implementation of get_voltage() does not check the case
IS_UNSUP() is true.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01 16:03:49 +08:00
Axel Lin
b3816d5043 regulator: twl: Convert twl[6030|4030]fixed_ops to regulator_list_voltage_linear
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01 16:00:00 +08:00
Graeme Gregory
a7dddf2757 regulator: palmas: fix number of SMPS voltages
Number of voltages for SMPS regulators was off by one.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Ian Lartey <ian@slimlogic.co.uk>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01 15:42:04 +08:00
Nishanth Menon
9345dfb849 regulator: core: fix documentation error in regulator_allow_bypass
commit f59c8f9f (regulator: core: Support bypass mode)
has a short documentation error around the regulator_allow_bypass
parameter 'enable' which is documented as 'allow'.

This generates kernel-doc warning as follows:
./scripts/kernel-doc drivers/regulator/core.c >/dev/null
Warning(drivers/regulator/core.c:2841): No description found for parameter 'enable'
Warning(drivers/regulator/core.c:2841): Excess function parameter 'allow' description in 'regulator_allow_bypass'

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01 06:07:23 +00:00
Dmitry Torokhov
4ceb73ae5a regulator: db8500-prcmu - remove incorrect __exit markup
Even if bus is not hot-pluggable, the devices can be unbound from the
driver via sysfs, so we should not be using __exit annotations on
remove() methods. The only exception is drivers registered with
platform_driver_probe() which specifically disables sysfs bind/unbind
attributes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01 06:04:44 +00:00
Mark Brown
2730fd82cb Merge remote-tracking branch 'regulator/topic/tps65090' into regulator-next 2013-02-19 12:43:12 +00:00
Mark Brown
da3522f85b Merge remote-tracking branch 'regulator/topic/tps6507x' into regulator-next 2013-02-19 12:43:10 +00:00
Mark Brown
b67a2ecb54 Merge remote-tracking branch 'regulator/topic/tps51632' into regulator-next 2013-02-19 12:43:09 +00:00
Mark Brown
178a097d5e Merge remote-tracking branch 'regulator/topic/s5m8767' into regulator-next 2013-02-19 12:43:08 +00:00
Mark Brown
728088871c Merge remote-tracking branch 'regulator/topic/palmas' into regulator-next 2013-02-19 12:43:07 +00:00
Mark Brown
cf1466fbf8 Merge remote-tracking branch 'regulator/topic/of' into regulator-next 2013-02-19 12:42:52 +00:00
Mark Brown
c99f21c276 Merge remote-tracking branch 'regulator/topic/mc13892' into regulator-next 2013-02-19 12:42:50 +00:00
Mark Brown
e11c4515e3 Merge remote-tracking branch 'regulator/topic/max8998' into regulator-next 2013-02-19 12:42:49 +00:00
Mark Brown
6a244cadb0 Merge remote-tracking branch 'regulator/topic/max8997' into regulator-next 2013-02-19 12:42:49 +00:00
Mark Brown
1fe230175e Merge remote-tracking branch 'regulator/topic/max77686' into regulator-next 2013-02-19 12:42:48 +00:00
Mark Brown
c7b094828b Merge remote-tracking branch 'regulator/topic/lp8788' into regulator-next 2013-02-19 12:42:47 +00:00
Mark Brown
800d290182 Merge remote-tracking branch 'regulator/topic/lp8755' into regulator-next 2013-02-19 12:42:46 +00:00
Mark Brown
efc828022e Merge remote-tracking branch 'regulator/topic/lp872x' into regulator-next 2013-02-19 12:42:39 +00:00
Mark Brown
5ce63c7e7d Merge remote-tracking branch 'regulator/topic/lp3972' into regulator-next 2013-02-19 12:42:35 +00:00
Mark Brown
5ec2a5e8e5 Merge remote-tracking branch 'regulator/topic/lp3971' into regulator-next 2013-02-19 12:42:35 +00:00
Mark Brown
a4dba88e63 Merge remote-tracking branch 'regulator/topic/gpio' into regulator-next 2013-02-19 12:42:34 +00:00
Mark Brown
eb230d4a61 Merge remote-tracking branch 'regulator/topic/da9055' into regulator-next 2013-02-19 12:42:33 +00:00
Mark Brown
52582adcb9 Merge remote-tracking branch 'regulator/topic/core' into regulator-next 2013-02-19 12:42:32 +00:00
Mark Brown
20ab4a7a79 Merge remote-tracking branch 'regulator/topic/as3711' into regulator-next 2013-02-19 12:42:31 +00:00
Mark Brown
45aae62ddd Merge remote-tracking branch 'regulator/topic/arizona' into regulator-next 2013-02-19 12:42:30 +00:00
Mark Brown
fc221525bd Merge remote-tracking branch 'regulator/topic/apply' into regulator-next 2013-02-19 12:42:29 +00:00
Mark Brown
0dbf165ec4 Merge remote-tracking branch 'regulator/topic/anatop' into regulator-next 2013-02-19 12:42:28 +00:00
Russ Dill
9c7b4e8a8a regulator: Fix memory garbage dev_err printout.
commit dd8004af: 'regulator: core: Log when a device causes a voltage
constraint fail', tried to print out some information about the
check consumer min/max uV fixup, however, it uses a garbage pointer
left over from list_for_each_entry leading to boot messages in the
form:

'[    2.079890] <RANDOM ASCII>: Restricting voltage, 3735899821-4294967295uV'

Because it references regulator->dev, it could potentially read memory from
anywhere causing a panic.

This patch instead uses rdev and the updated min/max uV values.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-14 16:18:39 +00:00
Mark Brown
f2e5d078f7 Linux 3.8-rc7
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.13 (GNU/Linux)
 
 iQEcBAABAgAGBQJRFWw4AAoJEHm+PkMAQRiGnTAH/jBHA2umNc3lc7VkUpusve4q
 GGIlNzYh6iuvIGwKQVj9YPsl37qtQnkDUmY8f8WxZjfxiIDw3TkRKDgNLJaM3Jy5
 E426/FGlRx/Iia5+4tuBeoVYMoIPnndgW5lEAMRK1SvhTByhIYAXsaM0UwPBetb+
 Z5NMdH1f1HVF7RCCmHAkzEk9z78UpdeCzI0t0XuasP2hp2ARAcE1okdO7fNaLiyo
 EmenGhRvy9bAsbRwV0rCdl0rQiZXEYM353DWS7n6q4fyVm8MXFwloUxnWCJTzOIL
 ZLJaz18adFj7Ip/X6ksnMQiQU2Q3B7aThs5ycv0QGxxL2rDFveYRRQ5ICrXOy3M=
 =jjBc
 -----END PGP SIGNATURE-----

Merge tag 'v3.8-rc7' into regulator-core

Linux 3.8-rc7
2013-02-14 16:13:19 +00:00
Thiago Farina
40e72149a2 regulator: max77686: Reuse rdev_get_id() function.
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-14 12:11:04 +00:00
Axel Lin
d94d9aca5b regulator: tps51632: Use regulator_[get|set]_voltage_sel_regmap
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-13 12:58:40 +00:00
Axel Lin
09ca50d2ad regulator: as3711: Fix checking if no platform initialization data
To skip registering regulator if no platform initialization data,
we should check reg_data rather than ri->desc.name.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-13 12:56:51 +00:00
Axel Lin
e81d7bc89c regulator: s5m8767: Prevent possible NULL pointer dereference
s5m8767_pmic_dt_parse_pdata dereferenes pdata, thus check pdata earlier to
avoid NULL pointer dereference.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-13 12:52:19 +00:00
Axel Lin
cbb0ed495c regulator: s5m8767: Fix dev argument for devm_kzalloc and of_get_regulator_init_data
Use &pdev->dev rather than iodev->dev for devm_kzalloc() and
of_get_regulator_init_data(), this fixes memory leak.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-13 12:52:18 +00:00
Axel Lin
c66a566afb regulator: core: Optimize _regulator_do_set_voltage if voltage does not change
Optimize _regulator_do_set_voltage() for the case selector is equal to
old_selector. Since the voltage does not change, we don't need to call
set_voltage_sel() and set_voltage_time_sel() in this case.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08 11:26:03 +00:00
Axel Lin
c6163a7023 regulator: max8998: Let regulator core handle the case selector == old_selector
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08 11:23:43 +00:00
Axel Lin
1f91b6f6c7 regulator: s5m8767: Use of_get_child_count()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08 11:16:40 +00:00
Shawn Guo
ff1ce0571e regulator: anatop: improve precision of delay time
For cpufreq example, it takes 13 steps (25 mV for one step) to increase
vddcore from 0.95 V to 1.275 V, and the time of 64 clock cycles at
24 MHz for one step is ~2.67 uS, so the total delay time would be
~34.71 uS.  But the current calculation in the driver gives 39 uS.
Change the formula to have the addition of 1 be the last step, so that
we can get a more precise delay time.  For example above, the new
formula will give 35 uS.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08 11:15:00 +00:00
Mark Brown
53e5da79fa Merge remote-tracking branch 'regulator/fix/tps65910' into tmp 2013-02-06 11:28:53 +00:00
Mark Brown
e04702c8b2 Merge remote-tracking branch 'regulator/fix/tps65217' into tmp 2013-02-06 11:28:52 +00:00
Mark Brown
918d623b04 Merge remote-tracking branch 'regulator/fix/s2mps11' into tmp 2013-02-06 11:28:51 +00:00
Mark Brown
44784cb32b Merge remote-tracking branch 'regulator/fix/of' into tmp 2013-02-06 11:28:51 +00:00
Mark Brown
98380536ee Merge remote-tracking branch 'regulator/fix/max8998' into tmp 2013-02-06 11:28:50 +00:00
Mark Brown
3886f91b96 Merge remote-tracking branch 'regulator/fix/max8997' into tmp 2013-02-06 11:28:49 +00:00
Mark Brown
c48c43aa2d Merge remote-tracking branch 'regulator/fix/max8907' into tmp 2013-02-06 11:28:48 +00:00
Mark Brown
ac58291c75 Merge remote-tracking branch 'regulator/fix/max77686' into tmp 2013-02-06 11:28:48 +00:00
Michał Mirosław
896b65f345 regulator: show state for GPIO-controlled regulators
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-04 18:38:06 +00:00
Amit Daniel Kachhap
26aec009f6 regulator: add device tree support for s5m8767
This device tree support is added for PMIC block of S5m8767 multi
function driver. The usage detail is added in the device tree
documentation section. This change is tested on exynos5250 based
arndale platform by regulator voltage set/get API's.

Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Tested-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-04 10:31:31 +00:00
Axel Lin
f33d0081ff regulator: palmas: Remove a redundant setting for warm_reset
Current code read "ti,warm_reset" of property twice, and set
pdata->reg_init[idx]->warm_reset twice. Read and set it once is enough.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-04 10:24:35 +00:00
Alim Akhtar
c76edd52bf regulator: s2mps11: fix incorrect register for buck10
For BUCK10 the control registers are wrongly set as buck9 control register
This patch corrects the control registers for buck10

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-01-31 14:45:11 +08:00
Axel Lin
86f6673325 regulator: mc13xxx: Use of_get_child_count()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-31 14:43:32 +08:00
Axel Lin
ee70b25849 regulator: max8997: Use of_get_child_count()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-31 14:43:29 +08:00
Axel Lin
09a228e70b regulator: tps65090: Fix using wrong dev argument for calling of_regulator_match
The dev parameter is the device requesting the data.
In this case it should be &pdev->dev rather than pdev->dev.parent.

The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
which means this fixes a memory leak because the memory is allocated every time
probe() is called, thus it should be freed when this driver is unloaded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-31 14:42:05 +08:00
Anson Huang
9ee417c074 regulators: anatop: add set_voltage_time_sel interface
some of anatop's regulators(cpu, vddpu and vddsoc) have
register settings about LDO's step time, which will impact
the LDO ramp up speed, need to use set_voltage_time_sel
interface to add necessary delay everytime LDOs' voltage
is increased.

offset 0x170:
bit [24-25]: cpu
bit [26-27]: vddpu
bit [28-29]: vddsoc

field definition:
0'b00: 64 cycles of 24M clock;
0'b01: 128 cycles of 24M clock;
0'b02: 256 cycles of 24M clock;
0'b03: 512 cycles of 24M clock;

Signed-off-by: Anson Huang <b20788@freescale.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-31 14:40:49 +08:00
Axel Lin
c92f5dd2c4 regulator: Add missing of_node_put()
of_find_node_by_name() returns a node pointer with refcount incremented, use
of_node_put() on it when done.

of_find_node_by_name() will call of_node_put() against from parameter,
thus we also need to call of_node_get(from) before calling
of_find_node_by_name().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-30 18:50:27 +08:00
Mark Brown
9c9588a732 Merge remote-tracking branches 'regulator/fix/max8907', 'regulator/fix/max8997', 'regulator/fix/tps65910' and 'regulator/topic/mc13892' into regulator-of 2013-01-30 18:50:14 +08:00
Axel Lin
0ce7d00d0d regulator: tps6507x: Fix using wrong dev argument for calling of_regulator_match
The dev parameter is the device requesting the data.
In this case it should be &pdev->dev rather than pdev->dev.parent.

The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
which means this fixes a memory leak because the memory is allocated every time
probe() is called, thus it should be freed when this driver is unloaded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-30 18:44:41 +08:00
Stephen Warren
a2f95c3637 regulator: clear state each invocation of of_regulator_match
of_regulator_match() saves some dynamcially allocated state into the
match table that's passed to it. By implementation and not contract, for
each match table entry, if non-NULL state is already present,
of_regulator_match() will not overwrite it. of_regulator_match() is
typically called each time a regulator is probe()d. This means it is
called with the same match table over and over again if a regulator
triggers deferred probe. This results in stale, kfree()d data being left
in the match table from probe to probe, which causes a variety of crashes
or use of invalid data.

Explicitly free all output state from of_regulator_match() before
generating new results in order to avoid this.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-01-30 10:11:06 +08:00
Laxman Dewangan
6c7a7a0e36 regulator: tps65090: add DT support
Add DT support for TI PMIC tps65090 regulator driver. The DT of this
device have node regulator and all regulator's node of this device is
added under this node.

The device tree binding document has the required information for
adding this device on DTS file.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-29 19:09:34 +08:00
Mark Brown
1433d0905f Merge remote-tracking branch 'regulator/fix/tps80031' into tmp 2013-01-29 11:14:35 +08:00
Axel Lin
a451405fcd 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>
2013-01-29 00:44:17 +08:00
Axel Lin
655efa0ff2 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>
2013-01-29 00:44:17 +08:00
Matt Sealey
2c8a5dcaa4 regulator: mc13892: sanity check num_regulators parsed vs. registered
Imagine a situation where a device tree has a few regulators in an
appropriate node:

regulators {
	sw1 {
		..
	};

	vvideo {
		..
	};

	:

	vfake {
		..
	};

	vtypo {
		..
	};
};

In the above example, the node name "vfake" is an attempt to match a
regulator name inside the driver which just so happens to not exist. The
node name "vtypo" represents an accidental typographical error in a
regulator name which may have been introduced to a device tree.

In these cases, the number of regulators the mc13892 driver thinks it has
does not match the number of regulators it parsed and registered. Since
it will go over this array based on this number, it will actually
re-register regulator "0" (which happens to be SW1) over and over
again until it reaches the number, resulting in messages on the kernel
log such as these:

SW1: at 1100 mV
VVIDEO: at 2775mV
:
SW1: at 1100 mV
SW1: at 1100 mV

.. up to that number of "mismatched" regulators. Nobody using DT can/will
consume these regulators, so it should not be possible for it to cause any
real regulator problems or driver breakages, but it is an easy thing to
miss in a kernel log and is an immediate indication of a problem with the
device tree authoring.

This patch effectively sanity checks the number of counted children of
the regulators node vs. the number that actually matched driver names,
and sets the appropriate num_regulators value. It also gives a little
warning for device tree authors that they MAY have screwed something up,
such that this patch does not hide the device tree authoring problem.

Signed-off-by: Matt Sealey <matt@genesi-usa.com>
Tested-by: Steev Klimaszewski <steev@genesi-usa.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-27 11:22:30 +08:00
Matt Sealey
ccf3ed782a regulator: mc13892-regulator: correct/refine handling of the SWxHI bit
MC13892 PMIC supports a "HI" bit for 3 of it's 4 buck switcher outputs,
which enables a higher set of voltage ranges.

Despite a comment in the code ('sw regulators need special care due to the
"hi" bit'), it actually does not take special care since it does not modify
it's use of the selector table index when this bit is set, giving us very
odd behavior when setting a high voltage on supported switchers or listing
current voltages. Net effect is in best case the kernel and sysfs report
lower voltages than are actually set in hardware (1300mV instead of 1800mV
for example) and in the worst case setting a voltage (e.g. 1800mV) will cause
an undervoltage condition (e.g. 1300mV).

Correct the behavior, taking into account SW1 doesn't support the HI bit,
and as such we need to ignore it.

While we are modifying these functions, fix and optimize the following;

* set_voltage_sel callback was using .reg instead of .vsel_reg - since
  they were set to the same value it actually didn't break anything but
  it would be semantically incorrect to use .reg in this case. We now use
  .vsel_reg and be consistent.
* vsel_shift is always 0 for every SWx regulator, and constantly shifting
  and masking off the bottom few bits is time consuming and makes the
  code very hard to read - optimize this out.
* get_voltage_sel uses the variable "val" and set_voltage_sel uses the
  variable "selector" (and reg_value). Introduce the variable "selector"
  to get_voltage_sel such that it makes more sense and allow some leaner
  code in light of the modifications in this patch. Add better exposure
  to the debug print so the register value AND the selector are printed as
  this will adequately show the HI bit in the register.
* correct a comment in probe which is doing a version check. Magic
  values are awful but for once instance, a comment does just as
  good a job as something symbolic.

Signed-off-by: Matt Sealey <matt@genesi-usa.com>
Tested-by: Steev Klimaszewski <steev@genesi-usa.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-27 11:22:21 +08:00
Vishwanathrao Badarkhe, Manish
6116ad94e1 regulator: tps6507x: add device tree support.
Add device tree based initialization support for
TI's tps6507x regulators.
Add device tree binding document for TI's tps6507x
using datasheet:
http://www.ti.com/lit/ds/symlink/tps65070.pdf

Signed-off-by: Vishwanathrao Badarkhe, Manish <manishv.b@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-27 11:19:01 +08:00
Axel Lin
1200c60bc5 regulator: lp8755: Use LP8755_BUCK_MAX instead of magic number
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-27 11:00:25 +08:00
Axel Lin
b4895e2ca5 regulator: max8997: Fix using wrong dev argument at various places
Use &pdev->dev rather than iodev->dev for dev_err(), dev_warn() and dev_info().
Use &pdev->dev rather than iodev->dev for devm_kzalloc() and
of_get_regulator_init_data(), this fixes memory leak.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-27 10:56:13 +08:00
Axel Lin
b19f575898 regulator: max77686: Fix using wrong dev argument at various places
Use &pdev->dev rather than iodev->dev for dev_err().
Use &pdev->dev rather than iodev->dev for devm_kzalloc() and
of_regulator_match(), this fixes memory leak.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-27 10:54:18 +08:00
Axel Lin
f40cbcb933 regulator: max8907: Fix using wrong dev argument for calling of_regulator_match
The dev parameter is the device requesting the data.
In this case it should be &pdev->dev rather than pdev->dev.parent.

The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
which means this fixes a memory leak because the memory is allocated every time
probe() is called, thus it should be freed when this driver is unloaded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-27 10:53:03 +08:00
Marek Szyprowski
36a6f8c035 regulator: max8998: fix incorrect min_uV value for ldo10
Correct value for minimal voltage for ldo10 output is 950000 uV. This
patch fixes the typo introduced by patch adf6178ad5
("regulator: max8998: Use uV in voltage_map_desc"), what solves broken
probe of max8998 in v3.8-rc4.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-26 16:57:39 +08:00
Axel Lin
d4cbca9ef8 regulator: tps80031: Use IS_ERR to check return value of regulator_register()
regulator_register() does not return NULL, it returns ERR_PTR on error.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-26 15:40:36 +08:00
Steven Rostedt
7f46d0f81f regulators: db8500: Fix compile failure for drivers/regulator/dbx500-prcmu.c
Building for the snowball board, I ran into this compile failure:

  CC      drivers/regulator/dbx500-prcmu.o
arm-test.git/drivers/regulator/dbx500-prcmu.c:119:11: error: 'THIS_MODULE' undeclared here (not in a function)
make[3]: *** [drivers/regulator/dbx500-prcmu.o] Error 1
make[2]: *** [drivers/regulator] Error 2

Commit 38e968380 "regulators/db8500: split off shared dbx500 code"
separated out the dbx500 code but did not copy over the required include
to linux/module.h.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-26 15:30:06 +08:00
Axel Lin
08337fdac2 regulator: tps65910: Fix using wrong dev argument for calling of_regulator_match
The dev parameter is the device requesting the data.
In this case it should be &pdev->dev rather than pdev->dev.parent.

The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
which means this fixes a memory leak because the memory is allocated every time
probe() is called, thus it should be freed when this driver is unloaded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan<ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-24 18:59:53 +08:00
Axel Lin
5bce833c44 regulator: tps65217: Fix using wrong dev argument for calling of_regulator_match
The dev parameter is the device requestiong the data.
In this case it should be &pdev->dev rather than pdev->dev.parent.

The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
which means this fixes a memory leak because the memory is allocated every time
probe() is called, thus it should be freed when this driver is unloaded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-24 18:58:33 +08:00
Axel Lin
31a932e107 regulator: s5m8767: Convert to regulator_[get|set]_voltage_sel_regmap
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-18 15:26:19 +09:00
Axel Lin
510799eaba regulator: lp8755: Remove enum bucks
We already have enum lp8755_bucks in lp8755.h, so it looks pointless adding
enum bucks in lp8755.c.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Daniel Jeong <gshark.jeong@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-17 16:13:59 +09:00
Axel Lin
240a529108 regulator: lp8755: Don't show unrelated messags in lp8755_probe error paths
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-17 16:13:19 +09:00
Axel Lin
854f73ecb5 regulator: s5m8767: Remove max_vol parameter from s5m8767_convert_voltage_to_sel
It looks pointless to pass max_vol to s5m8767_convert_voltage_to_sel().
Compare selected voltage to desc->max is enough to ensure selected voltage
is in supported range.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-17 16:12:22 +09:00
Axel Lin
e69995d3bf regulator: lp8788-buck: Remove buck[1|2]_vout_addr array
The vout address for buck[1|2] can be easily calculated,
thus remote these arrays.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-17 16:08:08 +09:00
Mark Brown
e3d5b2f570 Merge remote-tracking branch 'regulator/fix/s5m8767' into tmp 2013-01-15 09:38:59 +09:00
Mark Brown
3ab91da2f1 Merge remote-tracking branch 'regulator/fix/max8998' into tmp 2013-01-15 09:38:56 +09:00
Mark Brown
c63184673e Merge remote-tracking branch 'regulator/fix/max8997' into tmp 2013-01-15 09:38:51 +09:00
Mark Brown
a1ed63f4db Merge remote-tracking branch 'regulator/fix/core' into tmp 2013-01-15 09:38:27 +09:00
Mark Brown
9fc50a2ead regulator: arizona-micsupp: Enable bypass in default constraints
This will be used as part of low power accessory detect.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-13 21:31:02 +09:00
Mark Brown
e6ed90581b regulator: arizona-micsupp: Enable SYSCLK for charge pump
If we are in non-bypass mode then the SYSCLK is required for full charge
pump operation, otherwise we will fall back to bypass mode. Use the DAPM
context exposed by the ASoC driver to manage this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-13 21:31:02 +09:00
Axel Lin
eb758de6a0 regulator: lp8788-buck: Silence build warning
This driver use id as array index, thus add bounder checking for id.

This patch fixes below build warning:
drivers/regulator/lp8788-buck.c: In function 'lp8788_buck_probe':
drivers/regulator/lp8788-buck.c:490:8: warning: array subscript is above array bounds [-Warray-bounds]
drivers/regulator/lp8788-buck.c:489:63: warning: array subscript is above array bounds [-Warray-bounds]

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-10 12:56:57 +00:00
Axel Lin
81d0a6ae7b regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel
Use DIV_ROUND_UP to prevent truncation by integer division issue.
This ensures we return enough delay time.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-01-10 12:55:49 +00:00
Axel Lin
adf6178ad5 regulator: max8998: Use uV in voltage_map_desc
Integer division may truncate.
This happens when pdata->buckx_voltagex setting is not align with 1000 uV.
Thus use uV in voltage_map_desc, this ensures the selected voltage won't less
than pdata buckx_voltagex settings.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-01-08 11:16:11 +00:00
Axel Lin
bc3b7756b5 regulator: max8997: Use uV in voltage_map_desc
Current code does integer division (min_vol = min_uV / 1000) before pass
min_vol to max8997_get_voltage_proper_val().
So it is possible min_vol is truncated to a smaller value.

For example, if the request min_uV is 800900 for ldo.
min_vol = 800900 / 1000 = 800 (mV)
Then max8997_get_voltage_proper_val returns 800 mV for this case which is lower
than the requested voltage.

Use uV rather than mV in voltage_map_desc to prevent truncation by integer
division.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-01-08 11:14:35 +00:00
Axel Lin
c8c14a393b regulator: lp3972: Convert to get_voltage_sel
regulator_list_voltage_table() returns -EINVAL if selector >= n_voltages.
Thus we don't need to check if reg is greater than LP3972_BUCK_VOL_MAX_IDX in
lp3972_[ldo|dcdc]_get_voltage_sel.

LP3972_BUCK_VOL_MIN_IDX and LP3972_BUCK_VOL_MAX_IDX are not used, remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-08 11:07:05 +00:00
Axel Lin
cad877ef0a regulator: lp8755: Fix mask for pchip->mphase
According to the datasheet, it has 9 multi-phase mode from 0 to 8 and it takes
4 bits in the register.
The mask for pchip->mphase should be 0x0F.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-08 11:05:26 +00:00
Axel Lin
a1a41ab4e9 regulator: lp8755: Fix lp8755_regulator_init unwind code
It's safe to pass NULL argument to regulator_unregister(), so we can remove
the NULL checking before calling regulator_unregister().
However pass a ERR_PTR to regulator_unregister() is wrong, so we need to
explicitly set "pchip->rdev[buck_num] = NULL" before goto err_buck.

This patch also includes below cleanups:
Show correct regulator id in dev_err.
Remove __devexit_p.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-08 11:05:26 +00:00
Axel Lin
5551a6a0eb regulator: da9055: Remove unused v_shift field from struct da9055_volt_reg
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-07 11:14:53 +00:00
Axel Lin
b9bb09111a regulator: lp8788-ldo: Use ldo->en_pin to check if regulator is enabled by external pin
ldo->en_pin is set iff the regulator is enabled by external pin.

This patch sets ldo->en_pin to NULL if lp8788_gpio_request_ldo_en() fails, then
we can use it to determinate if the regulator is controlled by external pin or
register.

lp8788_get_ldo_enable_mode(), lp8788_ldo_ctrl_by_extern_pin() and
lp8788_ldo_is_enabled_by_extern_pin() functions are not used now, remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Tested-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-07 11:13:08 +00:00
Greg Kroah-Hartman
3d68dfe324 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>
2013-01-03 15:57:04 -08:00
Axel Lin
0384618a79 regulator: core: Fix comment for regulator_register()
regulator_register() does not return 0 on success, fix the comment.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-03 13:02:39 +00:00
Kim, Milo
f02a3917b3 lp8788-ldo: fix a parent device on devm_gpio_request()
Use 'platform_device' rather than i2c client device node.
 Argument is added in lp8788_config_ldo_enable_mode().

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-03 11:28:53 +00:00
Kim, Milo
939e88f090 lp8788-ldo: fix a parent device in _probe()
The lp8788-ldo is a platform driver of lp8788-mfd.
 The platform device is allocated when mfd_add_devices() is called
 in lp8788-mfd.
 On the other hand, 'lp->dev' is the i2c client device.

 Therefore, this 'platform_device' is a proper parent device in case of
 resource managed mem alloc, registering regulators and device kernel messages.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-03 11:28:53 +00:00
Kim, Milo
1ef01e74e7 lp8788-buck: fix a for-loop coding style
Remove space before semicolon in for-loop.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-03 11:28:53 +00:00
Kim, Milo
38d8f67cb6 lp8788-buck: fix a parent device on devm_gpio_request()
Use 'platform_device' rather than i2c client device node.
 Arguments are added in lp8788_init_dvs() and lp8788_dvs_gpio_request().

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-03 11:28:52 +00:00
Kim, Milo
3b0e8f1281 lp8788-buck: fix a parent deivce in _probe()
The lp8788-buck is a platform driver of lp8788-mfd.
 The platform device is allocated when mfd_add_devices() is called
 in lp8788-mfd.
 On the other hand, 'lp->dev' is the i2c client device.

 Therefore, this 'platform_device' is a proper parent device in case of
 resource managed mem alloc, registering a regulator and device kernel message.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-03 11:28:52 +00:00
Axel Lin
b79ca051bd regulator: max8997: Convert max8997_safeout_ops to set_voltage_sel and list_voltage_table
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 17:34:49 +00:00
Axel Lin
24bd410905 regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops
max8997_set_voltage_ldobuck_time_sel() returns 0 for all LDOs.
Thus remove set_voltage_time_sel setting for max8997_ldo_ops.

max8997_set_voltage_ldobuck_time_sel() is only used for max8997_buck_ops now,
rename it to max8997_set_voltage_buck_time_sel().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 17:34:49 +00:00
Laxman Dewangan
c51ce403d3 regulator: tps51632: add DT support
Add DT support for the TI TPS51632. Add device binding document also.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 17:30:45 +00:00
Laxman Dewangan
faa3b2d579 regulator: tps51632: add register property for regmap
All TPS51632 registers are not readable/writable and
non-volatiles.

Add property of the registers whether it is readable/writable
or volatile for regmap framework.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 17:30:45 +00:00
Axel Lin
c6f0a0efb1 regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 17:28:25 +00:00
Axel Lin
adbf7eabb6 regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel
BUCK2 has the update_bit setting, but current code does not set update_bit
in pm8607_set_voltage_sel.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 17:28:22 +00:00
Axel Lin
d645d59158 regulator: tps6586x: Use apply_[reg|bit] with regmap based voltage_sel operations
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 16:34:11 +00:00
Axel Lin
68f7506017 regulator: da9052: Use apply_[reg|bit] with regmap based voltage_sel operations
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 16:34:11 +00:00
Axel Lin
c8520b4c5d regulator: core: Allow specify apply_[reg|bit] for regmap based voltage_sel operations
Some DVM regulators needs to update apply_bit after setting vsel_reg to
initiate voltage change on the output.  This patch adds apply_reg and
apply_bit to struct regulator_desc and update
regulator_set_voltage_sel_regmap() to set apply_bit of apply_reg when
apply_bit is set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 16:34:11 +00:00
Daniel Jeong
b59320cc5a regulator: lp8755: new driver for LP8755
This patch is for new lp8755 regulator dirver and
several unsed variables were deleted and then test was done.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can can be filexibly bundled
together in multiphase converters as required by application.
www.ti.com

Signed-off-by: Daniel Jeong <gshark.jeong@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 16:32:34 +00:00
Axel Lin
19280e4071 regulator: core: Fix continuous_voltage_range case in regulator_can_change_voltage
Regulator drivers with continuous_voltage_range flag set allows not setting
n_voltages. Thus if continuous_voltage_range is set, check the constraint range
instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 16:30:44 +00:00
Axel Lin
f38482fa70 regulator: lp3971: Convert to get_voltage_sel
regulator_list_voltage_table() returns -EINVAL if selector >= n_voltages.
Thus we don't need to check if reg is greater than BUCK_TARGET_VOL_MAX_IDX in
lp3971_dcdc_get_voltage_sel.

BUCK_TARGET_VOL_MIN_IDX and BUCK_TARGET_VOL_MAX_IDX are not used, remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 16:26:50 +00:00
Inderpal Singh
3ef303988c regulator: s5m8767: Fix probe failure due to stack corruption
The function sec_reg_read invokes regmap_read which expects unsigned int *
as the destination address. The existing driver is passing address of local
variable "val" which is u8. This causes the stack corruption and following
dump is observed during probe.

Hence change "val" from u8 to unsigned int.

Unable to handle kernel paging request at virtual address 02410020
pgd = c0004000
[02410020] *pgd=00000000
Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0    Not tainted  (3.6.0-00696-g98a28b18-dirty #27)
PC is at 0x2410020
LR is at _regulator_get_voltage+0x3c/0x70
pc : [<02410020>]    lr : [<c02395d4>]    psr: 20000013
sp : cf839b68  ip : 00000000  fp : cf92d410
r10: 0000cfd0  r9 : c06d9878  r8 : 0000f0a0
r7 : cf839b70  r6 : cf92d400  r5 : 00000011  r4 : cf000000
r3 : 02410020  r2 : 00000000  r1 : 00000048  r0 : cf000000
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
...........................
.................................

[<c02395d4>] (_regulator_get_voltage+0x3c/0x70) from [<c023ad80>] (print_constraints+0x50/0x36c)
[<c023ad80>] (print_constraints+0x50/0x36c) from [<c023e504>] (set_machine_constraints+0xe8/0x2b0)
[<c023e504>] (set_machine_constraints+0xe8/0x2b0) from [<c023e9c8>] (regulator_register+0x2fc/0x604)
[<c023e9c8>] (regulator_register+0x2fc/0x604) from [<c049d628>] (s5m8767_pmic_probe+0x688/0x718)
[<c049d628>] (s5m8767_pmic_probe+0x688/0x718) from [<c029915c>] (platform_drv_probe+0x18/0x1c)
[<c029915c>] (platform_drv_probe+0x18/0x1c) from [<c0297dd0>] (really_probe+0x68/0x1f4)
[<c0297dd0>] (really_probe+0x68/0x1f4) from [<c0298070>] (driver_probe_device+0x30/0x48)

Signed-off-by: Inderpal Singh <inderpal.singh@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 16:24:37 +00:00
Paolo Pisati
92d7a55879 regulator: core: if voltage scaling fails, restore original voltage values
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Tested-by: Robert Nelson <robertcnelson@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-15 23:53:05 +09:00
Mark Brown
4ffc45c360 Merge remote-tracking branch 'regulator/topic/sm8767' into regulator-next 2012-12-11 21:44:55 +09:00
Mark Brown
f3cd19c38c Merge remote-tracking branch 'regulator/topic/change' into regulator-next 2012-12-11 21:44:53 +09:00
Axel Lin
8a23b4e03d regulator: core: Fix logic to determinate if regulator can change voltage
Having a linear_min_sel setting means the first linear_min_sel selectors are
invalid. We need to subtract linear_min_sel when use n_voltages to determinate
if regulator can change voltage.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-11 21:44:23 +09:00
Mark Brown
b17fc86cc5 Merge branch 'topic/min' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-change 2012-12-11 21:44:17 +09:00
Amit Daniel Kachhap
76c854d1df regulator: s5m8767: Fix to work even if no DVS gpio present
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-11 12:44:05 +09:00
Amit Daniel Kachhap
da130ab2df regulator: s5m8767: Fix to read the first DVS register.
This patch modifies the DVS register read function to select correct DVS1
register. This change is required because the GPIO select pin is 000 in
unintialized state and hence selects the DVS1 register.

Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-11 12:44:05 +09:00
Amit Daniel Kachhap
9bb096ff37 regulator: s5m8767: Fix to work when platform registers less regulators
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-11 12:44:04 +09:00
Mark Brown
bfd9155ebb Merge remote-tracking branch 'regulator/topic/gpio' into regulator-next 2012-12-10 23:14:11 +09:00
Lee Jones
3708903ee6 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>
2012-12-10 23:12:41 +09:00
Lee Jones
ad0b8b9e82 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>
2012-12-10 23:12:41 +09:00
Mark Brown
925f14dc2d Merge remote-tracking branch 'regulator/topic/wm831x' into regulator-next 2012-12-10 12:43:33 +09:00
Mark Brown
8ee005112d Merge remote-tracking branch 'regulator/topic/tps80031' into regulator-next 2012-12-10 12:43:32 +09:00
Mark Brown
f1e0d5f138 Merge remote-tracking branch 'regulator/topic/tps65910' into regulator-next 2012-12-10 12:43:30 +09:00
Mark Brown
21e55ca406 Merge remote-tracking branch 'regulator/topic/tps6586x' into regulator-next 2012-12-10 12:43:29 +09:00