linux-2.6-microblaze.git
5 years agoregulator: lp873x: Convert to use regulator_set/get_current_limit_regmap
Axel Lin [Thu, 28 Feb 2019 13:40:17 +0000 (21:40 +0800)]
regulator: lp873x: Convert to use regulator_set/get_current_limit_regmap

Use regulator_set/get_current_limit_regmap helpers to save some code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp872x: Convert to use regulator_set/get_current_limit_regmap
Axel Lin [Thu, 28 Feb 2019 13:40:16 +0000 (21:40 +0800)]
regulator: lp872x: Convert to use regulator_set/get_current_limit_regmap

Use regulator_set/get_current_limit_regmap helpers to save some code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9210: Convert to use regulator_set/get_current_limit_regmap
Axel Lin [Thu, 28 Feb 2019 13:40:15 +0000 (21:40 +0800)]
regulator: da9210: Convert to use regulator_set/get_current_limit_regmap

Use regulator_set/get_current_limit_regmap helpers to save some code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9055: Convert to use regulator_set/get_current_limit_regmap
Axel Lin [Thu, 28 Feb 2019 13:40:14 +0000 (21:40 +0800)]
regulator: da9055: Convert to use regulator_set/get_current_limit_regmap

Use regulator_set/get_current_limit_regmap helpers to save some code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: core: Add set/get_current_limit helpers for regmap users
Axel Lin [Thu, 28 Feb 2019 13:40:13 +0000 (21:40 +0800)]
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>
5 years agoregulator: Fix comment for csel_reg and csel_mask
Axel Lin [Thu, 28 Feb 2019 13:40:12 +0000 (21:40 +0800)]
regulator: Fix comment for csel_reg and csel_mask

The csel_reg and csel_mask fields in struct regulator_desc needs to
be generic for drivers. Not just for TPS65218.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: stm32-vrefbuf: add power management support
Fabrice Gasnier [Thu, 28 Feb 2019 10:45:18 +0000 (11:45 +0100)]
regulator: stm32-vrefbuf: add power management support

Add support for suspend/resume and runtime PM to stm32-vrefbuf driver.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: 88pm8607: Remove unused fields from struct pm8607_regulator_info
Axel Lin [Tue, 26 Feb 2019 12:40:59 +0000 (20:40 +0800)]
regulator: 88pm8607: Remove unused fields from struct pm8607_regulator_info

The *i2c and *i2c_8606 are no longer used since this driver was converted
to use regmap helpers. The *chip and *regulator are not really required.
So remove these unused fields.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: 88pm8607: Simplify pm8607_list_voltage implementation
Axel Lin [Tue, 26 Feb 2019 12:40:58 +0000 (20:40 +0800)]
regulator: 88pm8607: Simplify pm8607_list_voltage implementation

Set volt_table filed then we can use regulator_list_voltage_table.
Since we have volt_table setting, now we can remove vol_table from
struct pm8607_regulator_info.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: cpcap: Constify omap4_regulators and xoom_regulators
Axel Lin [Tue, 26 Feb 2019 05:52:30 +0000 (13:52 +0800)]
regulator: cpcap: Constify omap4_regulators and xoom_regulators

They should never change, make them const.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: cpcap: Remove unused vsel_shift from struct cpcap_regulator
Axel Lin [Tue, 26 Feb 2019 05:52:29 +0000 (13:52 +0800)]
regulator: cpcap: Remove unused vsel_shift from struct cpcap_regulator

This driver uses regulator_get/set_voltage_sel_regmap so it does not use
vsel_shift. Actually, vsel_shift can be calculated by vsel_mask setting.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: regulator: tps65218: rectify units of LS3
Christian Hohnstaedt [Mon, 25 Feb 2019 07:15:03 +0000 (08:15 +0100)]
dt-bindings: regulator: tps65218: rectify units of LS3

LS3 has a selectable current limit.
Change units to microamp in the example.

Signed-off-by: Christian Hohnstaedt <Christian.Hohnstaedt@wago.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: regulator: add LS2 load switch documentation
Christian Hohnstaedt [Mon, 25 Feb 2019 06:41:05 +0000 (07:41 +0100)]
dt-bindings: regulator: add LS2 load switch documentation

Document device-tree settings of the load-switch LS2
in the tps65218 device.

Signed-off-by: Christian Hohnstaedt <Christian.Hohnstaedt@wago.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9062: Use struct_size() in devm_kzalloc()
Gustavo A. R. Silva [Sat, 23 Feb 2019 01:54:51 +0000 (19:54 -0600)]
regulator: da9062: Use struct_size() in devm_kzalloc()

One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
    int stuff;
    struct boo entry[];
};

size = sizeof(struct foo) + count * sizeof(struct boo);
instance = alloc(size, GFP_KERNEL)

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = alloc(struct_size(instance, entry, count), GFP_KERNEL)

Notice that, in this case, variable size is not necessary, hence it is
removed.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: mcp16502: Remove module version
Axel Lin [Sun, 24 Feb 2019 06:41:10 +0000 (14:41 +0800)]
regulator: mcp16502: Remove module version

The module version is unlikely to be updated, use kernel version should be
enough.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: fan53555: Check pdata->slew_rate setting
Axel Lin [Sun, 24 Feb 2019 03:21:46 +0000 (11:21 +0800)]
regulator: fan53555: Check pdata->slew_rate setting

Current code does not really avoid array access out of bounds,
fix it by add checking for pdata->slew_rate.
If pdata->slew_rate is too big, it's a bug in pdata that needs fix.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: arizona_ldo1: Simplify arizona_ldo1_hc_set/get_voltage_sel
Axel Lin [Mon, 25 Feb 2019 09:13:49 +0000 (17:13 +0800)]
regulator: arizona_ldo1: Simplify arizona_ldo1_hc_set/get_voltage_sel

Setup .vsel_reg and .vsel_mask then we can use the standard
set/get_voltage_sel_regmap helpers to simplify the code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9063: Use struct_size() in devm_kzalloc()
Gustavo A. R. Silva [Thu, 21 Feb 2019 17:57:14 +0000 (11:57 -0600)]
regulator: da9063: Use struct_size() in devm_kzalloc()

One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
    int stuff;
    struct boo entry[];
};

size = sizeof(struct foo) + count * sizeof(struct boo);
instance = alloc(size, GFP_KERNEL)

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = alloc(struct_size(instance, entry, count), GFP_KERNEL)

Notice that, in this case, variable size is not necessary, hence it is
removed.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: mt6311: Use linear instead of linear range for mt6311_buck_ops
Axel Lin [Thu, 21 Feb 2019 16:28:31 +0000 (00:28 +0800)]
regulator: mt6311: Use linear instead of linear range for mt6311_buck_ops

Current code already set .min_uV and .uV_step fields and it actually can
use regulator_list_voltage_linear.
So remove buck_volt_range and use regulator_list_voltage_linear instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: max77650: Fix set_current_limit implementation
Axel Lin [Fri, 22 Feb 2019 09:09:21 +0000 (17:09 +0800)]
regulator: max77650: Fix set_current_limit implementation

Current code always return error, fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: tps65218: Add support for LS2
Christian Hohnstaedt [Fri, 22 Feb 2019 08:38:54 +0000 (09:38 +0100)]
regulator: tps65218: Add support for LS2

Re-use the "tps65218_pmic_*_current_limit()" functions of LS3
and calculate the different required bit-shift by counting the
trailing 0s in "struct regulator_desc.csel_mask"

Signed-off-by: Christian Hohnstaedt <Christian.Hohnstaedt@wago.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: s5m8767: Simplify s5m8767_set_voltage_time_sel implementation
Axel Lin [Thu, 21 Feb 2019 13:17:22 +0000 (21:17 +0800)]
regulator: s5m8767: Simplify s5m8767_set_voltage_time_sel implementation

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: s5m8767: Constify s5m8767_opmode_reg
Axel Lin [Thu, 21 Feb 2019 13:17:21 +0000 (21:17 +0800)]
regulator: s5m8767: Constify s5m8767_opmode_reg

The s5m8767_opmode_reg should never change, make it const.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: core: Log forbidden DRMS operation
Marc Gonzalez [Thu, 21 Feb 2019 11:55:22 +0000 (12:55 +0100)]
regulator: core: Log forbidden DRMS operation

When REGULATOR_CHANGE_DRMS is not set, drms_uA_update is a no-op.
It used to print a debug message, which was dropped in commit
8a34e979f684 ("regulator: refactor valid_ops_mask checking code")

Let's bring the debug message back, because it helps find missing
regulator-allow-set-load properties.

Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp873x: Constify lp873x_buck_ramp_delay array
Axel Lin [Thu, 21 Feb 2019 15:01:11 +0000 (23:01 +0800)]
regulator: lp873x: Constify lp873x_buck_ramp_delay array

The lp873x_buck_ramp_delay should never change, make it const.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years ago.mailmap: Add Mathieu Othacehe
Mathieu Othacehe [Wed, 13 Feb 2019 16:12:49 +0000 (17:12 +0100)]
.mailmap: Add Mathieu Othacehe

Some contributions appears as Mathieu Othacehe and other as Mathieu
OTHACEHE.

Signed-off-by: Mathieu Othacehe <m.othacehe@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: fan53555: Add support for FAN53526
Bjorn Andersson [Thu, 21 Feb 2019 00:43:03 +0000 (16:43 -0800)]
regulator: fan53555: Add support for FAN53526

The FAN53526 differs from the FAN53555 only in that the mode bit in
VSEL0/VSEL1 is moved to the CONTROL register, the voltage selector mask
is extended by 1 bit and the step is different.

So extend the existing fan53555 driver to support FAN53526 as well.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: twl6030: Constify regulator_ops
Axel Lin [Sun, 17 Feb 2019 13:48:09 +0000 (21:48 +0800)]
regulator: twl6030: Constify regulator_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: twl6030: Use regulator_list_voltage_linear_range for twl6030ldo_ops
Axel Lin [Sun, 17 Feb 2019 13:48:08 +0000 (21:48 +0800)]
regulator: twl6030: Use regulator_list_voltage_linear_range for twl6030ldo_ops

Use linear range to replace the twl6030ldo_list_voltage implementation.
With this change, the min_mV is not used and can be removed from
struct twlreg_info.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: max77650: Add missing .owner field in regulator_desc
Axel Lin [Wed, 20 Feb 2019 01:53:28 +0000 (09:53 +0800)]
regulator: max77650: Add missing .owner field in regulator_desc

Add missing .owner field in regulator_desc, which is used for refcounting.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: max77620: Add missing .owner field in regulator_desc
Axel Lin [Wed, 20 Feb 2019 01:53:27 +0000 (09:53 +0800)]
regulator: max77620: Add missing .owner field in regulator_desc

Add missing .owner field in regulator_desc, which is used for refcounting.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: axp20x: remove a redundant null check on rdev
Colin Ian King [Fri, 15 Feb 2019 09:45:54 +0000 (09:45 +0000)]
regulator: axp20x: remove a redundant null check on rdev

Currently rdev is dereferenced when assigning desc before rdev is null
checked, this is leading to static analysis warnings.  However, rdev
can never be null, so the null check is redundant and can be removed.

Detected by CoverityScan, CID#1476031 ("Dereference before null check")

Fixes: 77e3e3b165db ("regulator: axp20x: add software based soft_start for AXP209 LDO3")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9063: Select maximum current in specific range for set_current_limit
Axel Lin [Tue, 19 Feb 2019 13:31:01 +0000 (21:31 +0800)]
regulator: da9063: Select maximum current in specific range for set_current_limit

Selecting the minimal value is only true for voltage regulators.
For current regulators the maximum in the given range should be
selected instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9062: Select maximum current in specific range for set_current_limit
Axel Lin [Tue, 19 Feb 2019 13:31:00 +0000 (21:31 +0800)]
regulator: da9062: Select maximum current in specific range for set_current_limit

Selecting the minimal value is only true for voltage regulators.
For current regulators the maximum in the given range should be
selected instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge branch 'regulator-5.0' into regulator-5.1 stpmic1 const/range
Mark Brown [Tue, 19 Feb 2019 11:06:41 +0000 (11:06 +0000)]
Merge branch 'regulator-5.0' into regulator-5.1 stpmic1 const/range

5 years agoregulator: stpmic1: Change buck1 voltage range
Pascal PAILLET-LME [Tue, 19 Feb 2019 10:04:34 +0000 (10:04 +0000)]
regulator: stpmic1: Change buck1 voltage range

Change buck1 voltage range to be conform with the data-sheet.

Signed-off-by: pascal paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: stpmic1: Add active discharge support
Pascal PAILLET-LME [Tue, 19 Feb 2019 10:04:35 +0000 (10:04 +0000)]
regulator: stpmic1: Add active discharge support

Add support for active discharge for USB power switches.

Signed-off-by: pascal paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: regulator: Add active discharge support for stpmic1
Pascal PAILLET-LME [Tue, 19 Feb 2019 10:04:34 +0000 (10:04 +0000)]
dt-bindings: regulator: Add active discharge support for stpmic1

Add support for active discharge for USB power switches.

Signed-off-by: pascal paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: stpmic1: Remove support for regulator pull down
Pascal PAILLET-LME [Tue, 19 Feb 2019 10:04:33 +0000 (10:04 +0000)]
regulator: stpmic1: Remove support for regulator pull down

Regulator high pull down are enabled by default so remove support in the
driver.

Signed-off-by: pascal paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: regulator: remove regulator pull-down support for stpmic1
Pascal PAILLET-LME [Tue, 19 Feb 2019 10:04:33 +0000 (10:04 +0000)]
dt-bindings: regulator: remove regulator pull-down support for stpmic1

Regulator high pull down are enabled by default so remove support in the
driver.

Signed-off-by: Pascal Paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: stpmic1: Simplify regulators registration
Pascal PAILLET-LME [Tue, 19 Feb 2019 10:04:32 +0000 (10:04 +0000)]
regulator: stpmic1: Simplify regulators registration

Stop using a regulator_init callback. This leads to a more simple regulator
registration code. This also permits to spuress struct stpmic1_regulator.
Also rename stpmic1_regulators_matches to stpmic1_matches.

Signed-off-by: pascal paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: regulator: remove interrupt-parent description on stpmic1
Pascal PAILLET-LME [Tue, 19 Feb 2019 10:04:32 +0000 (10:04 +0000)]
dt-bindings: regulator: remove interrupt-parent description on stpmic1

The interrupt parent description is not needed as the parent is a parent
node with 'interrupt-controller' property.

Signed-off-by: pascal paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: stpmic1: Use regulator mode definition from bindings
Pascal PAILLET-LME [Tue, 19 Feb 2019 10:04:31 +0000 (10:04 +0000)]
regulator: stpmic1: Use regulator mode definition from bindings

Get the regulator mode definition from the bindings header.

Signed-off-by: pascal paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: core: Drop lockdep annotation in drms_uA_update()
Niklas Cassel [Mon, 18 Feb 2019 19:29:14 +0000 (20:29 +0100)]
regulator: core: Drop lockdep annotation in drms_uA_update()

commit e5e21f70bfd3 ("regulator: core: Take lock before applying system
load") took the regulator lock before calling drms_uA_update() in order
to silence a lockdep warning during regulator_register().

However, we are not supposed to need locks at this point as the regulator
is in the process of being registered, so there should be no possibility
of concurrent access.

Instead, remove the unnecessary locking and simply drop the lockdep
annotation, since it is no longer valid.

Fixes: e5e21f70bfd3 ("regulator: core: Take lock before applying system load")
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: stpmic1: Remove regul_id and *regmap from struct stpmic1_regulator
Axel Lin [Thu, 14 Feb 2019 01:59:56 +0000 (09:59 +0800)]
regulator: stpmic1: Remove regul_id and *regmap from struct stpmic1_regulator

At the context with *rdev available, regulator core provides
rdev_get_id()/rdev_get_regmap() APIs to get regulator id and *regmap.
So no need to store them in struct stpmic1_regulator.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: pv88060: Fix .ops for PV88060_SW
Axel Lin [Fri, 15 Feb 2019 01:42:49 +0000 (09:42 +0800)]
regulator: pv88060: Fix .ops for PV88060_SW

There is no vsel_reg/vsel_mask settings for PV88060_ID_SWx, so don't use
pv88060_ldo_ops for PV88060_SW. The PV88060_ID_SWx is fixed voltage,
set .fixed_uV instead of .min_uV then regulator core will automatically
support get_voltage and list_voltage.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: core: remove unused rdev_get_supply()
Masahiro Yamada [Mon, 18 Feb 2019 06:08:38 +0000 (15:08 +0900)]
regulator: core: remove unused rdev_get_supply()

This is a remnant of commit 70a7fb80e85a ("regulator: core: Fix nested
locking of supplies").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: axp20x: fix DCDCB and BLDO2 definitions for AXP806
Ondrej Jirman [Mon, 18 Feb 2019 01:01:20 +0000 (02:01 +0100)]
regulator: axp20x: fix DCDCB and BLDO2 definitions for AXP806

This fixes another set of errors from the refactoring of literals
to mask preproccesor definitions.

Found by debugging a broken voltage setup on Orange Pi One Plus.

Fixes: db4a555f7c4cf ("regulator: axp20x: use defines for masks")
Signed-off-by: Ondrej Jirman <megous@megous.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: core: Take lock before applying system load
Niklas Cassel [Fri, 15 Feb 2019 10:55:33 +0000 (11:55 +0100)]
regulator: core: Take lock before applying system load

Take the regulator lock before applying system load.

Fixes the following lockdep splat:

[    5.583581] WARNING: CPU: 1 PID: 16 at drivers/regulator/core.c:925 drms_uA_update+0x114/0x360
[    5.588467] Modules linked in:
[    5.596833] CPU: 1 PID: 16 Comm: kworker/1:0 Not tainted 5.0.0-rc6-next-20190213-00002-g0fce66ab480f #18
[    5.599933] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[    5.609544] Workqueue: events qcom_channel_state_worker
[    5.616209] pstate: 60000005 (nZCv daif -PAN -UAO)
[    5.621152] pc : drms_uA_update+0x114/0x360
[    5.626006] lr : drms_uA_update+0x110/0x360
[    5.630084] sp : ffff0000124b3490
[    5.634242] x29: ffff0000124b3490 x28: ffff800005326e00
[    5.637735] x27: ffff0000124b35f8 x26: 000000000032bc48
[    5.643117] x25: ffff800004c7e800 x24: ffff800004c6d500
[    5.648411] x23: ffff800004c38a80 x22: 00000000000000d1
[    5.653706] x21: 00000000001ab3f0 x20: ffff800004c7e800
[    5.659001] x19: ffff0000114c3000 x18: ffffffffffffffff
[    5.664297] x17: 0000000000000000 x16: 0000000000000000
[    5.669592] x15: ffff0000114c3808 x14: 0720072007200720
[    5.674888] x13: 00000000199c9b28 x12: ffff80002bcccc40
[    5.680183] x11: ffff000012286000 x10: ffff0000114c3808
[    5.685477] x9 : 0720072007200720 x8 : ffff000010e9e808
[    5.690772] x7 : ffff0000106da568 x6 : 0000000000000000
[    5.696067] x5 : 0000000000000000 x4 : 0000000000000000
[    5.701362] x3 : 0000000000000004 x2 : 0000000000000000
[    5.706658] x1 : 0000000000000000 x0 : 0000000000000000
[    5.711952] Call trace:
[    5.717223]  drms_uA_update+0x114/0x360
[    5.719405]  regulator_register+0xb30/0x1140
[    5.723230]  devm_regulator_register+0x4c/0xa8
[    5.727745]  rpm_reg_probe+0xfc/0x1b0
[    5.731992]  platform_drv_probe+0x50/0xa0
[    5.735727]  really_probe+0x20c/0x2b8
[    5.739718]  driver_probe_device+0x58/0x100
[    5.743368]  __device_attach_driver+0x90/0xd0
[    5.747363]  bus_for_each_drv+0x64/0xc8
[    5.751870]  __device_attach+0xd8/0x138
[    5.755516]  device_initial_probe+0x10/0x18
[    5.759341]  bus_probe_device+0x98/0xa0
[    5.763502]  device_add+0x3d0/0x640
[    5.767319]  of_device_add+0x48/0x58
[    5.770793]  of_platform_device_create_pdata+0xb0/0x128
[    5.774629]  of_platform_bus_create+0x174/0x370
[    5.779569]  of_platform_populate+0x78/0xe0
[    5.784082]  qcom_smd_rpm_probe+0x80/0xa0
[    5.788245]  rpmsg_dev_probe+0x114/0x1a0
[    5.792411]  really_probe+0x20c/0x2b8
[    5.796401]  driver_probe_device+0x58/0x100
[    5.799964]  __device_attach_driver+0x90/0xd0
[    5.803960]  bus_for_each_drv+0x64/0xc8
[    5.808468]  __device_attach+0xd8/0x138
[    5.812115]  device_initial_probe+0x10/0x18
[    5.815936]  bus_probe_device+0x98/0xa0
[    5.820099]  device_add+0x3d0/0x640
[    5.823916]  device_register+0x1c/0x28
[    5.827391]  rpmsg_register_device+0x4c/0x90
[    5.831216]  qcom_channel_state_worker+0x170/0x298
[    5.835651]  process_one_work+0x294/0x6e8
[    5.840241]  worker_thread+0x40/0x450
[    5.844318]  kthread+0x11c/0x120
[    5.847961]  ret_from_fork+0x10/0x18
[    5.851260] irq event stamp: 9090
[    5.854820] hardirqs last  enabled at (9089): [<ffff000010160798>] console_unlock+0x3e0/0x5b0
[    5.858086] hardirqs last disabled at (9090): [<ffff0000100817cc>] do_debug_exception+0x104/0x140
[    5.866596] softirqs last  enabled at (9086): [<ffff000010082024>] __do_softirq+0x474/0x574
[    5.875446] softirqs last disabled at (9079): [<ffff0000100f2254>] irq_exit+0x13c/0x148
[    5.883598] ---[ end trace 6984ef7f081afa21 ]---

Fixes: fa94e48e13a1 ("regulator: core: Apply system load even if no consumer loads")
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: ltc3676: Fix module description
Axel Lin [Fri, 15 Feb 2019 11:54:21 +0000 (19:54 +0800)]
regulator: ltc3676: Fix module description

This driver is for LTC3676 rather than LTC1376.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: ltc3676: Simplify .readable_reg and .writable_reg callbacks
Axel Lin [Fri, 15 Feb 2019 11:54:20 +0000 (19:54 +0800)]
regulator: ltc3676: Simplify .readable_reg and .writable_reg callbacks

Use case range for continuous range to make the code shorter.
The .readable_reg and .writable_reg implementation are exactly the same,
so use a common ltc3676_readable_writeable_reg function instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: bd718x7: Support SNVS low power state
Matti Vaittinen [Thu, 14 Feb 2019 09:39:36 +0000 (11:39 +0200)]
regulator: bd718x7: Support SNVS low power state

read ROHM BD71837 / BD71847 specific device tree bindings for
controlling the PMIC shutdown/reset states and voltages for
different HW states. The PMIC was designed to be used with NXP
i.MX8 SoC and it supports SNVS low power state which seems to
be typical for NXP i.MX SoCs. However, when SNVS is used we must
not allow SW to control enabling/disabling those regulators which
are crucial for system to boot as there is a HW limitation which
causes SW controlled regulators to be kept shut down after SNVS
reset.

Allow setting the SNVS to be used as reset target state and allow
marking those regulators which are critical for boot.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Tested-by: Angus Ainslie <angus@akkea.ca>
Reviewed-by: Angus Ainslie <angus@akkea.ca>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: add regulator_desc_list_voltage_linear_range
Matti Vaittinen [Thu, 14 Feb 2019 09:38:05 +0000 (11:38 +0200)]
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>
5 years agodevicetree: bindings: bd718x7: document HW state related ROHM specific properties
Matti Vaittinen [Thu, 14 Feb 2019 09:34:50 +0000 (11:34 +0200)]
devicetree: bindings: bd718x7: document HW state related ROHM specific properties

Add ROHM BD71837 / BD71847 specific device tree bindings for
controlling the PMIC shutdown/reset states and voltages for
different HW states. The PMIC was designed to be used with NXP
i.MX8 SoC and it supports SNVS low power state which seems to
be typical for NXP i.MX SoCs. However, when SNVS is used we must
not allow SW to control enabling/disabling those regulators which
are crucial for system to boot as there is a HW limitation which
causes SW controlled regulators to be kept shut down after SNVS
reset.

Allow setting the SNVS to be used as reset target state and allow
marking those regulators which are critical for boot.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Tested-by: Angus Ainslie <angus@akkea.ca>
Reviewed-by: Angus Ainslie <angus@akkea.ca>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: bd70528: drop struct bd70528
Matti Vaittinen [Thu, 14 Feb 2019 13:15:50 +0000 (15:15 +0200)]
regulator: bd70528: drop struct bd70528

As a result of exporting the bd70528 specific locking functions
we no longer need struct bd70528. Remove references to
struct bd70528 from bd70528 regulator.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: s2mpa01: Fix step values for some LDOs
Stuart Menefy [Tue, 12 Feb 2019 21:51:18 +0000 (21:51 +0000)]
regulator: s2mpa01: Fix step values for some LDOs

The step values for some of the LDOs appears to be incorrect, resulting
in incorrect voltages (or at least, ones which are different from the
Samsung 3.4 vendor kernel).

Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
5 years agoregulator: max77802-regulator: fix indentation in if statement
Colin Ian King [Tue, 12 Feb 2019 13:46:16 +0000 (13:46 +0000)]
regulator: max77802-regulator: fix indentation in if statement

There are several lines in an if statement that are not indented
correctly. Fix these by removing the tabs.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp8788-buck: Convert to linear range
Axel Lin [Sun, 10 Feb 2019 02:48:45 +0000 (10:48 +0800)]
regulator: lp8788-buck: Convert to linear range

linear range is suitable for this driver, let's convert it to linear range.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: s2mps11: Fix steps for buck7, buck8 and LDO35
Krzysztof Kozlowski [Sat, 9 Feb 2019 17:14:14 +0000 (18:14 +0100)]
regulator: s2mps11: Fix steps for buck7, buck8 and LDO35

LDO35 uses 25 mV step, not 50 mV.  Bucks 7 and 8 use 12.5 mV step
instead of 6.25 mV.  Wrong step caused over-voltage (LDO35) or
under-voltage (buck7 and 8) if regulators were used (e.g. on Exynos5420
Arndale Octa board).

Cc: <stable@vger.kernel.org>
Fixes: cb74685ecb39 ("regulator: s2mps11: Add samsung s2mps11 regulator driver")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lm363x: Check return value of gpiod_get_index_optional
Axel Lin [Fri, 8 Feb 2019 14:11:52 +0000 (22:11 +0800)]
regulator: lm363x: Check return value of gpiod_get_index_optional

gpiod_get_index_optional can return ERR_PTR, add IS_ERR checking for it.
While at it, also remove a redundant NULL test for gpiod in error path.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: regulator: update fixed-regulator example
Johan Hovold [Fri, 8 Feb 2019 14:04:25 +0000 (15:04 +0100)]
dt-bindings: regulator: update fixed-regulator example

Fixed regulators do not have associated bus addresses and are typically
placed directly under the root node where their names must still be
unique despite not having a unit address.

Fix the malformed example node which had a unit address but no "reg"
property by dropping the unit address.

Also, try to make the example more useful by using the recommended
generic node name "regulator", but with a suffix reflecting the
regulator name in order to make it unique.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: rt5033: Constify rt5033_safe_ldo_ops and rt5033_buck_ops
Axel Lin [Fri, 8 Feb 2019 12:42:47 +0000 (20:42 +0800)]
regulator: rt5033: Constify rt5033_safe_ldo_ops and rt5033_buck_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: fix device unlinking
Guennadi Liakhovetski [Fri, 8 Feb 2019 07:41:53 +0000 (08:41 +0100)]
regulator: fix device unlinking

Device links are refcounted, device_link_remove() has to be called as
many times as device_link_add().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lochnagar: Fix n_voltages setting for VDDCORE
Axel Lin [Tue, 29 Jan 2019 03:01:56 +0000 (11:01 +0800)]
regulator: lochnagar: Fix n_voltages setting for VDDCORE

With current n_voltages setting, regulator_list_voltage will return
-EINVAL when selector >=57. The highest selector is 0x41, so the
n_voltages should be 0x41+1, i.e. 66.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: core: Only support passing enable GPIO descriptors
Linus Walleij [Tue, 29 Jan 2019 10:31:56 +0000 (11:31 +0100)]
regulator: core: Only support passing enable GPIO descriptors

Now that we changed all providers to pass descriptors into the core
for enable GPIOs instead of a global GPIO number, delete the support
for passing GPIO numbers in, and we get a cleanup and size reduction
in the core, and from a GPIO point of view we use the modern, cleaner
interface.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: gpio: Simplify probe path
Linus Walleij [Tue, 29 Jan 2019 10:31:55 +0000 (11:31 +0100)]
regulator: gpio: Simplify probe path

Use devm_* managed device resources and create a local
struct device *dev variable to simplify the code inside
probe().

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: fixed/gpio: Pull inversion/OD into gpiolib
Linus Walleij [Tue, 29 Jan 2019 10:31:53 +0000 (11:31 +0100)]
regulator: fixed/gpio: Pull inversion/OD into gpiolib

This pushes the handling of inversion semantics and open drain
settings to the GPIO descriptor and gpiolib. All affected board
files are also augmented.

This is especially nice since we don't have to have any
confusing flags passed around to the left and right littering
the fixed and GPIO regulator drivers and the regulator core.
It is all just very straight-forward: the core asks the GPIO
line to be asserted or deasserted and gpiolib deals with the
rest depending on how the platform is configured: if the line
is active low, it deals with that, if the line is open drain,
it deals with that too.

Cc: Alexander Shiyan <shc_work@mail.ru> # i.MX boards user
Cc: Haojian Zhuang <haojian.zhuang@gmail.com> # MMP2 maintainer
Cc: Aaro Koskinen <aaro.koskinen@iki.fi> # OMAP1 maintainer
Cc: Tony Lindgren <tony@atomide.com> # OMAP1,2,3 maintainer
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> # EM-X270 maintainer
Cc: Robert Jarzmik <robert.jarzmik@free.fr> # EZX maintainer
Cc: Philipp Zabel <philipp.zabel@gmail.com> # Magician maintainer
Cc: Petr Cvek <petr.cvek@tul.cz> # Magician
Cc: Robert Jarzmik <robert.jarzmik@free.fr> # PXA
Cc: Paul Parsons <lost.distance@yahoo.com> # hx4700
Cc: Daniel Mack <zonque@gmail.com> # Raumfeld maintainer
Cc: Marc Zyngier <marc.zyngier@arm.com> # Zeus maintainer
Cc: Geert Uytterhoeven <geert+renesas@glider.be> # SuperH pinctrl/GPIO maintainer
Cc: Russell King <rmk+kernel@armlinux.org.uk> # SA1100
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> #OMAP1 Amstrad Delta
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: gpio: Convert to use descriptors
Linus Walleij [Tue, 29 Jan 2019 10:31:52 +0000 (11:31 +0100)]
regulator: gpio: Convert to use descriptors

This converts the GPIO regulator driver to use decriptors only.

We have to let go of the array gpio handling: the fetched descriptors
are handled individually anyway, and the array retrieveal function
does not make it possible to retrieve each GPIO descriptor with
unique flags. Instead get them one by one.

We request the "enable" GPIO separately as before, and make sure
that this line is requested as nonexclusive since enable lines can
be shared and the regulator core expects this.

Most users of the GPIO regulator are using device tree.

There are two boards in the kernel using the gpio regulator from a
non-devicetree path: PXA hx4700 and magician. Make sure to switch
these over to use descriptors as well.

Cc: Philipp Zabel <p.zabel@pengutronix.de> # Magician
Cc: Petr Cvek <petr.cvek@tul.cz> # Magician
Cc: Robert Jarzmik <robert.jarzmik@free.fr> # PXA
Cc: Paul Parsons <lost.distance@yahoo.com> # hx4700
Cc: Kevin Hilman <khilman@baylibre.com> # Meson
Cc: Neil Armstrong <narmstrong@baylibre.com> # Meson
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: rk808: Convert rk805 buck1/2 to use linear range
Axel Lin [Mon, 4 Feb 2019 07:10:51 +0000 (15:10 +0800)]
regulator: rk808: Convert rk805 buck1/2 to use linear range

It looks like linear range is suitable to describe the voltage table
for rk805 buck1/2:

selector 0 ~ 59: 0.7125V with uV_step = 12500
selector 60 ~ 62: 1.8V with uV_step = 200000
selector 63: 2.3V

With this change, then rk805 buck1/2 can reuse rk808_reg_ops_ranges.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: as3722: Correct minor typo
Charles Keepax [Tue, 5 Feb 2019 10:34:58 +0000 (10:34 +0000)]
regulator: as3722: Correct minor typo

A comma has been accidentally used where a semi-colon was clearly
intended, correct this typo.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: axp20x: fix ALDO2, DLDO2 and ELDO3 definitions for AXP803
Vasily Khoruzhick [Sat, 26 Jan 2019 06:18:09 +0000 (22:18 -0800)]
regulator: axp20x: fix ALDO2, DLDO2 and ELDO3 definitions for AXP803

Looks like refactoring didn't go well and left ALDO2, DLDO2 and ELDO3
definitions broken for AXP803 - now they are using register address
instead of mask. Fix it by using mask where necessary.

Fixes: db4a555f7c4cf ("regulator: axp20x: use defines for masks")
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: rk808: Fix BUCK1/2 voltages on rk805
Otavio Salvador [Thu, 31 Jan 2019 12:46:01 +0000 (10:46 -0200)]
regulator: rk808: Fix BUCK1/2 voltages on rk805

RK805 has the following voltage range for the BUCK1 and BUCK2 regulators:

From 0.7125V to 1.45V in 12.5mV steps, 1.8V, 2V, 2.2V and 2.3V

, which corresponds to the following values as per the RK805
datasheet:

000 000: 0.7125V
000 001: 0.725V
……
111 011: 1.45V
111 100: 1.8V
111 101: 2.0V
111 110: 2.2V
111 111: 2.3V

This means that the voltage range is not linear and so RK805 can not
reuse the same regulator_ops structure from RK808.

Fix it by creating a list with the correct supported voltage values
for RK805 BUCK1 and BUCK2 regulators.

Tested on a rv1108-elgin-r1 board that now correctly reports a BUCK2
voltage of 2.2V instead of the unsupported value of 1.4875V.

Fixes: c4e0d344c1f0 ("regulator: rk808: Add regulator driver for RK805")
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: uniphier: Constify uniphier_regulator_ops
Axel Lin [Wed, 30 Jan 2019 07:11:10 +0000 (15:11 +0800)]
regulator: uniphier: Constify uniphier_regulator_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: uniphier: Fix probe error handling
Axel Lin [Wed, 30 Jan 2019 07:11:09 +0000 (15:11 +0800)]
regulator: uniphier: Fix probe error handling

Ensure unwind all resources if probe fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: max77650: Fix include files
Axel Lin [Wed, 30 Jan 2019 09:07:21 +0000 (17:07 +0800)]
regulator: max77650: Fix include files

This is a platform driver, no need to include linux/i2c.h.
Include linux/of.h for of_match_ptr.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: regulator: add DT bindings for max77650
Bartosz Golaszewski [Tue, 29 Jan 2019 13:35:34 +0000 (14:35 +0100)]
dt-bindings: regulator: add DT bindings for max77650

Add the DT binding document for max77650 regulators.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: max77650: add regulator support
Bartosz Golaszewski [Tue, 29 Jan 2019 13:35:40 +0000 (14:35 +0100)]
regulator: max77650: add regulator support

Add regulator support for max77650. We support all four variants of this
PMIC including non-linear voltage table for max77651 SBB1 rail.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: axp20x: Fix incorrect vsel_mask settings
Axel Lin [Mon, 28 Jan 2019 14:02:19 +0000 (22:02 +0800)]
regulator: axp20x: Fix incorrect vsel_mask settings

Fix copy-paste mistake while converting to use defines for masks.

Fixes: db4a555f7c4cf ("regulator: axp20x: use defines for masks")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: isl6271a: Constify isl_core_ops and isl_fixed_ops
Axel Lin [Mon, 28 Jan 2019 14:19:21 +0000 (22:19 +0800)]
regulator: isl6271a: Constify isl_core_ops and isl_fixed_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: isl6271a: Remove *rdev[3] from struct isl_pmic
Axel Lin [Mon, 28 Jan 2019 14:19:20 +0000 (22:19 +0800)]
regulator: isl6271a: Remove *rdev[3] from struct isl_pmic

This driver is using devm_regulator_register, so it's not necessary to
store *rdev[3] in struct isl_pmic. Use a local variable instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: rk808: Update module description to include RK805
Axel Lin [Sun, 27 Jan 2019 14:23:44 +0000 (22:23 +0800)]
regulator: rk808: Update module description to include RK805

This driver also supports RK805 now.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: rk808: Constify regulator_ops
Axel Lin [Sun, 27 Jan 2019 14:23:43 +0000 (22:23 +0800)]
regulator: rk808: Constify regulator_ops

While at it, also fix indent for rk805_reg_ops and rk805_switch_ops.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: mcp16502: Include linux/gpio/consumer.h to fix build error
Axel Lin [Sun, 27 Jan 2019 08:51:22 +0000 (16:51 +0800)]
regulator: mcp16502: Include linux/gpio/consumer.h to fix build error

Fix below build error:
drivers/regulator/mcp16502.c: In function ‘mcp16502_gpio_set_mode’:
drivers/regulator/mcp16502.c:135:3: error: implicit declaration of function ‘gpiod_set_value’; did you mean ‘gpio_set_value’? [-Werror=implicit-function-declaration]
   gpiod_set_value(mcp->lpm, 0);
   ^~~~~~~~~~~~~~~
   gpio_set_value
drivers/regulator/mcp16502.c: In function ‘mcp16502_probe’:
drivers/regulator/mcp16502.c:486:13: error: implicit declaration of function ‘devm_gpiod_get’; did you mean ‘devm_gpio_free’? [-Werror=implicit-function-declaration]
  mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW);
             ^~~~~~~~~~~~~~
             devm_gpio_free
drivers/regulator/mcp16502.c:486:40: error: ‘GPIOD_OUT_LOW’ undeclared (first use in this function); did you mean ‘GPIOF_INIT_LOW’?
  mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW);
                                        ^~~~~~~~~~~~~
                                        GPIOF_INIT_LOW

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9063: Check return value of devm_regmap_field_alloc calls
Axel Lin [Sat, 26 Jan 2019 15:22:34 +0000 (23:22 +0800)]
regulator: da9063: Check return value of devm_regmap_field_alloc calls

Since devm_regmap_field_alloc can fail, add error checking for it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9062: Check return value of devm_regmap_field_alloc calls
Axel Lin [Sat, 26 Jan 2019 15:22:33 +0000 (23:22 +0800)]
regulator: da9062: Check return value of devm_regmap_field_alloc calls

Since devm_regmap_field_alloc can fail, add error checking for it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: axp20x: fix ALDO2, DLDO2 and ELDO3 definitions for AXP803
Vasily Khoruzhick [Sat, 26 Jan 2019 06:18:09 +0000 (22:18 -0800)]
regulator: axp20x: fix ALDO2, DLDO2 and ELDO3 definitions for AXP803

Looks like refactoring didn't go well and left ALDO2, DLDO2 and ELDO3
definitions broken for AXP803 - now they are using register address
instead of mask. Fix it by using mask where necessary.

Fixes: db4a555f7c4cf ("regulator: axp20x: use defines for masks")
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp8788-ldo: Constify lp8788_dldo_desc and lp8788_aldo_desc
Axel Lin [Sat, 26 Jan 2019 03:39:07 +0000 (11:39 +0800)]
regulator: lp8788-ldo: Constify lp8788_dldo_desc and lp8788_aldo_desc

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp8788-buck: Constify lp8788_buck_desc
Axel Lin [Sat, 26 Jan 2019 03:39:06 +0000 (11:39 +0800)]
regulator: lp8788-buck: Constify lp8788_buck_desc

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp87565: Constify lp87565_buck_ramp_delay and lp87565_buck_ops
Axel Lin [Sat, 26 Jan 2019 03:39:05 +0000 (11:39 +0800)]
regulator: lp87565: Constify lp87565_buck_ramp_delay and lp87565_buck_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp8755: Constify lp8755_regulators
Axel Lin [Sat, 26 Jan 2019 03:39:04 +0000 (11:39 +0800)]
regulator: lp8755: Constify lp8755_regulators

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp873x: Constify lp873x_buck01_ops and lp873x_ldo01_ops
Axel Lin [Sat, 26 Jan 2019 03:39:03 +0000 (11:39 +0800)]
regulator: lp873x: Constify lp873x_buck01_ops and lp873x_ldo01_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp872x: Constify regulator_ops and regulator_desc
Axel Lin [Sat, 26 Jan 2019 03:39:02 +0000 (11:39 +0800)]
regulator: lp872x: Constify regulator_ops and regulator_desc

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp3972: Constify lp3972_ldo_ops and lp3972_dcdc_ops
Axel Lin [Sat, 26 Jan 2019 03:39:01 +0000 (11:39 +0800)]
regulator: lp3972: Constify lp3972_ldo_ops and lp3972_dcdc_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: lp3971: Constify lp3971_ldo_ops and lp3971_dcdc_ops
Axel Lin [Sat, 26 Jan 2019 03:39:00 +0000 (11:39 +0800)]
regulator: lp3971: Constify lp3971_ldo_ops and lp3971_dcdc_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: da9052: Use lowercase regulator names to match the DT
Rob Herring [Fri, 25 Jan 2019 15:37:05 +0000 (09:37 -0600)]
regulator: da9052: Use lowercase regulator names to match the DT

Since c32569e358ad ("regulator: Use of_node_name_eq for node name
comparisons"), regulator node name comparisons are case sensitive.
The DA9052 driver uses uppercase, but the DT has lowercase.

Fix this by using a lowercase regulator name to match the DT node name.

Fixes: c32569e358ad ("regulator: Use of_node_name_eq for node name comparisons")
Cc: Support Opensource <support.opensource@diasemi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: mc13xxx: Use lowercase regulator names to match the DT
Rob Herring [Fri, 25 Jan 2019 15:37:04 +0000 (09:37 -0600)]
regulator: mc13xxx: Use lowercase regulator names to match the DT

Since c32569e358ad ("regulator: Use of_node_name_eq for node name
comparisons") Vivien reported the mc13892-regulator complaining about
not being able to find regulators.

This is because prior to that commit we used of_node_cmp() to compare
the regulator array passed from mc13892_regulators down to
mc13xxx_parse_regulators_dt() and they are all defined in uppercase
letters by the MC13892_*_DEFINE* macros, whereas they are defined as
lowercase in the DTS.

Fix this by using a lowercase regulator name to match the DT node name.

Fixes: c32569e358ad ("regulator: Use of_node_name_eq for node name comparisons")
Reported-by: Vivien Didelot <vivien.didelot@gmail.com>
Reported-by: Florian Fainelli <f.fainelli@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: bd9571mwv: Constify regulator_ops
Axel Lin [Thu, 24 Jan 2019 10:02:09 +0000 (18:02 +0800)]
regulator: bd9571mwv: Constify regulator_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: bd718x7: Constify regulator_ops
Axel Lin [Thu, 24 Jan 2019 10:02:08 +0000 (18:02 +0800)]
regulator: bd718x7: Constify regulator_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: bd70528: Constify regulator_linear_range and regulator_ops
Axel Lin [Thu, 24 Jan 2019 10:02:07 +0000 (18:02 +0800)]
regulator: bd70528: Constify regulator_linear_range and regulator_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoregulator: stpmic1: Add static const qualifier at peroper places
Axel Lin [Wed, 23 Jan 2019 12:26:39 +0000 (20:26 +0800)]
regulator: stpmic1: Add static const qualifier at peroper places

The regulator_linear_range arrays and stpmic1_regulator_cfgs are only
accessed by this driver and the values are never changed so make them
static const. regulator_ops variables can also be const.
Also clean up a few empty lines in regulator_linear_range array.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>