aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-03-04regulator: mc13xxx: Constify regulator_ops variablesAxel Lin4-10/+10
These regulator_ops variables should never change, make them const. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-04regulator: palmas: Constify palmas_smps_ramp_delay arrayAxel Lin1-1/+1
The palmas_smps_ramp_delay array should never modify, make it const. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-04regulator: wm831x-dcdc: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-36/+6
Use regulator_set/get_current_limit_regmap helpers to save some 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>
2019-03-04regulator: pv88090: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-45/+8
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>
2019-03-03regulator: pv88080: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-47/+8
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>
2019-03-03regulator: pv88060: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-44/+7
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>
2019-03-03Merge branch 'for-5.0' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-5.1Mark Brown5-7/+8
2019-03-03regulator: max77650: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-49/+25
Use regulator_set/get_current_limit_regmap helpers to save some code. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-03regulator: lp873x: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-39/+6
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>
2019-03-03regulator: lp872x: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-60/+10
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>
2019-03-03regulator: da9210: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-46/+7
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>
2019-03-03regulator: da9055: Convert to use regulator_set/get_current_limit_regmapAxel Lin1-36/+9
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>
2019-03-03regulator: core: Add set/get_current_limit helpers for regmap usersAxel Lin1-0/+86
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-02-28regulator: stm32-vrefbuf: add power management supportFabrice Gasnier1-7/+114
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>
2019-02-26regulator: 88pm8607: Remove unused fields from struct pm8607_regulator_infoAxel Lin1-14/+5
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>
2019-02-26regulator: 88pm8607: Simplify pm8607_list_voltage implementationAxel Lin1-9/+10
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>
2019-02-26regulator: cpcap: Constify omap4_regulators and xoom_regulatorsAxel Lin1-2/+2
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>
2019-02-26regulator: cpcap: Remove unused vsel_shift from struct cpcap_regulatorAxel Lin1-52/+50
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>
2019-02-26regulator: da9062: Use struct_size() in devm_kzalloc()Gustavo A. R. Silva1-4/+2
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>
2019-02-26regulator: mcp16502: Remove module versionAxel Lin1-1/+0
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>
2019-02-26regulator: fan53555: Check pdata->slew_rate settingAxel Lin1-3/+5
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>
2019-02-26regulator: arizona_ldo1: Simplify arizona_ldo1_hc_set/get_voltage_selAxel Lin1-13/+6
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>
2019-02-26regulator: wm831x-dcdc: Fix list of wm831x_dcdc_ilim from mA to uAAxel Lin1-2/+2
The wm831x_dcdc_ilim entries needs to be uA because it is used to compare with min_uA and max_uA. While at it also make the array const and change to use unsigned int. Fixes: e4ee831f949a ("regulator: Add WM831x DC-DC buck convertor support") 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>
2019-02-22regulator: da9063: Use struct_size() in devm_kzalloc()Gustavo A. R. Silva1-4/+2
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>
2019-02-22regulator: mt6311: Use linear instead of linear range for mt6311_buck_opsAxel Lin1-8/+2
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>
2019-02-22regulator: max77650: Fix set_current_limit implementationAxel Lin1-4/+2
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>
2019-02-22regulator: tps65218: Add support for LS2Christian Hohnstaedt1-5/+13
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>
2019-02-21regulator: s5m8767: Simplify s5m8767_set_voltage_time_sel implementationAxel Lin1-5/+1
Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-21regulator: s5m8767: Constify s5m8767_opmode_regAxel Lin1-1/+1
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>
2019-02-21regulator: core: Log forbidden DRMS operationMarc Gonzalez1-1/+3
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>
2019-02-21regulator: lp873x: Constify lp873x_buck_ramp_delay arrayAxel Lin1-1/+1
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>
2019-02-21regulator: fan53555: Add support for FAN53526Bjorn Andersson1-10/+91
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>
2019-02-20regulator: twl6030: Constify regulator_opsAxel Lin1-4/+4
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-20regulator: twl6030: Use regulator_list_voltage_linear_range for twl6030ldo_opsAxel Lin1-46/+27
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>
2019-02-20regulator: max77650: Add missing .owner field in regulator_descAxel Lin1-0/+6
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>
2019-02-20regulator: max77620: Add missing .owner field in regulator_descAxel Lin1-0/+2
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>
2019-02-20regulator: tps65218.c: fix LS3 issuesChristian Hohnstaedt1-2/+3
- Fix list of valid LS3 currents from mA to µA - Fix selection of min/max microAmps of LS3. Selecting one of the configured values as max value now really selects it instead of the next lower one Signed-off-by: Christian Hohnstaedt <Christian.Hohnstaedt@wago.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-19regulator: axp20x: remove a redundant null check on rdevColin Ian King1-3/+0
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>
2019-02-19regulator: da9063: Select maximum current in specific range for set_current_limitAxel Lin1-1/+1
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>
2019-02-19regulator: da9062: Select maximum current in specific range for set_current_limitAxel Lin1-1/+1
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>
2019-02-19regulator: pv88090: Fix array out-of-bounds accessAxel Lin1-1/+1
Fix off-by-one while iterating current_limits array. The valid index should be 0 ~ n_current_limits -1. Fixes: c90456e36d9c ("regulator: pv88090: new regulator driver") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-19regulator: pv88080: Fix array out-of-bounds accessAxel Lin1-1/+1
Fix off-by-one while iterating current_limits array. The valid index should be 0 ~ n_current_limits -1. Fixes: 99cf3af5e2d5 ("regulator: pv88080: new regulator driver") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-19regulator: pv88060: Fix array out-of-bounds accessAxel Lin1-1/+1
Fix off-by-one while iterating current_limits array. The valid index should be 0 ~ n_current_limits -1. Fixes: f307a7e9b7af ("regulator: pv88060: new regulator driver") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-19Merge branch 'regulator-5.0' into regulator-5.1 stpmic1 const/rangeMark Brown13-144/+153
2019-02-19regulator: stpmic1: Change buck1 voltage rangePascal PAILLET-LME1-3/+4
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>
2019-02-19regulator: stpmic1: Add active discharge supportPascal PAILLET-LME1-13/+55
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>
2019-02-19regulator: stpmic1: Remove support for regulator pull downPascal PAILLET-LME1-12/+0
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>
2019-02-19regulator: stpmic1: Simplify regulators registrationPascal PAILLET-LME1-116/+52
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>
2019-02-19regulator: stpmic1: Use regulator mode definition from bindingsPascal PAILLET-LME1-3/+2
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>
2019-02-19regulator: core: Drop lockdep annotation in drms_uA_update()Niklas Cassel1-2/+0
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>