Commit Graph

643 Commits (9d442061da08e679ec8e7c004fd0450e799a2af7)

Author SHA1 Message Date
Mark Brown 9d442061da regulator: fixed: Don't supply voltage change ops when no GPIO is given
Rather than replicating the core support for always on regulators use
a different set of ops with none of the enable related operations provided
when we don't have any ops. This ensures that we automatically pick up
any enhanced support for such regulators that the core has such as the
warnings about regulation constraints that can't be used.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:26 +01:00
Mark Brown c45bb35f8b regulator: fixed: Use devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:26 +01:00
Axel Lin 33426e9796 regulator: Use tps65912_get_voltage for both DCDCs and LDOs
Now tps65912_get_voltage_dcdc and tps65912_get_voltage_ldo has exactly the same
implementation. We can merge them to tps65912_get_voltage function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:25 +01:00
Axel Lin f72d643e87 regulator: Implement tps65912_list_voltage to be shared by both DCDCs and LDOs
Merge tps65912_list_voltage_dcdc and tps65912_list_voltage_ldo to
tps65912_list_voltage.  This change does not add too much complexity in
tps65912_list_voltage function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:25 +01:00
Axel Lin c8237f01db regulator: max8952: Simplify the logic to get vid[0|1] status
The syntax "(((vid >> 1) % 2) == 1)" is inefficient and also hard to read.
Use bitwidse AND operator instead.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:25 +01:00
Axel Lin 1f793ff258 regulator: Convert ab3100 to set_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:23 +01:00
Axel Lin ae713d394d regulator: Convert ab8500 to set_voltage_sel
Convert ab8500 to set_voltage_sel and then we can remove
ab8500_get_best_voltage_index function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:23 +01:00
Axel Lin 8300d2fde4 regulator: Convert pcf50633 to get_voltage_sel
Convert pcf50633 to get_voltage_sel and then we can remove
pcf50633_regulator_voltage_value function and move its implementation
to pcf50633_regulator_list_voltage.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:23 +01:00
Axel Lin 022dcdf083 regulator: pcf50633: Don't write to reserved bits of AUTO output voltage select register
The datasheet says 00000000 to 00101110 are reserved, and the min value of the
voltage setting is 1.8 V.
Thus don't write 0 to AUTO output voltage select register (address 1Ah).

Table 50. AUTOOUT - AUTO output voltage select register (address 1Ah) bit description[1]
Bit Symbol Access Description
7:0 auto_out R/W VO(prog) = 0.625 + auto_out × 0.025 V
eg. 00000000 to 00101110: reserved
00101111: 1.8 V (min)
01010011: 2.7 V
01101010: 3.275 V
01101011: 3.300 V
01101100: 3.325 V
01111111 : 3.800 V (max)
..... .....
11111110 : 3.800 V
11111111 : 3.800 V

This patch also fixes a bug in pcf50633_regulator_list_voltage:
In regulator core _regulator_do_set_voltage function:

        if (rdev->desc->ops->set_voltage) {
                ret = rdev->desc->ops->set_voltage(rdev, min_uV, max_uV,
                                                   &selector);

                if (rdev->desc->ops->list_voltage)
                        selector = rdev->desc->ops->list_voltage(rdev,
                                                                 selector);
                else
                        selector = -1;

The list_voltage call here takes the selector got from set_voltage callback.
Thus adding 0x2f to the index in pcf50633_regulator_list_voltage looks wrong to me.

e.g.
If min_uV < 1.8V, pcf50633_regulator_set_voltage sets 0 to selector.
For this case, adding 0x2f to the index in pcf50633_regulator_list_voltage is correct.
However, if min_uV == 1.8V, pcf50633_regulator_set_voltage sets 0x2f to selector.
Adding 0x2f to the index in pcf50633_regulator_list_voltage in this case is wrong.

What this patch does is:
The minimal voltage setting for AUTOOUT is 0x2f.
Thus for the case min_uV < 1.8, set the voltage setting to 1.8V by writting
0x2f to AUTOOUT register and set selector = 0x2f.
So we don't write the rserved range to AUTOOUT register.
Which means the possible range of AUTOOUT register value is 0x2f ~ 0xff.

We have no problem in regulator_get_voltage.
Since we won't write 0~0x2e to AUTOOUT register, we have no problem converting
the bits we read to voltage. The equation in auto_voltage_value works fine.

For list_voltage, we need to take into account the case selector is 0 ~ 0x2e
because the regulator core assumes the selector is starting from 0.
This patch returns 0 for the cases selector is 0 ~ 0x2e, which means
"this selector code can't be used on this system".

The regulator core iterates from 0 to n_voltages to find the small voltage
in the specific range. The n_voltages settings for AUTOOUT should be 128 now,
including the reserved range of AUTOOUT.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:22 +01:00
Sangbeom Kim 7e44bb83a7 regulator: Add support s5m8767 opmode operation
S5M8767A has 4 operation mode for BUCK/LDOs.
This patch can handle opmode for s5m8767a.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:22 +01:00
Linus Torvalds 34800598b2 ARM: driver specific updates
These are all specific to some driver. They are typically the platform
 side of a change in the drivers directory, such as adding a new driver
 or extending the interface to the platform. In cases where there is no
 maintainer for the driver, or the maintainer prefers to have the
 platform changes in the same branch as the driver changes, the patches
 to the drivers are included as well.
 
 A much smaller set of driver updates that depend on other branches
 getting merged first will be sent later.
 
 The new export of tegra_chip_uid conflicts with other changes in fuse.c.
 In rtc-sa1100.c, the global removal of IRQF_DISABLED conflicts with
 the cleanup of the interrupt handling of that driver.
 
 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIVAwUAT24/Y2CrR//JCVInAQLUdw//V4pKPuKempSe1kuD2MJfqldHwEVOlAUt
 of1IhLPAp8tpCscPDQ0yTy3ixquINg4jVnaDLL+E0quVbhLu6hlS2TYNKDEaVAAc
 cPUtVEUdja7Cfu4+bXX2vcWM/UyI6Ax7bsUUcwu4wFnEsjA6qOSu/jYY4jXDguHq
 ODGQSaSz0XQkfVBsWOlO8W/ejb0T3y+Ro3M/Vz5qJsMnZBR8R/i9aUYDFGiZ1GTn
 3APHB7ALz6SS5/9SJS65PH16poBexcea5gyb3gnR1yt30kRmMTOAWrLC+JdyqFaO
 7LHXW514+D1QbWV2gwNCWhQSLbgp9PWq/FXJtq4StW7tgNbDbj1d1Dc1GX+fvk2M
 bBih1yWoIVx6CZWFBQ7gsbqVHUZ/sW2fo76yb8K5dVPXx0fL5lEkv5Xwk3gxbqt5
 lPE8+z+jiL5D+8RK1DZQu1PfxzaMwDZkJkVoGLCcdyM7FvnX3LIYf2bqbcp+zrQL
 lz9aht9C1k12R7feOX8emlluNd3eaKv/6jLrOasUP5wrJDam5hesSD5mLeTlAdxZ
 U8XJe4L24dFv15/yrMCzcyes5EmB3aS3nfb9TsSfq22IOKo2PCQLCnL6Z/rfM+1p
 mGu7BqdBnx3/8NkHdUrttMWjuPNh77MfPM6RO/E+TaBLHtwvKoLWJAHAYQNmt2xH
 IbGcyorBD5s=
 =pQ3X
 -----END PGP SIGNATURE-----

Merge tag 'drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull "ARM: driver specific updates" from Arnd Bergmann:
 "These are all specific to some driver.  They are typically the
  platform side of a change in the drivers directory, such as adding a
  new driver or extending the interface to the platform.  In cases where
  there is no maintainer for the driver, or the maintainer prefers to
  have the platform changes in the same branch as the driver changes,
  the patches to the drivers are included as well.

  A much smaller set of driver updates that depend on other branches
  getting merged first will be sent later.

  The new export of tegra_chip_uid conflicts with other changes in
  fuse.c.  In rtc-sa1100.c, the global removal of IRQF_DISABLED
  conflicts with the cleanup of the interrupt handling of that driver.

  Signed-off-by: Arnd Bergmann <arnd@arndb.de>"

Fixed up aforementioned trivial conflicts.

* tag 'drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (94 commits)
  ARM: SAMSUNG: change the name from s3c-sdhci to exynos4-sdhci
  mmc: sdhci-s3c: add platform data for the second capability
  ARM: SAMSUNG: support the second capability for samsung-soc
  ARM: EXYNOS: add support DMA for EXYNOS4X12 SoC
  ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1
  ARM: EXYNOS: Enable MDMA driver
  regulator: Remove bq24022 regulator driver
  rtc: sa1100: add OF support
  pxa: magician/hx4700: Convert to gpio-regulator from bq24022
  ARM: OMAP3+: SmartReflex: fix error handling
  ARM: OMAP3+: SmartReflex: fix the use of debugfs_create_* API
  ARM: OMAP3+: SmartReflex: micro-optimization for sanity check
  ARM: OMAP3+: SmartReflex: misc cleanups
  ARM: OMAP3+: SmartReflex: move late_initcall() closer to its argument
  ARM: OMAP3+: SmartReflex: add missing platform_set_drvdata()
  ARM: OMAP3+: hwmod: add SmartReflex IRQs
  ARM: OMAP3+: SmartReflex: clear ERRCONFIG_VPBOUNDINTST only on a need
  ARM: OMAP3+: SmartReflex: Fix status masking in ERRCONFIG register
  ARM: OMAP3+: SmartReflex: Add a shutdown hook
  ARM: OMAP3+: SmartReflex Class3: disable errorgen before disable VP
  ...

Conflicts:
	arch/arm/mach-tegra/Makefile
	arch/arm/mach-tegra/fuse.c
	drivers/rtc/rtc-sa1100.c
2012-03-27 16:41:24 -07:00
Arnd Bergmann 511f1cb6d4 Merge tag 'regulator-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into next/drivers
The pxa regulator branch removes the bq24022 driver, while a lot of
other regulator drivers got added in the regulator tree. This
resolves the trivial conflicts by merging in the regulator patches
that are already merged into v3.4.

Conflicts:
	drivers/regulator/Kconfig
	drivers/regulator/Makefile

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2012-03-24 11:29:58 +00:00
Linus Torvalds d15d76448b regulator: Updates for 3.4
This has been a fairly quiet release from a regulator point of view, the
 only real framework features added were devm support and a convenience
 helper for setting up fixed voltage regulators.
 
 We also added a couple of drivers (but will drop the BQ240022 driver via
 the arm-soc tree as it's been replaced by the more generic
 gpio-regulator driver) and Axel Lin continued his relentless and
 generally awesome stream of fixes and cleanups.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPZ2paAAoJEBus8iNuMP3d4EIP/3bUD9zVwwC5/+aedwtSoKGC
 eJXqdkJFYkEqLaeU5eobT79NFwzB/7JjVw7CMc/Z+9pXGwqSdA0T/k4j0EaTZWdo
 SMqPfXA2Ia7c67pixdZ32GcYuT53iiBj9ecWozM8LaOyQz0oif127e1OF6LGtQzC
 aWofP58MKrzDc+hmLixswgQVBKR5EDHna9XX7KnEL5ZdfRoyFsKkj752MJD1O6QN
 79+7G0D9uKYsTf5IamYdG9x/kKRvtRlFAXsb7oNY9Z25PydXnkys0SED6isgr7rr
 zgP+Q644fM09H68QgHuuJfsbDSrc0PjvLoOwISrDEQs4LH6usZLlTdZPQoqPc5uV
 kB5oodsz7tb8NCZW7Y8xc0rYrEwaQKpvTDoZ93V9Zp3qyzxexNxm4akBRRUsFj/0
 MxzyW+F81BxA35FIiRD55yZZ/U7ddoEzjea3tSvfGwDG1jMcV18t5G3LBThTAIIF
 kvo4+xM6a8TPmGdNRSoEyO9vHYob/QzQ2zb7Pujf2SQpp/ULi7DMdNnbp0K/UYxt
 pxwsj9IFR1rwPoHWwSfHZHWbioCeUkXwzf0ar4ydmg1U8AxQRPI2YNqVXP/BTPj6
 GJ6ksHkBK5eK/mcob1s8t7nZDTEY5fiQw3lbQwM4mJaJIO6vza8RrpAcAeICI9FX
 dLZmKQlMZ7vLLP6dSPx2
 =fbBu
 -----END PGP SIGNATURE-----

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

Pull regulator updates for 3.4 from Mark Brown:
 "This has been a fairly quiet release from a regulator point of view,
  the only real framework features added were devm support and a
  convenience helper for setting up fixed voltage regulators.

  We also added a couple of drivers (but will drop the BQ240022 driver
  via the arm-soc tree as it's been replaced by the more generic
  gpio-regulator driver) and Axel Lin continued his relentless and
  generally awesome stream of fixes and cleanups."

* tag 'regulator-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (93 commits)
  regulator: Fix up a confusing dev_warn when DT lookup fails
  regulator: Convert tps6507x to set_voltage_sel
  regulator: Refactor tps6507x to use one tps6507x_pmic_ops for all LDOs and DCDCs
  regulator: Make s5m8767_get_voltage_register always return correct register
  regulator: s5m8767: Check pdata->buck[2|3|4]_gpiodvs earlier
  regulator: tps65910: Provide settling time for DCDC voltage change
  regulator: Add Anatop regulator driver
  regulator: Simplify implementation of tps65912_get_voltage_dcdc
  regulator: Use tps65912_set_voltage_sel for both DCDCx and LDOx
  regulator: tps65910: Provide settling time for enabling rails
  regulator: max8925: Use DIV_ROUND_UP macro
  regulator: tps65912: Use simple equations to get register address
  regulator: Fix the logic of tps65910_get_mode
  regulator: Merge tps65217_pmic_ldo234_ops and tps65217_pmic_dcdc_ops to tps65217_pmic_ops
  regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current
  regulator: Use array to store dcdc_range settings for tps65912
  regulator: Rename s5m8767_convert_voltage to s5m8767_convert_voltage_to_sel
  regulator: tps6524x: Remove unneeded comment for N_REGULATORS
  regulator: Rename set_voltage_sel callback function name to *_sel
  regulator: Fix s5m8767_set_voltage_time_sel calculation value
  ...
2012-03-21 10:34:56 -07:00
Arnd Bergmann f907ab06bb Merge branch 'next/fixes-non-critical' into next/drivers
Conflicts:
	arch/arm/mach-lpc32xx/clock.c
	arch/arm/mach-pxa/pxa25x.c
	arch/arm/mach-pxa/pxa27x.c

The conflicts with pxa are non-obvious, we have multiple branches
adding and removing the same clock settings. According to
Haojian Zhuang, removing the sa1100 rtc dummy clock is the correct
fix here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2012-03-20 22:42:24 +00:00
Linus Torvalds 4a52246302 driver core merge for 3.4-rc1
Here's the big driver core merge for 3.4-rc1.
 
 Lots of various things here, sysfs fixes/tweaks (with the nlink breakage
 reverted), dynamic debugging updates, w1 drivers, hyperv driver updates,
 and a variety of other bits and pieces, full information in the
 shortlog.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iEYEABECAAYFAk9neCsACgkQMUfUDdst+ylyQwCfY2eizvzw5HhjQs8gOiBRDADe
 yrgAnj1Zan2QkoCnQIFJNAoxqNX9yAhd
 =biH6
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core patches for 3.4-rc1 from Greg KH:
 "Here's the big driver core merge for 3.4-rc1.

  Lots of various things here, sysfs fixes/tweaks (with the nlink
  breakage reverted), dynamic debugging updates, w1 drivers, hyperv
  driver updates, and a variety of other bits and pieces, full
  information in the shortlog."

* tag 'driver-core-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (78 commits)
  Tools: hv: Support enumeration from all the pools
  Tools: hv: Fully support the new KVP verbs in the user level daemon
  Drivers: hv: Support the newly introduced KVP messages in the driver
  Drivers: hv: Add new message types to enhance KVP
  regulator: Support driver probe deferral
  Revert "sysfs: Kill nlink counting."
  uevent: send events in correct order according to seqnum (v3)
  driver core: minor comment formatting cleanups
  driver core: move the deferred probe pointer into the private area
  drivercore: Add driver probe deferral mechanism
  DS2781 Maxim Stand-Alone Fuel Gauge battery and w1 slave drivers
  w1_bq27000: Only one thread can access the bq27000 at a time.
  w1_bq27000 - remove w1_bq27000_write
  w1_bq27000: remove unnecessary NULL test.
  sysfs: Fix memory leak in sysfs_sd_setsecdata().
  intel_idle: Revert change of auto_demotion_disable_flags for Nehalem
  w1: Fix w1_bq27000
  driver-core: documentation: fix up Greg's email address
  powernow-k6: Really enable auto-loading
  powernow-k7: Fix CPU family number
  ...
2012-03-20 11:16:20 -07:00
Mark Brown 4992fa1fd4 TWL specific changes, cross-merged with OMAP due to arch/arm wanting to
use the new ability to override the voltage set and get operations to
 support the in-CPU voltage management.  The other changes are minor
 fixes, the addition of a few new regulators and device tree support.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPXQiBAAoJEBus8iNuMP3dhiMP/2z1ImskdfEg+nT43nX4qjge
 MFiHzynz13X4VvOB3+rE0OsBmTjRdjpZzsND3g673D6RuT2mfSAj270AbsJ9bZNR
 Fz8c/RAv2LWG5GKNCB8cWFoxVxk7xhrpE31a6JYV10HBhxmg/6ESaKs63W6MKWQk
 NSfQdE2PujrCIYBwqCYP4knk+Gx4R5GBMol8hXjIkmcSPCnZ71/o6UMu0OsJ6e37
 LKwkBT8zY72HhmBrWNmHXrH94dCYv9XjTtOfjhF97+UAFAuVcztXUq4ZKFNUPuNN
 QLAftkoKPXbSUpqvmmMCJQcNUMvpEGFh42JLZO1S8HN5Mb5+CPE2oS62QNtbrbrV
 cwxpWUse823qJSHXwCWS4ai9M3fO/1tWEfo4nWauKyAgXLV/udF0nBVnSjv72Agg
 cJsmVNOdwLUb89izD2Q05gvObfzPLxjFrGMTHZ1p+h5rgIdQq6ttx4yoZIlmUMqy
 eBFWofYRbxS3UDVteBNZGuAb5AMFuMPrlmluTGWftY41d8mgFLyreNoFReEbeiDP
 ZRpulqoOll1KYdTwg3BbgfS/x8FsSdtH8LBP2BIsmZ6q7hG7CEoG/OOk4ex4vuMx
 AgUV8uRfQ7HjW5NkAX6kOvm3IH6yUOq7uysifKvs+iBRjT2kP0iw3OThdImHDetq
 kjIFEOq+og9NNJ7fLFAB
 =EHNp
 -----END PGP SIGNATURE-----

Merge tag 'topic/twl' into regulator-next

TWL specific changes, cross-merged with OMAP due to arch/arm wanting to
use the new ability to override the voltage set and get operations to
support the in-CPU voltage management.  The other changes are minor
fixes, the addition of a few new regulators and device tree support.
2012-03-19 17:17:32 +00:00
Mark Brown 115e4bfd5b Merge remote-tracking branch 'regulator/topic/supply' into regulator-next 2012-03-18 21:39:19 +00:00
Mark Brown c02f935f5f Merge remote-tracking branches 'regulator/topic/devm' and 'regulator/topic/stub' into regulator-next 2012-03-18 21:38:28 +00:00
Mark Brown c592c761a3 Merge remote-tracking branch 'regulator/topic/stub' into regulator-next 2012-03-18 21:38:20 +00:00
Mark Brown 63236f4038 Merge remote-tracking branch 'regulator/topic/drivers' into regulator-next 2012-03-18 21:37:37 +00:00
Rajendra Nayak 16fbcc3b11 regulator: Fix up a confusing dev_warn when DT lookup fails
of_parse_phandle() returns NULL either if the property name
itself does not exist or if it (exists and) does not
reference a valid phandle.
Giving out a warn like the one below (that the property references
an invalid phandle) can be confusing when the property itself
does not exist in the node.
Fix it with a more sensible message and make it a dev_dbg instead
of a dev_warn.

Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-16 19:26:09 +00:00
Axel Lin ca61a7bfcd regulator: Convert tps6507x to set_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 14:13:17 +00:00
Axel Lin f2933d3331 regulator: Refactor tps6507x to use one tps6507x_pmic_ops for all LDOs and DCDCs
All the callback functions implementation for DCDCx and LDOx are very similar,
I think it is ok to use one tps6507x_pmic_ops for all LDOs and DCDCs.
This refactor removes a couple of duplicated code.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 14:13:17 +00:00
Axel Lin 0a41685fd5 regulator: Make s5m8767_get_voltage_register always return correct register
Check s5m8767->buck[2|3|4]_gpiodvs status in s5m8767_get_voltage_register
and return correct register accordingly.

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-03-14 14:10:41 +00:00
Axel Lin 6c4efe2474 regulator: s5m8767: Check pdata->buck[2|3|4]_gpiodvs earlier
If we need to ensure only one of the buck[2|3|4]_gpiodvs can be specificed,
check them earlier.

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-03-14 14:10:30 +00:00
Laxman Dewangan 18039e0f16 regulator: tps65910: Provide settling time for DCDC voltage change
Settling time is require when there is dcdc rail's voltage change.
Returning proper delay time for dcdc voltage change to settle down
the output voltage to new value.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 12:37:41 +00:00
Ying-Chun Liu (PaulLiu) e3e5aff714 regulator: Add Anatop regulator driver
Anatop is an integrated regulator inside i.MX6 SoC.
There are 3 digital regulators which controls PU, CORE (ARM), and SOC.
And 3 analog regulators which controls 1P1, 2P5, 3P0 (USB).
This patch adds the Anatop regulator driver.

Signed-off-by: Nancy Chen <Nancy.Chen@freescale.com>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 12:37:35 +00:00
Axel Lin c567556e75 regulator: Simplify implementation of tps65912_get_voltage_dcdc
Call tps65912_get_sel_register instead of duplicating the same code.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 12:37:23 +00:00
Axel Lin 831c986f5d regulator: Use tps65912_set_voltage_sel for both DCDCx and LDOx
commit 42b5ef "regulator: tps65912: Use simple equations to get register address"
uses tps65912_get_sel_register to replace tps65912_get_dcdc_sel_register
and tps65912_get_ldo_sel_register.

Now tps65912_set_voltage_dcdc_sel and tps65912_set_voltage_ldo_sel has exactly
the same implementation. Merge them to tps65912_set_voltage_sel function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 12:37:22 +00:00
Laxman Dewangan 0651eed5e0 regulator: tps65910: Provide settling time for enabling rails
There is settling time for each rails when it is switched to
ON. Implementing enable time for returning proper settling time
of regulator rails when it is enabled.
Filling the on-time for each rail as per tps65910/tps65911
datasheets.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-13 23:22:45 +00:00
Axel Lin 5db6d09a2b regulator: max8925: Use DIV_ROUND_UP macro
Use DIV_ROUND_UP macro for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-13 23:19:40 +00:00
Axel Lin 42b5efe4f9 regulator: tps65912: Use simple equations to get register address
The address of ctrl and sel registers can be calculated by simple equations.
This patch simplifies the implementation in tps65912_get_ctrl_register and
implements tps65912_get_sel_register to replace tps65912_get_dcdc_sel_register
and tps65912_get_ldo_sel_register.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-13 23:19:34 +00:00
Axel Lin 585993932c regulator: Fix the logic of tps65910_get_mode
We actually clear LDO_ST_ON_BIT for standby mode in tps65910_set_mode.
Fix the logic in tps65910_get_mode.

Supply state (EEPROM bits):
ST[1:0] = 00 : Off
ST[1:0] = 01 : On high power (ACTIVE)
ST[1:0] = 10 : Off
ST[1:0] = 11 : On low power (SLEEP)

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-13 23:18:03 +00:00
Mark Brown 04bf30115f regulator: Support driver probe deferral
If we fail to locate a requested regulator return -EPROBE_DEFER. If drivers
pass this error code through to their caller (which they really should)
then this will ensure that the probe is retried later when further devices
become available.  In the unusual case where a driver doesn't want this
it can override the default behaviour.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-12 10:38:47 -07:00
Axel Lin fc56911bc6 regulator: Merge tps65217_pmic_ldo234_ops and tps65217_pmic_dcdc_ops to tps65217_pmic_ops
Most callback functions implementation for tps65217_pmic_ldo234_ops and
tps65217_pmic_dcdc_ops are the same except the rid range checking.

This patch uses tps65217_pmic_ops for all DCDCx, LDO2, LDO3, and LDO4.
And rework tps65217_pmic_set_voltage to make it can be called for
DCDCx, LDO2, LDO3, and LDO4.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-12 10:50:46 +00:00
Axel Lin dce7304f4b regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current
DIV_ROUND_CLOSEST performs the computation (x + d/2)/d with better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-12 10:48:18 +00:00
Axel Lin 85c5d86d0e regulator: Use array to store dcdc_range settings for tps65912
Then we can use the regulator id as array index to access the array.
This change makes the code simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:35 +00:00
Axel Lin 5b5e977ce7 regulator: Rename s5m8767_convert_voltage to s5m8767_convert_voltage_to_sel
This function finds the smallest voltage that falls within the specified range,
and then returns the selector. This rename makes the intention more clear.

Also remove unneeded local variables min_vol and max_vol in s5m8767_set_voltage
and s5m8767_set_voltage_buck.

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-03-11 20:49:35 +00:00
Axel Lin 4d984d1cd8 regulator: tps6524x: Remove unneeded comment for N_REGULATORS
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:34 +00:00
Axel Lin 94732b97c3 regulator: Rename set_voltage_sel callback function name to *_sel
This change improves readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:33 +00:00
Sangbeom Kim 0f8b9c7744 regulator: Fix s5m8767_set_voltage_time_sel calculation value
In the s5m8767_set_voltage_time_sel function, divisor unit is wrong.
ramp_delay is usec unit. So 1000 should be multiplied.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:29 +00:00
Thierry Reding 394ee3d5be regulator: tps6586x: fix typo in debug message
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:29 +00:00
Laxman Dewangan f30b0716fe regulator: tps65910: Sleep off rails when ext sleep configured
Keep the rails OFF in sleep mode only when the rails are
controlled by external sleep control.
The devices tps65910 and tps65911, both has the sleep input.
The tps65911's sleep input is not same as tps65910's EN3 and hence
taking care of SLEEP input as separate external sleep control input.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:28 +00:00
Axel Lin 844775ef98 regulator: Simplify the implementation of tps65912_get_voltage_dcdc
Call tps65912_list_voltage_dcdc instead of duplicating the same code.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:55 +00:00
Axel Lin 21c9e5f19e regulator: max8649: Use DIV_ROUND_UP macro to calculate selector
Use DIV_ROUND_UP macro for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:54 +00:00
Axel Lin f08f5de54f regulator: Silence error message in max8998_pmic_probe
This looks like a mistakenly committed debug logging.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:54 +00:00
Axel Lin 535bca2037 regulator: Remove unused i2c variable in s5m8767_pmic_probe
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-03-11 20:48:53 +00:00
Axel Lin 2fe4e0259d regulator: tps65217: Use DIV_ROUND_UP macro to calculate selector
Use DIV_ROUND_UP macro for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:52 +00:00
Axel Lin ae76e8307f regulator: da903x: Use DIV_ROUND_UP macro to calculate selector
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:52 +00:00
Axel Lin e9a15c8cad regulator: wm8400: Use DIV_ROUND_UP macro to calculate selector
Use DIV_ROUND_UP macro for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:51 +00:00