Commit Graph

1581 Commits (0dbc3463c8606e8122f3c8aea9815d0ef6e66bf9)

Author SHA1 Message Date
Axel Lin aca45e9e2f regulator: ab8500: Add missing volt_table setting for AB8540_LDO_TVOUT
This is required for regulator_list_voltage_table() to properly work.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:29 +01:00
Axel Lin d7816ab09b regulator: ab8500: Fix list_voltage for fixed voltage regulators
commit b080c78a4e
"regulator: ab8500: Update voltage handling for fixed voltage regulators"
removes min_uV settings and sets volt_table for all fixed voltages, thus
we can not use regulator_list_voltage_linear now. Use
regulator_list_voltage_table instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:28 +01:00
Lee Jones da45edc7f8 regulator: ab8500: Shuffle init functions into a more logical order
The ab*_match[] arrays should be moved out of the way, instead of
bunched in the middle of the initialisation functions. This patch
moves all initialisation code which currently resides above these
arrays down to be grouped with the others. This makes the whole
thing slightly easier to read.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:28 +01:00
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