Commit Graph

191 Commits

Author SHA1 Message Date
Axel Lin 0bdc81e4e9 regulator: core: Properly handle the case min_uV < rdev->desc->min_uV in map_voltage_linear
Properly handle the case if the specified min_uV is less than the voltage given
by the lowest selector.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-08 07:15:55 +08:00
Linus Torvalds ac1806572d regulator updates for 3.5
The major thing here is the addition of some helpers to factor code out
 of drivers, making a fair proportion of regulators much more just data
 rather than code which is nice.
 
 - Helpers in the core for regulators using regmap, providing generic
   implementations of the enable and voltage selection operations which
   just need data to describe them in the drivers.
 - Split out voltage mapping and voltage setting, allowing many more
   drivers to take advantage of the infrastructure for selectors.
 - Loads and loads of cleanups from Axel Lin once again, including many
   changes to take advantage of the above new framework features
 - New drivers for Ricoh RC5T583, TI TPS62362, TI TPS62363, TI TPS65913,
   TI TWL6035 and TI TWL6037.
 
 Some of the registration changes to support the core refactoring caused
 so many conflicts that eventually topic branches were abandoned for this
 release.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJPuhn4AAoJEBus8iNuMP3d6m4P/0gNiGbTwDlOgU/mPDyW2jJc
 xqvABzlOIQbI28/dgFYO/nA9YWW7VxpEaAPlkg4auk4wQ9tEyEjEqlOCfzymMetY
 0k6L4n8LqFsbMAeNQbFPbW7PpWp59oI97J9afJI4kEJmHmOlmlL9U82/TzUFfGrA
 yiPlzue+DotKB7FjsymLMbLyeFoiMSOIjVDk8OTs0u1EqeOo4nJG2ODLa+yGo+QW
 0yqQExEdIp28WXbkZQtmsOmj2V/uhkKAv2i2PDT2TmlduhNdCGxJsgZIiZCl1R4c
 vwirbfb+v93HAxvADdgj8eVdLJXQ0oItxr2ohKt8AgXIBrUJBsMkCQGvulZjRb+a
 /A/7Ea3o7HI+PQx4aIP0yGA/eBwbzo/cmBxU+KGzTA9Mov0fnK1kkUs6gfrYBdli
 U/TcMizDa1539BrKBIF2gmlRCKx8YD9ic27Zl1x4i5cgAP1gdYgdBYBybKHMpo2+
 9Xp1R9C8FvvgytIqJ3QQ34tRomZyQ5iUaIuIuAosoQ6iuF33EQ6I0FvHcIe74iOi
 zcu62ZPiuSwg1di9PrTERLcbrS81lvXpOWt5+EorzqoGXWzVIGoTh1F2kWEEMhaD
 Q6V5iE03VC0k3tj/MmtTiVkyhNkRElQDtekE9sfm15pdVnpu/+b+iicWJa7QFbZQ
 MybS0BBFQKhJXUDttKtS
 =UR7s
 -----END PGP SIGNATURE-----

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

Pull regulator updates from Mark Brown:
 "The major thing here is the addition of some helpers to factor code
  out of drivers, making a fair proportion of regulators much more just
  data rather than code which is nice.

  - Helpers in the core for regulators using regmap, providing generic
    implementations of the enable and voltage selection operations which
    just need data to describe them in the drivers.
  - Split out voltage mapping and voltage setting, allowing many more
    drivers to take advantage of the infrastructure for selectors.
  - Loads and loads of cleanups from Axel Lin once again, including many
    changes to take advantage of the above new framework features
  - New drivers for Ricoh RC5T583, TI TPS62362, TI TPS62363, TI
    TPS65913, TI TWL6035 and TI TWL6037.

  Some of the registration changes to support the core refactoring
  caused so many conflicts that eventually topic branches were abandoned
  for this release."

* tag 'regulator-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (227 commits)
  regulator: tps65910: use of_node of matched regulator being register
  regulator: tps65910: dt: support when "regulators" node found
  regulator: tps65910: add error message in case of failure
  regulator: tps62360: dt: initialize of_node param for regulator register.
  regulator: tps65910: use devm_* for memory allocation
  regulator: tps65910: use small letter for regulator names
  mfd: tpx6586x:  Depend on regulator
  regulator: regulator for Palmas Kconfig
  regulator: regulator driver for Palmas series chips
  regulator: Enable Device Tree for the db8500-prcmu regulator driver
  regulator: db8500-prcmu: Separate regulator registration from probe
  regulator: ab3100: Use regulator_map_voltage_iterate()
  regulator: tps65217: Convert to set_voltage_sel and map_voltage
  regulator: Enable the ab8500 for Device Tree
  regulator: ab8500: Split up probe() into manageable pieces
  regulator: max8925: Remove check_range function and max_uV from struct rc5t583_regulator_info
  regulator: max8649: Remove unused check_range() function
  regulator: rc5t583: Remove max_uV from struct rc5t583_regulator_info
  regulator: da9052: Convert to set_voltage_sel and map_voltage
  regulator: max8952: Use devm_kzalloc
  ...
2012-05-21 16:49:16 -07:00
Mark Brown b1a868310e regulator: core: Don't open code _regulator_is_enabled()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-14 15:25:19 +01:00
Mark Brown e81dba85c6 regulator: core: Release regulator-regulator supplies on error
If we fail while registering a regulator make sure we release the supply
for the regulator if there is one.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Cc: stable@vger.kernel.org
2012-05-14 09:31:35 +01:00
Axel Lin ccfcb1c3cf regulator: core: Ensure simple linear voltage mappings falls within the specified range
Integer division may truncate the result.
Use DIV_ROUND_UP to ensure simple linear voltage mappings falls within the
specified range.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-14 09:11:34 +01:00
Mark Brown bca7bbfff3 regulator: core: Allow drivers to set simple linear voltage maps as data
A lot of regulator hardware maps selectors on to voltages with a simple
linear mapping function

    selector = base + (selector * step size)

Provide off the shelf list_voltage() and map_voltage() operations which
use new min_uV and uV_step members in the regulator_desc to implement
this function.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-12 11:11:32 +01:00
Mark Brown e843fc4616 regulator: core: Allow regulators to provide a voltage to selector mapping
In order to allow more drivers to factor things out into data allow
drivers to provide a mapping function to convert voltages into selectors.
This allows any driver to use set_voltage_sel(). The existing mapping
based on iterating over list_voltage() is provided as an operation which
can be assigned to the new map_voltage() function though for ease of
transition it is treated as the default.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-12 11:11:23 +01:00
Mark Brown 178e43aef2 Merge remote-tracking branches 'regulator/topic/core', 'regulator/topic/regmap' and 'regulator/topic/register' into regulator-next 2012-05-12 11:09:47 +01:00
Mark Brown dcf701125e regulator: core: Warn on missing struct device
The core really wants a struct device to be supplied for regulators and
there's no reason this should be impossible so provide one so complain
if we didn't get one.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-10 10:48:37 +01:00
Mark Brown 968c2c1707 regulator: Actually free the regulator in devm_regulator_put()
It turns out that (quite surprisingly) devres_destroy() only undoes the
devres mapping, it doesn't destroy the underlying resource, meaning that
anything using devm_regulator_put() would leak. While we wait for the new
devres_release() which does what we want to get merged open code it in
devm_regulator_put().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-07 13:14:44 +01:00
Mark Brown 6492bc1b1a regulator: core: Optimise enable/disable path for always on regulators
If a regulator is always on for any reason then cache that when the
consumer is created and use it to optimise away the need to take locks
or recurse up the supply tree when consumers do enable or disable calls.
The scheduling of asynchronous work for bulk enables is also skipped.

We don't actually check if the device physically supports control on the
basis that constraints allowing status changes on physically always on
regulators are nonsensical anyway.

This is a very common pattern in hardware - it's normal to have some
power supplies that have either no software control or are critical to
system function - so many systems should be able to benefit.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-20 10:12:38 +01:00
Axel Lin 854ccbaee7 regulator: core: Add checking set_mode callback in regulator_set_optimum_mode
regulator_set_optimum_mode needs set_mode to properly work.
Add checking for set_mode callback in case it may be not implemented.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16 19:55:08 +01:00
Mark Brown cd6dffb4c6 regulator: core: Provide standard enable operations for regmap users
Since the enable(), disable() and is_enabled() operations for most regmap
based regulators come down to reading and updating a single register bit
we can factor out the code and allow these drivers to just define which
bit to update using the enable_reg and enable_mask fields in their desc
and then use operations provided by the core.

As well as the code saving this opens the door to future optimisation of
the bulk operations - if the core can realise that we are updating a
single register for multiple regulators then it should be able to combine
these updates into a single physical operation.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:52:42 +01:00
Mark Brown 4ab5b3d92c regulator: core: Provide regmap based voltage_sel operations
Since the voltage selector operations are intended to directly map a
bitfield in the device register map into regulator API operations the
code for implementing them is usually very standard we can save some
code by providing standard implementations for devices using the regmap
API.

Drivers using regmap can pass their regmap in in the regmap_config
struct, set vsel_reg and vsel_mask in their regulator_desc and then
use regulator_{get,set}_voltage_sel_regmap in their ops. This saves
a small amount of code from each driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:52:03 +01:00
Mark Brown 65b19ce6c2 regulator: core: Allow drivers to pass in a regmap
Since many regulators use regmap for register I/O and since there's quite
a few very common patterns in the code allow drivers to pass in a regmap
to the core for use in generic code.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16 19:51:53 +01:00
Axel Lin 8ac0e95d64 regulator: core: Support setting suspend_[mode|voltage] if set_suspend_[en|dis]able is NULL
In current implementation, to support set_suspend_voltage and set_suspend_mode
the regulator code needs the regulator driver to implement both
set_suspend_enable and set_suspend_disable callbacks.

This patch removes this limitation. In the case set_suspend_enable and/or
set_suspend_disable are NULL, the regulator code assumes we don't need to
do any thing to enable/disable regulator when system is suspended and
then will continue to handle set_suspend_mode and set_suspend_voltage.

Currently the regulator core creates suspend state related sysfs entries only
if both set_suspend_enable and set_suspend_disable callbacks are not NULL.
A side-effect of this change is that the regulator core will create suspend
state related sysfs entries unconditionally now.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16 10:20:16 +01:00
Axel Lin 3f24f5ada6 regulator: core: Fix getting input_uV when supplied by another regulator
When supplied by another regulator, returns the supply regulator's output
voltage for inpu_uV.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16 10:19:30 +01:00
Mark Brown 32c8fad438 regulator: Appease smatch in regulator_register()
We don't support missing configs at all so segfaulting isn't that bad
but since we've got checks in the code move the dereference after them.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-11 10:19:12 +01:00
Mark Brown b920eb41a8 Linux 3.4-rc2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iQEcBAABAgAGBQJPgOpXAAoJEHm+PkMAQRiG8eUIAJ3Hjo0o5hqzxol8LWHDGF8s
 3h59qwRtts82u2psStZULPLbBzw6yjn8U5Mcrh7pffwCG2BzBL5rXcmXfvoPaET3
 TjylIj986Jv+jwZyuyZcLzYyoUtgjtq7hnt4tgVVEPlexYs7LxUl8vO8QjxT+bVO
 7eKgzLsXlBC9kw4P5M7kOBQ9NE5vmEcKf+fB3Hu3DqfVJtw9Lb7EeDQj/cbQsGqI
 vavSxe7lMTPsgMP2+hRz4txGTDJNRazkO2BdwfYrcNwTSa8tfBFlamww3y4+eJtq
 MFQfdNxQpumh2++T4IC2i/nLaawH7kWj2EdaRCRLMy9hVlb/v8/wcgd+1nfLkU8=
 =0on9
 -----END PGP SIGNATURE-----

Merge tag 'v3.4-rc2' into regulator-drivers

Linux 3.4-rc2 contains some fixes that further patches depend upon.
2012-04-10 09:52:59 +01:00
Mark Brown c172708d38 regulator: core: Use a struct to pass in regulator runtime configuration
Rather than adding new arguments to regulator_register() every time we
want to add a new bit of dynamic information at runtime change the function
to take these via a struct. By doing this we avoid needing to do further
changes like the recent addition of device tree support which required each
regulator driver to be updated to take an additional parameter.

The regulator_desc which should (mostly) be static data is still passed
separately as most drivers are able to configure this statically at build
time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-09 12:37:09 +01:00
Axel Lin eba41a5e8c regulator: Support set_voltage_time_sel for drivers implement set_voltage
In currently implementation of _regulator_do_set_voltage, set_voltage_time_sel will
only be called if set_voltage_sel is implemented.

set_voltage_time_sel actually only needs get_voltage_sel to get old_selector.

This patch makes regulator core support set_voltage_time_sel for drivers
implement either set_voltage or set_voltage_sel.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-05 11:36:20 +01:00
Linus Torvalds 4a1e8ebc5e regulator: Fixes for -rc1
A bunch of smallish fixes that came up during the merge window as
 things got more testing - even more fixes from Axel, a fix for error
 handling in more complex systems using -EPROBE_DEFER and a couple of
 small fixes for the new dummy regulators.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPeDhzAAoJEBus8iNuMP3dh3sP/2i2M34Y66HkNGJCbkLgzGsu
 DlwbiNdh+o/uUcALCcyt7tYF06MhsJ4n7fOBRZ+hKr3VMTguHi6B36IKxGrfzBJs
 9XoYQkyO/92g3UjdWQSWKSQfx/qZhw167gmmeL8jQfEQOZZ2MhnCLbbZVsRMFGf6
 PzVDyW0StDWh0uBP6P7UU64pogFfUqSO/guIAqppUI9Ll/ulx0OqY+eov2mQzlmg
 Rqwjt9mF9UMZn4/Br0mQx+iUqqSugtA+2VAAiSx7K8JDjeMPh47S31p/FGCLXrmv
 Lbn2vQGn23RDthdxQlcisY/rJU5WsJbgdjjoppucyYJbYUWzVVMNM0djxtpGIQ7j
 x9X6ZTdG4RuphI5FDku/vKkNS4O/Y0+6bumpqFfXyBoAGOXMKdUmTymCNCogFnOy
 F6vMzrtA27M5HaFaRP3xnMSNU/aBegsgCoEjyQ1b5D1TAKvc5v614cZzyrWaCd+G
 gVE1lDIAo2snraRjZl9LDQwGKOkzEdLXJSzGZ7Pk9n54+QvRBJcYu3l/Wdrn4JES
 jtIprAyWbY4z6n5wuucwwjFZa2UtBukRTV8ZA/jMq+eig3VdN8CSKJCJUQTG+UgV
 fyCNq7WWAhK8rldcjgJhPspEbRazAEnaNwfZUWZAmmnb8bVVRO6pJOl2TiRN0DFt
 8MqdrQtJFusRXgrc+Wlq
 =h5VJ
 -----END PGP SIGNATURE-----

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

Pull regulator fixes from Mark Brown:
 "A bunch of smallish fixes that came up during the merge window as
  things got more testing - even more fixes from Axel, a fix for error
  handling in more complex systems using -EPROBE_DEFER and a couple of
  small fixes for the new dummy regulators."

* tag 'regulator-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: Remove non-existent parameter from fixed-helper.c kernel doc
  regulator: Fix setting new voltage in s5m8767_set_voltage
  regulator: fix sysfs name collision between dummy and fixed dummy regulator
  regulator: Fix deadlock on removal of regulators with supplies
  regulator: Fix comments in include/linux/regulator/machine.h
  regulator: Only update [LDOx|DCx]_HIB_MODE bits in wm8350_[ldo|dcdc]_set_suspend_disable
  regulator: Fix setting low power mode for wm831x aldo
  regulator: Return microamps in wm8350_isink_get_current
  regulator: wm8350: Fix the logic to choose best current limit setting
  regulator: wm831x-isink: Fix the logic to choose best current limit setting
  regulator: wm831x-dcdc: Fix the logic to choose best current limit setting
  regulator: anatop: patching to device-tree property "reg".
  regulator: Do proper shift to set correct bit for DC[2|5]_HIB_MODE setting
  regulator: Fix restoring pmic.dcdcx_hib_mode settings in wm8350_dcdc_set_suspend_enable
  regulator: Fix unbalanced lock/unlock in mc13892_regulator_probe error path
  regulator: Fix set and get current limit for wm831x_buckv
  regulator: tps6586x: Fix list minimal voltage setting for LDO0
2012-04-04 10:09:30 -07:00
Mark Brown 65f26846b9 regulator: core: Constify the regulator_desc passed in when registering
Drivers should be able to declare their descriptors const and the framework
shouldn't ever be modifying the desciptor. Make the parameter and the
pointer in regulator_dev const to enforce this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-04 11:43:26 +01:00
Mark Brown 576ca4367f regulator: core: Pull non-DT supply mapping into regulator_dev_lookup()
Ensure we always apply the supply mapping when doing a lookup rather than
only doing it in non-DT cases, ensuring that regulators with supplies
specified in the regulator_desc can find their supplies on non-DT systems
and generally making the code more obvious.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-03 14:00:49 +01:00
Mark Brown 6d191a5fc7 regulator: core: Don't defer probe if there's no DT binding for a supply
When using device tree if there's no binding for a supply then there's no
way that one could appear later so just fail permanently right away. This
avoids wasting time trying to reprobe when that can never work.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-03 14:00:48 +01:00
Mark Brown 01e86f4988 regulator: core: Complain if we can't reenable a supply
When cleaning up after a failed bulk_disable() we try to reenable any
supplies that we did manage to disable - complain if we fail to do that
when we try.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-03 14:00:46 +01:00
Mark Brown e032b37655 regulator: Fix deadlock on removal of regulators with supplies
If a regulator with a supply is being unregistered we will call
regulator_put() to release the supply with the regulator_list_mutex held
but this deadlocks as regulator_put() takes the same lock. Fix this by
releasing the supply before we take the mutex in regulator_unregister().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-29 22:50:14 +01: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
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
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
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 073512336e regulator: Set delay to 0 if set_voltage_time_sel callback returns error
rdev->desc->ops->set_voltage_time_sel may return negative error code.
Set delay to 0 and also show warning if set_voltage_time_sel returns error.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-24 15:21:47 +00:00
Stephen Boyd 2475143444 regulator: Remove ifdefs for debugfs code
If CONFIG_DEBUG_FS=y debugfs functions will never return an
ERR_PTR. Instead they'll return NULL. The intent is to remove
ifdefs in calling code.

Update the code to reflect this. We gain an extra dentry pointer
per struct regulator and struct regulator_dev but that should be
ok because most distros have debugfs compiled in anyway.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-21 09:56:51 +00:00
Mark Brown f4d562c6e6 regulator: Clean up debugfs error handling a bit
Use IS_ERR_OR_NULL() rather than open coding it and ignore errors from
failure to create the supply map.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-21 09:56:38 +00:00
Axel Lin b29c7690a7 regulator: Simplify regulator_bulk_get and regulator_bulk_enable error paths
Start unwind from the point the error happens instead of iterating over all
consumers, then unwind code can be simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-19 18:50:21 -08:00
Axel Lin 5bc7801599 regulator: Remove obsolete consumer_dev related comment
consumer_dev is remove by commit 737f36
"regulator: Remove support for supplies specified by struct device".
Thus remove the obsolete comment.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-18 11:58:12 -08:00
Mark Brown 4a68292281 regulator: Complain if a voltage range is specified but can't be used
It doesn't make much sense to specify a range of voltages consumers can
use if they haven't been given permission to change the voltage. Log if
this happens, probably the user forgot to specify CHANGE_VOLTAGE.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-09 16:22:18 +00:00
Mark Brown 43f674a322 regulator: Don't add the function name to pr_fmt
Liam pointed out via IM that since we now use the pure function name for
all regulator logging a lot of the messages such as those logging the
constraints are getting a bit noisy due to the implementation detail
that is the function name:

print_constraints: VDDARM: 1000 <--> 1300 mV at 1300 mV at 0 mA

In discussion it seemed like the best thing was to just drop the pr_fmt
and clarify individual log messages where there is an issue otherwise
we get into silly things like renaming the functions to suit the logging.

This is mostly an issue as we have a moderate amount of non-error logging
in the boot sequence to aid debug if something goes wrong since regulator
misconfiguration can kill the system pretty quickly.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-09 16:22:06 +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
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
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
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
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
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
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