1
0
Fork 0
Commit Graph

19 Commits (redonkable)

Author SHA1 Message Date
Marek Vasut 67d5b7a1f9 regulator: core: Add regulator_is_equal() helper
commit b059b7e0ec upstream.

Add regulator_is_equal() helper to compare whether two regulators are
the same. This is useful for checking whether two separate regulators
in a driver are actually the same supply.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Igor Opaniuk <igor.opaniuk@toradex.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Link: https://lore.kernel.org/r/20191220164450.1395038-1-marex@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:35:48 -08:00
Bartosz Golaszewski d0087e7271
regulator: provide regulator_bulk_set_supply_names()
There are many regulator consumers who - before using the regulator
bulk functions - set the supply names in regulator_bulk_data using
a for loop.

Let's provide a simple helper in the consumer API that allows users
to do the same with a single function call.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20190830071740.4267-2-brgl@bgdev.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-02 12:49:42 +01:00
Mark Brown f2c6203fdd
regulator: core: Make entire header comment C++ style
Makes things look more consistent.

Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-18 19:13:05 +01:00
Thomas Gleixner 2874c5fd28 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:26:32 -07:00
Axel Lin a32e0c773b
regulator: core: Add set/get_current_limit helpers for regmap users
By setting curr_table, n_current_limits, csel_reg and csel_mask, the
regmap users can use regulator_set_current_limit_regmap and
regulator_get_current_limit_regmap for set/get_current_limit callbacks.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-03 23:45:27 +00:00
Matti Vaittinen 6a47b4da55
regulator: add regulator_desc_list_voltage_linear_range
Add regulator_desc_list_voltage_linear_range which can be used
by drivers for getting the voltages before regulator is registered.
This may be useful for drivers which need to fetch the voltage
selectors at device-tree parsing callback.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Mark Brown <broonie@kernel.org>
Tested-by: Angus Ainslie <angus@akkea.ca>
Reviewed-by: Angus Ainslie <angus@akkea.ca>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-14 15:12:26 +00:00
Mark Brown 5451521409 regulator/mfd: Support for the ROHM BD71847
This adds support for the BD71847 which touches both MFD and regulator.
 There's a few other bits and pieces included as some dependency patches
 had already been applied so would've required rebasing.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluuM/8THGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0Az7B/4ye6MIEn8hwKmS36NU3oCvCTFiOZHe
 W+T1/O7gOYPSOeHk/4SA8v+A0X2ry+zCschSJtnGDWeZwiZmuhSbQO3SKKM+iAKJ
 R1UFioMVd8cr8UySX0ddSdFit+rI+FcZHd8TYAjbseX+0YKZX7z7/rXPVhSEhdU3
 BxRy58DJRbLxYofiGruvDd/sj6VFukVmLRjQUE5SqZ8aTKXBbrT7h0Jgi3m7aOmK
 g/a+ulMNecq8884oQuBjj1+xCuT02GJsT04BKaXEBsAFX1Fh8IyOxej2N2PaX1z/
 6HoPjSAac/Gl9BAgpV0YDdEJJR8yumkdDJubF3SayMyoiv16zMTT1fvC
 =t0Ni
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluuNaMTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0H/3B/9u/IGN9LWSnauAivTDqZGx1V3a97e2
 ijZSiWaTWFmIBPUNIJgDQirdqsX61Mgu9mTbeD9+tmi2Mm4AOZRJT4pdtzZCehWT
 HQuN4dcF9heftf/6Q4c+5yZFAJzOJHHuFklNdDAuM12rUp5IDpKxIo2nrx7MDN6r
 RgrxK6eTluvOL4+VJwN/VqXRBWfN857uMjaGkbFV3CrYJh2Ktumts3IcFd18Cpvd
 U3gBUYNsPBiQtmGXFkrCCBaYWqn5Ry91CAvpTjoJdZx50xbeXVOEUnUMaidQ4/ru
 XL+PqcdTovKuV5OhMzra5MCVt3Cv8Oc/21KeNvFEIV3X6O531LEcksDx
 =zN+p
 -----END PGP SIGNATURE-----

Merge tag 'bd71847-support' into regulator-4.20

regulator/mfd: Support for the ROHM BD71847

This adds support for the BD71847 which touches both MFD and regulator.
There's a few other bits and pieces included as some dependency patches
had already been applied so would've required rebasing.
2018-09-28 15:07:30 +01:00
Matti Vaittinen 18e4b55fbd
regulator: Support regulators where voltage ranges are selectable
For example ROHM BD71837 and ROHM BD71847 Power management ICs have
regulators which provide multiple linear ranges. Ranges can be
selected by individual non contagious bit in vsel register. Add
regmap helper functions for selecting ranges.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-28 14:57:03 +01:00
Matti Vaittinen e7d80b6b84
regulator: regmap helpers - support overlapping linear ranges
Don't give up voltage mapping if first range with suitable min/max uV
does not provide the wanted voltage.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-28 20:30:24 +01:00
Charles Keepax f7d37bc3cb regulator: helpers: Add regmap set_pull_down helper
Add a helper function regulator_set_pull_down_regmap to allow regmap
based regulators to easily enable pull down.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-06 19:29:37 +01:00
Charles Keepax a7a453f56a regulator: helpers: Add regmap set_soft_start helper
Add a helper function regulator_set_soft_start_regmap to allow regmap
based regulators to easily enable soft start.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-06 19:29:37 +01:00
Charles Keepax 85b037442e regulators: helpers: Fix handling of bypass_val_on in get_bypass_regmap
The handling of bypass_val_on that was added in
regulator_get_bypass_regmap is done unconditionally however
several drivers don't define a value for bypass_val_on. This
results in those drivers reporting bypass being enabled when
it is not. In regulator_set_bypass_regmap we use bypass_mask
if bypass_val_on is zero. This patch adds similar handling in
regulator_get_bypass_regmap.

Fixes: commit dd1a571dae ("regulator: helpers: Ensure bypass register field matches ON value")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-10 17:28:32 +00:00
Jon Hunter dd1a571dae regulator: helpers: Ensure bypass register field matches ON value
When checking bypass state for a regulator, we check to see if any bits
in the bypass mask are set. For most cases this is fine because there is
typically, only a single bit used to determine if the regulator is in
bypass. However, for some regulators, such as LDO6 on AS3722, the bypass
state is indicate by a value rather than a single bit. Therefore, when
checking the bypass state, check that the bypass field matches the ON
value.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-22 11:49:03 +01:00
Laxman Dewangan 354794dacc regulator: helper: Add helper to configure active-discharge using regmap
Add helper function to set the state of active-discharge of
regulator using regmap. The HW regulator driver can directly
use this by providing the necessary information in the regulator
descriptor.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-02 23:13:05 +09:00
Krzysztof Kozlowski 43343f8d80 regulator: Fix the function name in documentation
The function name in kernel-doc for regulator_map_voltage_linear_range()
was wrong.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-19 13:23:07 +01:00
Carlo Caione ca5d1b3524 regulator: helpers: Modify helpers enabling multi-bit control
This patch extends the regulator helpers to account for device that use
multiple bits for control when using regmap enable/disable/bypass ops.

The actual regulator helpers wrongly assume that the regulator control
is always performed using single bits, using in the regulator_desc
struct only two parameters *_reg and *_mask defining register and mask
for control.

This patch extends this struct and introduces the helpers to take into
account devices where control is performed using multiple bits and
specific multi-bit values are used for enabling/disabling/bypassing the
regulator.

Signed-off-by: Carlo Caione <carlo@caione.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-06 17:30:10 +08:00
Axel Lin e277e65680 regulator: Remove max_uV from struct regulator_linear_range
linear ranges means each range has linear voltage settings.
So we can calculate max_uV for each linear range in regulator core rather than
set the max_uV field in drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-11 12:49:12 +01:00
Axel Lin d295f76701 regulator: core: Move list_voltage_{linear,linear_range,table} to helpers.c
Move regulator_list_voltage_{linear,linear_range,table} helper functions to
helpers.c.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-09 11:45:02 +01:00
Mark Brown c4a54b8d54 regulator: core: Move helpers for drivers out into a separate file
Reduce the size of core.c a bit.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-07 16:32:00 +01:00