dect
/
linux-2.6
Archived
13
0
Fork 0
Commit Graph

652 Commits

Author SHA1 Message Date
Axel Lin 0c3d0b20cf regulator: Remove redundant regmap_update_bits call for TPS65023_REG_CON_CTRL2
This looks like a merge mistake.  Calling regmap_update_bits once is enough.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-06 16:38:18 +00:00
Mark Brown 737f360d5b regulator: Remove support for supplies specified by struct device
This has been deprecated for a very long time now.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-02 14:03:24 +00:00
Mark Brown fb87ef1a12 Merge branch 'regulator-drivers' into regulator-supply 2012-02-02 13:51:23 +00:00
Axel Lin 20a14b84f8 regulator: Kill s5m8767_get_reg_id function
Calling s5m8767_get_reg_id() is exactly the same as calling rdev_get_id().
It is pointless to add s5m8767_get_reg_id() function.
Use rdev_get_id() directly and remove s5m8767_get_reg_id() function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-02 13:50:27 +00:00
Mark Brown 34ce8d07e6 regulator: wm8350: Don't specify consumer supplies with struct device
Very, very deprecated.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-02 13:46:33 +00:00
Linus Torvalds b527a2331b This fixes an integration issue with the regulator device tree bindings
which shook out in -rc.  The bindings were overly enthusiatic when
 deciding to set a voltage on a regulator and would try to set zero volts
 on an unconfigured regulator which isn't supported.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPITNlAAoJEBus8iNuMP3d9nUP/1DSmprBh0TwOdqSGfeQKU+A
 TECIi+SsWgYwJoiDXdkrfdauQTzHTFnf2ddGdEhaaSpgwsQSMsjqOTcjpfcIC94Y
 Qqiv4avPIb8FsH7vSn69XX9JWy3Q4yQqoWWwZ1/fwWVrm5dGoyb+fif+yM3Pn7hJ
 jvorCldMFkLEvjhkMJ0MUTtZZplv1jcM3Ffy2dSPGIl/SoXCitmuVy3ygy6B0ICa
 JXLNO5yUQSoGDMSYiEOKQUePLKEQKeluMUG+yC8REXaqki9qnoGHeUu8Uje2+teE
 Ik5YUVWFCl2EjPotvUgJSJZMIr5Z2JyAhTxOtXLAk6ke1jEoNVO02wtoUI+22C1T
 kZjqvFbBpyuJWbYHHR3a5rbTa5eRjdud923F7Xy8+mCoS5f+kuPltZUWgaJOxsL3
 5rAZcW88gWc6XOSZLto2rAeUs9rUHal78sjBPWvTp1wjixGTqJU1RQpi8VYn0dAB
 YAlbeIS3wo3wQfN/A3ZPIGM7pAdlgAxT6l3G8xWSybmZazwQm+eFPtNNe5nzEfrl
 TX6paC0bLR6azKG1p4qVHxaCgwvJsZcBEiz1zM8JPWAkiUn2PzznlFTyBqXKmGr8
 Eqisiy7WLPiysdYuRWg+GJW/4M17sdCaoGKAsVNv2KSy2C/b9z3yRxRYSr9eE8TI
 xAbEh0jYDnopI/jYL89X
 =nREk
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

This fixes an integration issue with the regulator device tree bindings
which shook out in -rc.  The bindings were overly enthusiatic when
deciding to set a voltage on a regulator and would try to set zero volts
on an unconfigured regulator which isn't supported.

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: Set apply_uV only when min and max voltages are defined
2012-01-30 10:16:25 -08:00
Laxman Dewangan 1e0c66f497 regulator: tps65910: Sleep control through external inputs
Add support for sleep controls of different regulator through
external inputs EN1, EN2 or EN3.
Each regulator's output will be active when its external
input is high and turns to OFF/Low power mode when its
external input is low.
The configuration parameters for sleep control is provided through
board specific platform data.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-30 13:31:01 +00:00
Karol Lewandowski 8a093049c6 regulator: Set apply_uV only when min and max voltages are defined
apply_uV is errornously set when regulator is instantiated from device
tree, even when it doesn't contain any voltage constraints.

This commit fixes error:

  machine_constraints_voltage: CHARGER: failed to apply 0uV constraint

for following regulator description in DTS:

  CHARGER {
	regulator-min-microamp = <100000>;
	regulator-max-microamp = <200000>;
  }

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-26 11:01:21 +00:00
Sylwester Nawrocki 49e226323d regulator: Reverse the disable sequence in regulator_bulk_disable()
Often there is a need for disabling a set of regulators in order opposite
to the enable order. Currently the function regulator_bulk_disable() walks
list of regulators in same order as regulator_bulk_enable(). This may cause
trouble, especially for devices with mixed analogue and digital circuits.
So reverse the disabling sequence of regulator_bulk_disable().
While at it, also correct the comment.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-25 11:55:44 +00:00
Fabio Estevam 2343933921 regulator: mc13xxx-regulator-core: Fix the build when driver is selected as module
Fix the following build error when mc138xxx driver is built as module:

ERROR: "mc13xxx_parse_regulators_dt" [drivers/regulator/mc13892-regulator.ko] undefined!
ERROR: "mc13xxx_get_num_regulators_dt" [drivers/regulator/mc13892-regulator.ko] undefined!

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-24 20:47:25 +00:00
Karol Lewandowski e371ceb89f regulator: max8997: Avoid spaces in regulator names
max8997-pmic instantiated from device tree uses names, not numerical
ids to distinguish between outputs.

Replace spaces with underscores in said names to make it possible to
describe these outputs as regulators in DTS.

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-24 20:00:33 +00:00
Mark Brown 4a7cbb56fd regulator: Fix documentation for of_node parameter of regulator_register()
Commit 5bc75a8863 ("kernel-doc: fix new warning in regulator core")
added documentation for of_node to address a warning but the
documentation didn't explain what the parameter is for so would be
likely to be unhelpful for users.  Clarify that.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-24 10:40:06 -08:00
Randy Dunlap 5bc75a8863 kernel-doc: fix new warning in regulator core
Fix new kernel-doc warning:

Warning(drivers/regulator/core.c:2741): No description found for parameter 'of_node'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Cc:	Liam Girdwood <lrg@ti.com>
Cc:	Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-23 08:44:53 -08:00
Mark Brown e6e740304a regulator: Provide devm_regulator_bulk_get()
Allow drivers to benefit from both the bulk APIs and managed resources
simultaneously.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-22 16:15:39 +00:00
Mark Brown d5ad34f7cb regulator: Implement devm_regulator_free()
Allow consumers to free regulators allocated using devm_regulator_get()
if they need to. This will not normally be required.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-22 16:15:38 +00:00
Laxman Dewangan 7d38a3cb9b regulator: tps65910: use appropriate variable names.
Renaming the variables "table" to "voltage_table" and
"table_len" to "n_voltages" of regulator information
to have more meaningful.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:11:09 +00:00
Laxman Dewangan 51ced5e288 regulator: tps65910: Initialize n_voltages for rails.
Initializing the number of voltages supported by different
rails of pmic device tps65911.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:11:06 +00:00
Stephen Boyd 070b907922 regulator: Add devm_regulator_get()
Add a resource managed regulator_get() to simplify regulator
usage in drivers. This allows driver authors to "get and forget"
about their regulators by automatically calling regulator_put()
when the driver is detached.

[Fixed up a couple of coding style issues -- broonie]

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:02:55 +00:00
Laxman Dewangan c2f8efd764 regulator: tps65910: Add regulator info for RTC rail
Adding missing regulator info for VRTC rail for device
tps65911. The regulator voltage rail index start from
VRTC which is defined as 0.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:36 +00:00
Mark Brown 0ce6987345 regulator: Update s5m8767 for device tree API changes
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:34 +00:00
Axel Lin b683d980d8 regulator: Update tps65217-regulator for DT changes
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:33 +00:00
AnilKumar Ch a493077f18 regulator: tps65217: Add tps65217 regulator driver
This patch adds tps65217 PMIC as a regulator

The regulator module consists of 3 DCDCs and 4 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:31 +00:00
Sangbeom Kim 62aa492582 regulator: Add S5M8767 configuration
This patch add Samsung S5M8767A pmic configuration.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:30 +00:00
Bengt Jonsson 38e968380b regulators/db8500: split off shared dbx500 code
As we progress with DB5500 and future voltage domain regulators
based on very similar hardware as found in the DB8500 PRCMU,
it makes sense to split off the generic parts and introduce
some generic debug code for the DBx500 regulators. This patch
accoplish a basic abstraction of the DBx500 voltage domain
regulators.

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:29 +00:00
Axel Lin c835e1c00e regulator: s5m8767: Remove redundant MODULE_ALIAS
The MODULE_DEVICE_TABLE will setup the modalias, thus adding
a MODULE_ALIAS for an entry already in s5m8767_pmic_id is redundant.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:27 +00:00
Axel Lin 047ec220a4 regulator: s5m8767: Add missing breaks
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:26 +00:00
Sangbeom Kim 9767ec7fe8 regulator: Add S5M8767A regulator driver
S5M8767A is a cost-effective PMIC which is designed for mobile applications.
It includes high efficient 9 Buck converters, 28 LDOs.
Especially, S5M8767A is optimized for Multi-core SOCs.
And during DVFS operation, S5M8767A output stable voltage.
This patch implement regulator driver for S5M8767A.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:25 +00:00
Laxman Dewangan 6219929f5f regulator: TPS62360: Add tps62360 regulator driver
The regulator module consists of 1 DCDC. The output voltage
is configurable and is meant for supply power to the core
voltage of Soc.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20 12:01:23 +00:00
Linus Torvalds 21ebd6c68b Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (59 commits)
  rtc: max8925: Add function to work as wakeup source
  mfd: Add pm ops to max8925
  mfd: Convert aat2870 to dev_pm_ops
  mfd: Still check other interrupts if we get a wm831x touchscreen IRQ
  mfd: Introduce missing kfree in 88pm860x probe routine
  mfd: Add S5M series configuration
  mfd: Add s5m series irq driver
  mfd: Add S5M core driver
  mfd: Improve mc13xxx dt binding document
  mfd: Fix stmpe section mismatch
  mfd: Fix stmpe build warning
  mfd: Fix STMPE I2c build failure
  mfd: Constify aat2870-core i2c_device_id table
  gpio: Add support for stmpe variant 801
  mfd: Add support for stmpe variant 801
  mfd: Add support for stmpe variant 610
  mfd: Add support for STMPE SPI interface
  mfd: Separate out STMPE controller and interface specific code
  misc: Remove max8997-muic sysfs attributes
  mfd: Remove unused wm831x_irq_data_to_mask_reg()
  ...

Fix up trivial conflict in drivers/leds/Kconfig due to addition of
LEDS_MAX8997 and LEDS_TCA6507 next to each other.
2012-01-13 20:43:32 -08:00
Linus Walleij ee66e653ca mfd: Unify abx500 headers in mfd/abx500
This moves all the header files related to the abx500 family into
a common include directory below mfd. From now on we place any
subchip header in that directory. Headers previously in e.g.
<linux/mfd/ab8500/gpio.h> get prefixed and are now e.g.
<linux/mfd/abx500/ab8500-gpio.h>. The top-level abstract interface
remains in <linux/mfd/abx500.h>.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-01-09 00:37:39 +01:00
Richard Zhao 0c437c4ae7 regulator: set constraints.apply_uV to 0 in of_get_fixed_voltage_config
Fix fixed regulator using DT failed to call regulator_register.

of_get_regulator_init_data set apply_uV to 1, but fixed regulator
doesn't need it. Set it back to 0.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-06 11:01:09 -08:00
Kevin Liu 65364e9ab9 regulator: max8925: fix enabled/disabled judgement mistake
Max8925 ldo status should be determined by two factors:
1. power up/down sequence selection(LDOCTL[4:2]).
2. i2c enable bit(LDOCTL[0]).

Max8925 ldo support two types of power up/down sequence:
1. flexible sequence(LDOCTL[4:2] = 0~6).
2. i2c sequence(LDOCTL[4:2] = 7).

With flexible sequence selected, the ldo is enabled during power up by default.
With i2c sequence selected, the ldo is controlled by the i2c enable bit(LDOCTL[0]).

Signed-off-by: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-06 10:56:14 -08:00
Donggeun Kim e1de2f4234 regulator: add regulator_bulk_force_disable function
This patch allows consumers to forcibly disable multiple regulator
clients in a single API call.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-03 20:20:01 +00:00
Richard Zhao 1bb50b28a9 regulator: pass regulator_register of_node in fixed voltage driver
regulator_get needs of_node to find right regulator.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-02 12:45:37 +00:00
Laxman Dewangan b2296bd43e regulator: Enable supply regulator if child rail is enabled.
During regulator_register, the rail is set on the provided
machine constraints and if it is enabled then it is also
require to enable the supply regulator. This will make sure
that:
   1. Proper reference count for supply regulator to be maintain.
   2. Supply regulator should be enable when given rail is enabled.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-02 11:36:02 +00:00
Fabio Estevam 4fef21eaac regulator: mc13892: Convert to devm_kzalloc()
Convert mc13892-regulator driver to use devm_kzalloc().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-30 02:06:29 +00:00
Fabio Estevam cbe10a3674 regulator: mc13783: Convert to devm_kzalloc()
Convert mc13783-regulator driver to use devm_kzalloc().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-29 17:58:37 +00:00
Axel Lin 32c78de8f1 regulator: Fix checking return value of create_regulator
create_regulator() returns NULL on fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-29 10:40:19 +00:00
Axel Lin bcda432194 regulator: Fix the error handling if create_regulator fails
In the case of create_regulator() fails, goto the error path immediately.
It does not make sense to update rdev->open_count if create_regulator fails.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-29 10:40:19 +00:00
Mark Brown a398eaa23e regulator: Export regulator_is_supported_voltage()
It's part of the driver interface so should be available to modules.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-28 17:09:32 +00:00
Shawn Guo 93bcb23b38 regulator: mc13892: add device tree probe support
It adds device tree probe support for mc13892-regulator driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-22 11:10:45 +00:00
Shawn Guo 3a5d03158d regulator: mc13892: remove the unnecessary prefix from regulator name
It's not really necessary to add a prefix 'MC13892__' for each mc13892
regulator name, since the chip must have been identified as mc13892
when we look at the regulator name.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-22 11:07:21 +00:00
Mark Brown fded2f4fae regulator: Convert wm831x regulator drivers to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-20 11:29:05 +00:00
Axel Lin 6242eae9bc regulator: da9052: Staticize non-exported symbols
da9052_regulator_info and da9053_regulator_info are not used outside
this driver so no need to make the symbol global.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-20 10:02:48 +00:00
Ashish Jangam 984b5a6ba5 regulator: Replace kzalloc with devm_kzalloc and if-else with a switch-case for da9052-regulator
Reported-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: David Dajun Chen <dchen@diasemi.com>
Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-17 09:25:47 +00:00
Mark Brown 47aed92c77 regulator: Update da9052-regulator for DT changes
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-15 15:03:38 +08:00
Ashish Jangam 08bf1c0ae9 regulator: DA9052/53 Regulator support
The Dialog PMIC has below featured regulators:-
DA9052-BC - 4 DVS Buck converters 0.5V - 3.6V upto 1Amp.
DA9053-AA/BX - 4 DVS Buck converters 0.5V - 2.5V upto 3Amp.
DA9052/53 - 10 Programmable LDO's High PSSR, 1% accuracy.

This patch support all the DA9052 and Da9053 regulators. The output voltages are
fully programmable via I2C or SPI interface. The platform data with regulation
constraints is passed down from the board to the regulator.

Signed-off-by: David Dajun Chen <dchen@diasemi.com>
Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com>
Tested-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-15 02:00:10 +08:00
Mark Brown 2f288efd2f Merge branch 'topic/dt' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-next 2011-12-05 19:27:49 +00:00
Shawn Guo d9a861cce1 regulator: pass device_node to of_get_regulator_init_data()
It's not always true that the device_node of regulator can be found
at dev->of_node at the time when of_get_regulator_init_data() is being
called, because in some cases the regulator nodes in device tree do
not have 'struct device' behind them until regulator_dev gets created
for it by core function regulator_register().

The patch adds device_node as a new parameter to
of_get_regulator_init_data(), so that caller can pass in the node of
regulator directly.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-05 19:10:17 +00:00
Mark Brown ab62aa931e regulator: If a single voltage is set with device tree then set apply_uV
Otherwise there is no way in the bindings to configure a fixed voltage
via software. It seems reasonable to assume that if the binding explicitly
specifies a voltage we want to actually use that voltage.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-05 18:59:10 +00:00
Mark Brown 9a8f5e0720 regulator: Allow regulators to register with no init_data
This allows read-only access to the device configuration which may be
useful for diagnostics.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-11-30 09:38:28 +00:00
Mark Brown 979268cd32 Merge remote-tracking branches 'regulator/topic/dt' and 'regulator/for-linus' into regulator-next 2011-11-28 19:01:08 +00:00
Tero Kristo ba305e31e8 regulator: twl: fix twl4030 support for smps regulators
SMPS regulator voltage control differs from the one of the LDO ones.
Current TWL code was using LDO regulator ops for controlling the SMPS
regulators, which fails. This was fixed fixed by adding separate
regulator type which uses correct logic and calculations for the
voltage levels.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-11-28 18:58:31 +00:00
Mark Brown 12f457dd78 Merge remote-tracking branch 'regulator/for-linus' into regulator-next 2011-11-28 14:50:45 +00:00
Lothar Waßmann 58fb5cf5d1 regulator: fix use after free bug
This is caused by dereferencing 'rdev' after device_unregister() in
the regulator_unregister() function.  'rdev' is freed by
device_unregister(), so it must not be dereferenced after this call.

[Edited commit message for legibility -- broonie]

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28 14:44:38 +00:00
Mark Brown 9ee4be4156 Merge remote-tracking branch 'regulator/for-linus' into regulator-next 2011-11-28 11:49:56 +00:00
Axel Lin 005d610f2a regulator: Convert virtual and userspace regulator consumer drivers to use module_platform_driver()
This patch converts virtual and userspace regulator consumer drivers to use the
module_platform_driver() macro which makes the code smaller and a bit simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28 11:49:13 +00:00
Axel Lin a5228d2e5e regulator: aat2870: Remove a redundant bitwise and operation
The implementation in aat2870_update() already did the bitwise and operation
against mask parameter.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28 11:49:10 +00:00
Axel Lin d4d6373c11 regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator
In current implementation, the pointer ri is not NULL if no id is matched.
Fix it by checking i == ARRAY_SIZE(aat2870_regulators) if no id is matched.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
2011-11-28 11:48:15 +00:00
Mark Brown ae523fc574 Merge remote-tracking branch 'regulator/topic/dt' into regulator-next 2011-11-27 19:47:03 +00:00
Axel Lin 22d881c068 regulator: Avoid potential NULL dereference in reg_fixed_voltage_probe()
of_get_fixed_voltage_config() may return NULL, return -ENOMEM in this case
so we don't dereference NULL pointer.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27 19:46:31 +00:00
Mark Brown 6806a663b0 Merge remote-tracking branch 'regulator/topic/dt' into regulator-next 2011-11-27 11:36:16 +00:00
Axel Lin bc91396b0b regulator: Staticise of_get_fixed_voltage_config()
It is not used outside this driver so no need to make the symbol global.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27 11:32:37 +00:00
Axel Lin 4b864af1a3 regulator: Checking return value of of_get_regulator_init_data
of_get_regulator_init_data() may return NULL, thus
check the return value to avoid NULL pointer dereference.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27 11:29:21 +00:00
Axel Lin e69af5e967 regulator: export of_get_regulator_init_data
of_get_regulator_init_data is called in drivers/regulator/fixed.c
which could be a module.

Export of_get_regulator_init_data to fix below build error:
ERROR: "of_get_regulator_init_data" [drivers/regulator/fixed.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27 11:29:21 +00:00
Mark Brown 02fcc84ae5 Merge remote-tracking branch 'regulator/topic/dt' into regulator-next 2011-11-24 10:49:38 +00:00
Rajendra Nayak 156843470c regulator: Fix compile break due to missing arguments to regulator_register
The commit 2c043bcbf2 ("regulator: pass additional of_node to
regulator_register()") caused a compile break because it missed
updating the regulator_register() call in gpio-regulator.c with
the additional parameter (NULL).

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

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

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-24 10:47:56 +00:00
Mark Brown 924ee2c962 Merge remote-tracking branch 'regulator/topic/dt' into regulator-next 2011-11-23 18:50:59 +00:00
Mark Brown 68aaa37d0e Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-next 2011-11-23 18:48:57 +00:00
Rajendra Nayak 69511a452e regulator: map consumer regulator based on device tree
Device nodes in DT can associate themselves with one or more
regulators/supply by providing a list of phandles (to regulator nodes)
and corresponding supply names.

For Example:
	devicenode: node@0x0 {
		...
		...
		vmmc-supply = <&regulator1>;
		vpll-supply = <&regulator2>;
	};

The driver would then do a regulator_get(dev, "vmmc"); to get
regulator1 and do a regulator_get(dev, "vpll"); to get
regulator2.

of_get_regulator() extracts the regulator node for a given
device, based on the supply name.

Use it to look up the regulator for a given consumer from device tree, during
a regulator_get(). If not found fallback and lookup through
the regulator_map_list instead.

Also, since the regulator dt nodes can use the same binding to
associate with a parent regulator/supply, allow the drivers to
specify a supply_name, which can then be used to lookup dt
to find the parent phandle.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 18:47:31 +00:00
Rajendra Nayak 2c043bcbf2 regulator: pass additional of_node to regulator_register()
With device tree support for regulators, its needed that the
regulator_dev->dev device has the right of_node attached.
To be able to do this add an additional parameter to the
regulator_register() api, wherein the dt-adapted driver can
then pass this additional info onto the regulator core.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 18:47:04 +00:00
Rajendra Nayak cef49102c1 regulator: adapt fixed regulator driver to dt
The fixed regulator driver uses of_get_fixed_voltage_config()
to extract fixed_voltage_config structure contents from device tree.

Also add documenation for additional bindings for fixed
regulators that can be passed through dt.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 18:47:00 +00:00
Rajendra Nayak 8f446e6fa1 regulator: helper routine to extract regulator_init_data
The helper routine is meant to be used by the regulator drivers
to extract the regulator_init_data structure from the data
that is passed from device tree.
'consumer_supplies' which is part of regulator_init_data is not extracted
as the regulator consumer mappings are passed through DT differently,
implemented in subsequent patches.
Similarly the regulator<-->parent/supply mapping is handled in
subsequent patches.

Also add documentation for regulator bindings to be used to pass
regulator_init_data struct information from device tree.

Some of the regulator properties which are linux and board specific,
are left out since its not clear if they can
be in someway embedded into the kernel or passed in from DT.
They will be revisited later.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 18:46:55 +00:00
Afzal Mohammed 780dc9ba4e regulator: TPS65910: Fix VDD1/2 voltage selector count
Count of selector voltage is required for regulator_set_voltage
to work via set_voltage_sel. VDD1/2 currently have it as zero,
so regulator_set_voltage won't work for VDD1/2.
Update count (n_voltages) for VDD1/2.

Output Voltage = (step value * 12.5 mV + 562.5 mV) * gain

With above expr, number of voltages that can be selected is
step value count * gain count

constant for gain count will be called VDD1_2_NUM_VOLT_COARSE

existing constant for step value count is VDD1_2_NUM_VOLTS,
use VDD1_2_NUM_VOLT_FINE instead to make clear that step value
is not the only component in deciding selectable voltage count

Signed-off-by: Afzal Mohammed <afzal@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 14:03:52 +00:00
Mark Brown 4c78899b92 regulator: Don't create voltage sysfs entries if we can't read voltage
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 14:03:42 +00:00
Mark Brown aebe495895 regulator: Don't report zero volts for the fixed voltage regulator
If we don't know what voltage the regulator is set to return an error
rather than reporting zero volts.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 14:03:41 +00:00
Kyle Manna c1fc148024 regulator: TPS65910: Create an array for init data
Create an array of fixed size for the platform to pass regulator
initalization data through.

Passing an array of pointers to init data also allows more flexible
definition of init data as well as prevents reading past the end of the
array should the platform define an incorrectly sized array.

Signed-off-by: Kyle Manna <kyle.manna@fuel7.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 14:02:48 +00:00
Kyle Manna 72c108cc49 regulator: TPS65910: Move regulator defs to header
Move the regulator defintions to the header so that platform board file
can use them to configure specific regulators.

Signed-off-by: Kyle Manna <kyle.manna@fuel7.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 14:02:48 +00:00
Jonghwan Choi c5b68d47bb regulator: max8649 Convert max8649 to use regmap api
Signed-off-by: Jonghwan Choi <jhbird.choi@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 14:02:48 +00:00
Jonghwan Choi 43530b69d7 regulator: Use regmap_read/write(), regmap_update_bits functions directly
Current driver had the regmapcalls within the bodies of the driver specific read/write fuctions.
This patch removes the original read/write functions and makes the call sites use regmap directly.

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 14:02:48 +00:00
Linus Torvalds 32aaeffbd4 Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
  Revert "tracing: Include module.h in define_trace.h"
  irq: don't put module.h into irq.h for tracking irqgen modules.
  bluetooth: macroize two small inlines to avoid module.h
  ip_vs.h: fix implicit use of module_get/module_put from module.h
  nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
  include: replace linux/module.h with "struct module" wherever possible
  include: convert various register fcns to macros to avoid include chaining
  crypto.h: remove unused crypto_tfm_alg_modname() inline
  uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
  pm_runtime.h: explicitly requires notifier.h
  linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
  miscdevice.h: fix up implicit use of lists and types
  stop_machine.h: fix implicit use of smp.h for smp_processor_id
  of: fix implicit use of errno.h in include/linux/of.h
  of_platform.h: delete needless include <linux/module.h>
  acpi: remove module.h include from platform/aclinux.h
  miscdevice.h: delete unnecessary inclusion of module.h
  device_cgroup.h: delete needless include <linux/module.h>
  net: sch_generic remove redundant use of <linux/module.h>
  net: inet_timewait_sock doesnt need <linux/module.h>
  ...

Fix up trivial conflicts (other header files, and  removal of the ab3550 mfd driver) in
 - drivers/media/dvb/frontends/dibx000_common.c
 - drivers/media/video/{mt9m111.c,ov6650.c}
 - drivers/mfd/ab3550-core.c
 - include/linux/dmaengine.h
2011-11-06 19:44:47 -08:00
Linus Torvalds a0a4194c94 Merge branch 'for-next' of git://git.infradead.org/users/sameo/mfd-2.6
* 'for-next' of git://git.infradead.org/users/sameo/mfd-2.6: (80 commits)
  mfd: Fix missing abx500 header file updates
  mfd: Add missing <linux/io.h> include to intel_msic
  x86, mrst: add platform support for MSIC MFD driver
  mfd: Expose TurnOnStatus in ab8500 sysfs
  mfd: Remove support for early drop ab8500 chip
  mfd: Add support for ab8500 v3.3
  mfd: Add ab8500 interrupt disable hook
  mfd: Convert db8500-prcmu panic() into pr_crit()
  mfd: Refactor db8500-prcmu request_clock() function
  mfd: Rename db8500-prcmu init function
  mfd: Fix db5500-prcmu defines
  mfd: db8500-prcmu voltage domain consumers additions
  mfd: db8500-prcmu reset code retrieval
  mfd: db8500-prcmu tweak for modem wakeup
  mfd: Add db8500-pcmu watchdog accessor functions for watchdog
  mfd: hwacc power state db8500-prcmu accessor
  mfd: Add db8500-prcmu accessors for PLL and SGA clock
  mfd: Move to the new db500 PRCMU API
  mfd: Create a common interface for dbx500 PRCMU drivers
  mfd: Initialize DB8500 PRCMU regs
  ...

Fix up trivial conflicts in
	arch/arm/mach-imx/mach-mx31moboard.c
	arch/arm/mach-omap2/board-omap3beagle.c
	arch/arm/mach-u300/include/mach/irqs.h
	drivers/mfd/wm831x-spi.c
2011-11-03 09:40:51 -07:00
Linus Torvalds f3c3f06705 Merge branch 'for-linus' of git://opensource.wolfsonmicro.com/regulator
* 'for-linus' of git://opensource.wolfsonmicro.com/regulator: (22 commits)
  regulator: Constify constraints name
  regulator: Fix possible nullpointer dereference in regulator_enable()
  regulator: gpio-regulator add dependency on GENERIC_GPIO
  regulator: Add module.h include to gpio-regulator
  regulator: Add driver for gpio-controlled regulators
  regulator: remove duplicate REG_CTRL2 defines in tps65023
  regulator: Clarify documentation for regulator-regulator supplies
  regulator: Fix some bitrot in the machine driver documentation
  regulator: tps65023: Added support for the similiar TPS65020 chip
  regulator: tps65023: Setting correct core regulator for tps65021
  regulator: tps65023: Set missing bit for update core-voltage
  regulator: tps65023: Fixes i2c configuration issues
  regulator: Add debugfs file showing the supply map table
  regulator: tps6586x: add SMx slew rate setting
  regulator: tps65023: Fixes i2c configuration issues
  regulator: tps6507x: Remove num_voltages array
  regulator: max8952: removed unused mutex.
  regulator: fix regulator/consumer.h kernel-doc warning
  regulator: Ensure enough enable time for max8649
  regulator: 88pm8607: Fix off-by-one value range checking in the case of no id is matched
  ...
2011-11-01 15:06:20 -07:00
Paul Gortmaker 65602c32ee regulator: Add module.h to drivers/regulator users as required
Another group of drivers that are taking advantage of the implicit
presence of module.h -- and will break when we pull the carpet out
from under them during a cleanup.  Fix 'em now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:32:15 -04:00
Paul Gortmaker 22be053fff regulator: Add export.h for THIS_MODULE to dummy.c
So that THIS_MODULE is still in scope once we clean up the presence
of module.h being everywhere.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:32:15 -04:00
Mattias Nilsson 73180f85f4 mfd: Move to the new db500 PRCMU API
Now that we have a shared API between the DB8500 and DB5500
PRCMU's, switch to using this neutral API instead. We delete the
parts of db8500-prcmu.h that is now PRCMU-neutral, and calls will
be diverted to respective driver. Common registers are in
dbx500-prcmu-regs.h and common accessors and defines in
<linux/mfd/dbx500-prcmu.h> This way we get a a lot more
abstraction and code reuse.

Signed-off-by: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-10-24 14:09:18 +02:00
Samuel Ortiz 8f1585aa73 regulator: Finish mc13783 conversion to the mc13xxx API
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-10-24 14:09:15 +02:00
Heiko Stübner d1685e4e2c regulator: Fix possible nullpointer dereference in regulator_enable()
In the case where _regulator_enable returns an error it was not checked
if a supplying regulator exists before trying to disable it, leading
to a null pointer-dereference if no supplying regulator existed.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-14 20:47:06 +01:00
Heiko Stübner d162b3c54b regulator: gpio-regulator add dependency on GENERIC_GPIO
Without GENERIC_GPIO "struct gpio" is undefined leading to errors.

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-12 10:50:40 +01:00
Mark Brown ecc37edf7b regulator: Add module.h include to gpio-regulator
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-11 13:59:13 +01:00
Heiko Stübner 3f0292ae8b regulator: Add driver for gpio-controlled regulators
This patch adds support for regulators that can be controlled via gpios.

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

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

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

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

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

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

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

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-09 12:36:21 +01:00
H Hartley Sweeten e3efe6669b regulator: remove duplicate REG_CTRL2 defines in tps65023
There are two sets of defines for the REG_CTRL2 bitfields and one
of them has TPS65023_REG_CTRL2_DCDC1 defined incorrectly. Remove
the duplicates and leave the correct one for TPS65023_REG_CTRL2_DCDC1.

This fixes the following sparse warnings:

drivers/regulator/tps65023-regulator.c:77:9: warning: preprocessor token TPS65023_REG_CTRL2_DCDC1 redefined
drivers/regulator/tps65023-regulator.c:70:9: this was the original definition

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-09 12:05:27 +01:00
Mark Brown a1ff89ef3c regulator: Add WM1811 support
The WM1811 has a slightly different range on LDO2 to other WM8994 class
devices.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-07 12:49:18 +01:00
Mark Brown aa59802ded regulator: Fix return code from regulator_disable_deferred()
schedule_delayed_work() returns a bool indicating if the work was already
queued when it succeeds so we need to squash a true down to zero.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04 16:50:16 +01:00
Mark Brown da07ecd93b regulator: Implement deferred disable support
It is a reasonably common pattern for hardware to require some delay after
being quiesced before the disable has finalised, especially in mixed signal
devices. For example, an active discharge may be required to ensure that
the circuit starts up again in a known state. Avoid having to implement
such delays in the regulator API by providing regulator_deferred_disable()
which will do a regulator_disable() a specified number of milliseconds
after it is called.

Due to the reference counting done on regulators a deferred disable can
be cancelled by doing another regulator_enable().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2011-09-14 10:58:23 +01:00
Marcus Folkesson 437afd2ad6 regulator: tps65023: Added support for the similiar TPS65020 chip
Defines a new voltage-table and allows registering of the tps65020 device.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-28 17:43:41 +01:00
Marcus Folkesson 1c3ede05d1 regulator: tps65023: Setting correct core regulator for tps65021
TPS65023 is using VDCDC1 as core regulator and TPS65021 is using VDCDC3.
Core-regulator and voltage-tables may differ between
different regulators. These two is now passed as driver data.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-28 17:43:40 +01:00
Marcus Folkesson cc17ef3f04 regulator: tps65023: Set missing bit for update core-voltage
Setting the GO bit in CTRL2 for updating the core voltage

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-28 17:43:40 +01:00
Marcus Folkesson f068ad8cca regulator: tps65023: Fixes i2c configuration issues
Allow i2c core voltage adjustments by clearing CORE ADJ Allowed bit in CTRL2

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-28 17:43:40 +01:00
Mark Brown ba55a9741d regulator: Add debugfs file showing the supply map table
Useful for working out why things aren't getting plugged together properly.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-28 17:41:59 +01:00
Xin Xie 500c524aad regulator: tps6586x: add SMx slew rate setting
Add output vlotage slew rate setting for SM0/SM1

Signed-off-by: Xin Xie <xxie@nvidia.com>
Signed-off-by: Danny Huang <dahuang@nvidia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-28 17:41:28 +01:00
Marcus Folkesson fc999b8379 regulator: tps65023: Fixes i2c configuration issues
Allow i2c core voltage adjustments by clearing CORE ADJ Allowed bit in CTRL2

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-08 17:31:03 +01:00
Axel Lin 0fcdb109a5 regulator: tps6507x: Remove num_voltages array
We can get n_voltages for each regulator from table_len of struct tps_info.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-08 17:15:09 +01:00
MyungJoo Ham dd32e11cdb regulator: max8952: removed unused mutex.
This patch removes a mutex that is never used in the driver.

Reported-by: Axel Lin
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-08 17:15:09 +01:00
Axel Lin e69c499790 regulator: Ensure enough enable time for max8649
Integer division may truncate the result, thus max8649_enable_time() may return
slightly shorter enable time. This patch fixes it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-08 17:15:08 +01:00
Axel Lin 99cd25ce10 regulator: 88pm8607: Fix off-by-one value range checking in the case of no id is matched
In the case of no id is matched, the variable i is equal to
ARRAY_SIZE(pm8607_regulator_info).

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-08 17:15:08 +01:00
Axel Lin 88585b83e0 regulator: tps65912: Remove unused define of TPS65912_MAX_REG_ID
Currently we define TPS65912_MAX_REG_ID as TPS65912_REG_LDO_10,
but TPS65912_REG_LDO_10 is not defined at all.
( It looks like a typo of TPS65912_REG_LDO10 )
Currently, TPS65912_MAX_REG_ID is not used in this driver,
it is safe to just remove it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-08 17:12:51 +01:00
Randy Dunlap 3a7d021b5e regulator: aat2870-regulator.c needs module.h
aat2870-regulator.c needs to include linux/module.h to fix multiple
build errors.

drivers/regulator/aat2870-regulator.c:145: error: 'THIS_MODULE' undeclared here (not in a function)
drivers/regulator/aat2870-regulator.c:230: warning: type defaults to 'int' in declaration of 'MODULE_DESCRIPTION'
drivers/regulator/aat2870-regulator.c:231: warning: type defaults to 'int' in declaration of 'MODULE_LICENSE'
drivers/regulator/aat2870-regulator.c:232: warning: type defaults to 'int' in declaration of 'MODULE_AUTHOR'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-08 17:12:51 +01:00
Linus Torvalds cfe22345ad Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6: (23 commits)
  regulator: Improve WM831x DVS VSEL selection algorithm
  regulator: Bootstrap wm831x DVS VSEL value from ON VSEL if not already set
  regulator: Set up GPIO for WM831x VSEL before enabling VSEL mode
  regulator: Add EPEs to the MODULE_ALIAS() for wm831x-dcdc
  regulator: Fix WM831x DCDC DVS VSEL bootstrapping
  regulator: Fix WM831x regulator ID lookups for multiple WM831xs
  regulator: Fix argument format type errors in error prints
  regulator: Fix memory leak in set_machine_constraints() error paths
  regulator: Make core more chatty about some errors
  regulator: tps65910: Fix array access out of bounds bug
  regulator: tps65910: Add missing breaks in switch/case
  regulator: tps65910: Fix a memory leak in tps65910_probe error path
  regulator: TWL: Remove entry of RES_ID for 6030 macros
  ASoC: tlv320aic3x: Add correct hw registers to Line1 cross connect muxes
  regulator: Add basic per consumer debugfs
  regulator: Add rdev_crit() macro
  regulator: Refactor supply implementation to work as regular consumers
  regulator: Include the device name in the microamps_requested_ file
  regulator: Increase the limit on sysfs file names
  regulator: Properly register dummy regulator driver
  ...
2011-08-01 14:05:46 -10:00
Liam Girdwood 424c3d4a2c Merge branch 'for-next' into for-linus 2011-08-01 18:25:06 +01:00
Dan Carpenter 6daa663dc4 regulator: Storing tps65912 error codes in u8
get_ctrl_reg() returns -EINVAL so the error handling won't work here
if reg is a u8.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-07-31 23:28:26 +02:00
Jin Park f7eb6c5e8e regulator: aat2870: Add AAT2870 regulator driver
Add regulator driver for AnalogicTech AAT2870.

Signed-off-by: Jin Park <jinyoungp@nvidia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-07-31 23:28:26 +02:00
Margarita Olaya 9260ad98dc tps65912: add regulator driver
The tps65912 consist of 4 DCDCs and 10 LDOs. The output voltages can be
configured by the SPI or I2C interface, they are meant to supply power
to the main processor and other components.

Signed-off-by: Margarita Olaya Cabrera <magi@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-07-31 23:28:22 +02:00
Mark Brown 88cda60e51 regulator: Improve WM831x DVS VSEL selection algorithm
Rather than using the maximum voltage we get passed to select the DVS
voltage to use remember the highest voltage we've ever seen. This improves
how the driver works when the consumer permits higher voltages than it
will ever selects in order to support the widest possible voltage range.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-28 10:20:49 +01:00
Mark Brown c439b8f46e regulator: Bootstrap wm831x DVS VSEL value from ON VSEL if not already set
If we don't have a DVS VSEL value already set when we start up then start
it off with the value currently being used for ON.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-28 10:20:49 +01:00
Mark Brown b47ba9fdd3 regulator: Set up GPIO for WM831x VSEL before enabling VSEL mode
If the VSEL is not in use prior to us starting up then we need to make
sure we initialise the GPIO before we push the DVS control to being done
by the GPIO.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-28 10:20:49 +01:00
Mark Brown 24b4315051 regulator: Add EPEs to the MODULE_ALIAS() for wm831x-dcdc
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-28 10:20:49 +01:00
Mark Brown a1b81dd3ff regulator: Fix WM831x DCDC DVS VSEL bootstrapping
Read our initial VSEL from the correct register.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-28 10:20:49 +01:00
Mark Brown 137a635430 regulator: Fix WM831x regulator ID lookups for multiple WM831xs
With multiple wm831x devices the device IDs used for the regulators will
not always be contiguous so simply taking the modulus is not sufficient
to look up the ID, we need to reverse the way the ID is generated.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-28 10:20:48 +01:00
Mark Brown 90923351d4 regulator: Convert tps65023 to use regmap API
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
2011-07-23 07:57:02 +01:00
Mark Brown 54abd335fd regulator: Fix argument format type errors in error prints
We need to dereference the pointers to print their values.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-22 11:46:57 +01:00
Axel Lin 1a6958e79f regulator: Fix memory leak in set_machine_constraints() error paths
Properly kfree rdev->constraints in all set_machine_constraints() error paths.
Also properly kfree rdev->constraints in regulator_register() error paths.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-22 11:43:59 +01:00
Mark Brown 89f425ed5b regulator: Make core more chatty about some errors
Prevent some head scratching by making the core log about some rare but
possible errors with invalid voltage ranges and modes being set.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-22 11:43:00 +01:00
Axel Lin 39aa9b6e3c regulator: tps65910: Fix array access out of bounds bug
For tps65910, the number of regulator is 13. ( ARRAY_SIZE(tps65910_regs) is 13)
For tps65911, the number of regulator is 12. ( ARRAY_SIZE(tps65911_regs) is 12)
If we are using this driver for tps65911,
we hit array access out of bounds bug in tps65910_probe() because
current implementation always assume the number of regulator is 13 and
thus it will access tps65911_regs[12].

Fix it by setting correct num_regulators for both chips in tps65910_probe(),
and allocated neccessay memory accordingly.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-22 11:41:57 +01:00
Axel Lin d04156bca6 regulator: tps65910: Add missing breaks in switch/case
Also add a default case in tps65910_list_voltage_dcdc to silence
'volt' may be used uninitialized in this function warning.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-22 11:39:13 +01:00
Axel Lin a3ee13ee77 regulator: tps65910: Fix a memory leak in tps65910_probe error path
Fix a memory leak if chip id is not matched.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-22 11:37:15 +01:00
Ambresh K af8b244f73 regulator: TWL: Remove entry of RES_ID for 6030 macros
RES_ID is only used in 4030, to send PBM singular message to control
the state of dedicated resources. In 6030, we don't have concept of PBM,
hence removing the definition of RES_ID (num) from macros.

Signed-off-by: Ambresh K <ambresh@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-22 11:30:05 +01:00
Donggeun Kim 6ff325a2d8 regulator: max8997: Fix setting inappropriate value for ramp_delay variable
The ramp_delay variable can be set lower than the desired value.
This patch fixes it.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: KyungMin Park <kyungmin.park@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08 19:14:58 +01:00
Axel Lin 90609503b7 regulator: db8500-prcmu: small fixes
Small cleanups for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08 19:14:57 +01:00
MyungJoo Ham 6e0414a5c8 regulator: max8997: remove dependency on platform_data pointer
The platform_data (pdata) may be pointing to __initdata section, which
may be free'd from the memory. The dependency on pdata in non-init
functions is removed in this patch to allow platform to declare
__initdata for platform data.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08 19:14:57 +01:00
Tushar Behera dbb48e7c3d regulator: MAX8997: Fix for divide by zero error
Currently, ramp_delay variable is used uninitialzed in
max8997_set_voltage_ldobuck which gets called through
regulator_register calls.

To fix the problem, in max8997_pmic_probe, ramp_delay initialization
code is moved before calls to regulator_register.

Cc: Liam Girdwood <lrg@ti.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08 19:14:57 +01:00
Jonghwan Choi e2cf3137aa regulator: max8952 - fix wrong gpio valid check
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08 19:14:57 +01:00
Mark Brown 5de705194e regulator: Add basic per consumer debugfs
Report the requested load and voltage for each consumer in debugfs when it
is enabled.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-04 17:09:28 +01:00
Mark Brown 7d51a0dbe5 regulator: Add rdev_crit() macro
No actual users but provide the macro so there's less surprise when it's
not there.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-06-09 19:14:35 +01:00
Mark Brown 3801b86aa4 regulator: Refactor supply implementation to work as regular consumers
Currently the regulator supply implementation is somewhat complex and
fragile as it doesn't look like standard consumers but is instead a
parallel implementation. This causes issues with locking and reference
counting.

Move the implementation over to using standard consumers to address this.
Rather than only notifying the supply on the first enable/disable we do so
every time the regulator is enabled or disabled, simplifying locking as we
don't need to hold a lock on the consumer we are about to enable.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-06-09 19:14:34 +01:00
Mark Brown e0eaedefda regulator: Include the device name in the microamps_requested_ file
We may have multiple devices requesting a supply with the same name so
include the device name in the generated filename for microamps_requested
to avoid duplicate files.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-06-09 19:14:29 +01:00
Mark Brown f5726ae33c regulator: Increase the limit on sysfs file names
With verbose filenames we can easily hit 32 characters.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-06-09 19:14:29 +01:00
Mark Brown c08957a2cf regulator: Properly register dummy regulator driver
Recent changes in the driver core appear to mean that the data structures
for the driver core are not fully initialised unless the driver is bound.
Make sure the driver core knows the dummy driver is in use by binding it
to a driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-06-08 20:15:34 +01:00
Colin Cross 7736f11dba regulator: twl-regulator: fix n_voltages for twl6030 variable LDOs
The n_voltages initializer for the TWL6030_ADJUSTABLE_LDO macro is
off by one, causing the the highest supported voltage to be
unreachable.  Setting the machine constraints to only allow the
highest voltage causes errors:

machine_constraints_voltage: VAUX3_6030: unsupportable voltage constraints
twl_reg twl_reg.39: can't register VAUX3_6030, -22
twl_reg: probe of twl_reg.39 failed with error -22

This patch fixes the off by one error.  Tested by setting
VAUX3_6030 to 3.3V.

Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-30 13:50:45 +01:00
Mark Brown 2ae3636b79 regulator: Use _cansleep() for WM8994 regulator GPIOs
The WM8994 regulator driver is perfectly happy if the GPIO used to enable
the regulator sleeps so call the appropriate GPIO API.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-30 11:56:58 +01:00
Mark Brown f21e0e81d8 regulator: Do bulk enables of regulators in parallel
In order to reduce the impact of ramp times rather than enabling the
regulators for a device in series use async tasks to run the actual
enables. This means that the delays which the enables implement can all
run in parallel, though it does mean that the order in which the
supplies come on may be unstable.

For super bonus fun points if any of the regulators are shared between
multiple supplies on the same device (as is rather likely) then this
will test our locking.  Note that in this case we only delay once for
each physical regulator so the threads shouldn't block each other while
delaying.

It'd be even nicer if we could coalesce writes to a shared enable registers
in PMICs but that's definitely future work, and it may also be useful
and is certainly more achievable to optimise out the parallelism if none
of the regulators implement ramp delays.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-30 11:56:57 +01:00
Axel Lin cb220d16f9 regulator: Fix _regulator_get_voltage if get_voltage callback is NULL
In the case of get_voltage callback is NULL, current implementation in
_regulator_get_voltage will return -EINVAL.

Also returns proper error if ret is negative value.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:30 +01:00
Graeme Gregory 4d94aee577 REGULATOR: TWL6025: add support to twl-regulator
Adding support for the twl6025. Major difference in the twl6025 is the
group functionality has been removed from the chip so this affects how
regulators are enabled and disabled.

The names of the regulators also changed.

The DCDCs of the 6025 are software controllable as well.

Since V1

Use the features variable passed via platform data instead of calling
global function.

Change the very switch like if statements to be a more readable
switch statement.

Since V2

twl6025 doesn't use remap so remove it from the macros.

Since V3

enable/disable functions for 4030/6030 were seperated upstream so rebase
on top of this. Change DCDC reference to SMPS as this is used in TRM.
Change list_voltage slightly to have less code.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:29 +01:00
Balaji T K 0ff3897d79 regulator: twl6030: do not write to _GRP for regulator disable
TWL6030: regulator is disabled via VREG_STATE
TWL4030: regulator is disabled via VREG_GRP
Since there is nothing common, split twlreg_enable similar to other regulator_ops

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:29 +01:00
Balaji T K f8c2940bcd regulator: twl6030: do not write to _GRP for regulator enable
TWL6030: regulator is enabled via VREG_STATE
TWL4030: regulator is enabled via VREG_GRP
Since there is nothing common, split twlreg_enable similar to other regulator_ops

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:29 +01:00
Jorge Eduardo Candelaria a320e3c3d6 regulator: tps65911: Add new chip version
The tps65911 chip introduces new features, including changes in
the regulator module.

- VDD1 and VDD2 remain unchanged.
- VDD3 is now named VDDCTRL and has a wider voltage range.
- LDOs are now named LDO1...8 and voltage ranges are sequential,
  making LDOs easier to handle.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:10 +01:00
Axel Lin 3c24019dde regulator: Fix off-by-one value range checking for mc13xxx_regulator_get_voltage
We use val as array index,
thus the valid value rangae for val should be 0 .. n_voltages-1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:10 +01:00
Fabio Estevam 6dc4efc6d5 regulator: mc13892: Fix voltage unit in test case.
Voltage values should be expressed in microvolts, not in milivolts.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:10 +01:00
Axel Lin ecb9c4f595 regulator: Remove MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros
In current implementation, the original macro implementation assumes the caller
pass the parameter starting from 1 (to match the register names in datasheet).
Thus we have unneeded plus one then minus one operations
when using MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros.

This patch removes these macros to avoid unneeded plus one then minus one operations
without reducing readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:10 +01:00
Mark Brown 4aa922c024 regulator: Only apply voltage constraints from consumers that set them
When applying the set_voltage() requests from consumers skip over those
consumers that haven't set anything, otherwise we'll come out with a
maximum voltage of zero.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:09 +01:00