summaryrefslogtreecommitdiff
path: root/drivers/regulator
AgeCommit message (Collapse)Author
2020-08-26regulator: mt6360: Add support for MT6360 regulatorGene Chen
Add MT6360 regulator driver that contains two BUCKs and six LDOs Signed-off-by: Gene Chen <gene_chen@richtek.com> Link: https://lore.kernel.org/r/1598438958-26802-2-git-send-email-gene.chen.richtek@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-25Merge tag 'v5.9-rc2' into regulator-5.9Mark Brown
Linux 5.9-rc2
2020-08-24regulator: rt4801: Fix W=1 build warning when CONFIG_OF=nChiYuan Huang
Fix below warning when CONFIG_OF=n: drivers/regulator/rt4801-regulator.c:206:34: warning: unused variable 'rt4801_of_id' [-Wunused-const-variable] 206 | static const struct of_device_id rt4801_of_id[] = { | ^~~~~~~~~~~~ Signed-off-by: ChiYuan Huang <cy_huang@richtek.com> Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/r/1598234713-8532-1-git-send-email-u0084500@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-24regulator: mp886x: use "mps,switch-frequency-hz"Jisheng Zhang
As Rob suggested, use the "mps,switch-frequency-hz" instead of the "mps,switch-frequency" for switch frequency. Fortunately, the switch frequency support isn't released, so we can modify it now without any concern. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200824102402.4047fa5f@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-08-21Merge series "regulator: Fix W=1 build warning when CONFIG_OF=n" from ↵Mark Brown
Jisheng Zhang <Jisheng.Zhang@synaptics.com>: Fixing W=1 build warning when no support for device tree is there. Since v1: - fix the warning with __maybe_unused instead of CONFIG_OF macro - add 3 more patches to fix the same issue Jisheng Zhang (15): regulator: 88pg86x: Fix W=1 build warning when CONFIG_OF=n regulator: da9210: Fix W=1 build warning when CONFIG_OF=n regulator: fan53555: Fix W=1 build warning when CONFIG_OF=n regulator: fixed: Fix W=1 build warnings when CONFIG_OF=n regulator: ltc3589: Fix W=1 build warning when CONFIG_OF=n regulator: ltc3676: Fix W=1 build warning when CONFIG_OF=n regulator: max1586: Fix W=1 build warning when CONFIG_OF=n regulator: max77826: Fix W=1 build warning when CONFIG_OF=n regulator: pwm: Fix W=1 build warning when CONFIG_OF=n regulator: stm32-pwr: Fix W=1 build warning when CONFIG_OF=n regulator: stm32-vrefbuf: Fix W=1 build warning when CONFIG_OF=n regulator: sy8106a: Fix W=1 build warning when CONFIG_OF=n regulator: qcom-rpmh: Fix W=1 build warning when CONFIG_OF=n regulator: stm32-booster: Fix W=1 build warning when CONFIG_OF=n regulator: tps65023: Fix W=1 build warning when CONFIG_OF=n drivers/regulator/88pg86x.c | 2 +- drivers/regulator/da9210-regulator.c | 2 +- drivers/regulator/fan53555.c | 2 +- drivers/regulator/fixed.c | 16 ++++++++-------- drivers/regulator/ltc3589.c | 2 +- drivers/regulator/ltc3676.c | 2 +- drivers/regulator/max1586.c | 2 +- drivers/regulator/max77826-regulator.c | 2 +- drivers/regulator/pwm-regulator.c | 2 +- drivers/regulator/qcom-rpmh-regulator.c | 2 +- drivers/regulator/stm32-booster.c | 2 +- drivers/regulator/stm32-pwr.c | 2 +- drivers/regulator/stm32-vrefbuf.c | 2 +- drivers/regulator/sy8106a-regulator.c | 2 +- drivers/regulator/tps65023-regulator.c | 2 +- 15 files changed, 22 insertions(+), 22 deletions(-) -- 2.28.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2020-08-21regulator: dbx500: Remove unused debugfs goto labelFabio Estevam
The following build warning is seen after commit 8bdaa43808b7 ("regulator: dbx500: no need to check return value of debugfs_create functions"): drivers/regulator/dbx500-prcmu.c:144:1: warning: label 'exit_no_debugfs' defined but not used [-Wunused-label] Remove the unused label and its associated error message. Fixes: 8bdaa43808b7 ("regulator: dbx500: no need to check return value of debugfs_create functions") Reported-by: Olof's autobuilder <build@lixom.net> Signed-off-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/20200821144823.13404-1-festevam@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: tps65023: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/tps65023-regulator.c:319:34: warning: ‘tps65023_of_match’ defined but not used [-Wunused-const-variable=] 319 | static const struct of_device_id tps65023_of_match[] = { | ^~~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821112009.58ee8511@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: stm32-booster: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/stm32-booster.c:104:34: warning: ‘stm32_booster_of_match’ defined but not used [-Wunused-const-variable=] 104 | static const struct of_device_id stm32_booster_of_match[] = { | ^~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com> Link: https://lore.kernel.org/r/20200821111943.29b2b4ca@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: qcom-rpmh: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/qcom-rpmh-regulator.c:970:34: warning: ‘rpmh_regulator_match_table’ defined but not used [-Wunused-const-variable=] 970 | static const struct of_device_id rpmh_regulator_match_table[] = { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111913.1096f7cc@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: sy8106a: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/sy8106a-regulator.c:126:34: warning: ‘sy8106a_i2c_of_match’ defined but not used [-Wunused-const-variable=] 126 | static const struct of_device_id sy8106a_i2c_of_match[] = { | ^~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111820.5c6ddb04@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: stm32-vrefbuf: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/stm32-vrefbuf.c:287:34: warning: ‘stm32_vrefbuf_of_match’ defined but not used [-Wunused-const-variable=] 287 | static const struct of_device_id stm32_vrefbuf_of_match[] = { | ^~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com> Link: https://lore.kernel.org/r/20200821111755.4c461039@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: stm32-pwr: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/stm32-pwr.c:169:34: warning: ‘stm32_pwr_of_match’ defined but not used [-Wunused-const-variable=] 169 | static const struct of_device_id stm32_pwr_of_match[] = { | ^~~~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111726.38e0e746@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: pwm: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/pwm-regulator.c:393:34: warning: ‘pwm_of_match’ defined but not used [-Wunused-const-variable=] 393 | static const struct of_device_id pwm_of_match[] = { | ^~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111658.59a7218b@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: max77826: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/max77826-regulator.c:277:34: warning: ‘max77826_of_match’ defined but not used [-Wunused-const-variable=] 277 | static const struct of_device_id max77826_of_match[] = { | ^~~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111631.4e799c86@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: max1586: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/max1586.c:204:34: warning: ‘max1586_of_match’ defined but not used [-Wunused-const-variable=] 204 | static const struct of_device_id max1586_of_match[] = { | ^~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111601.26243417@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: ltc3676: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/ltc3676.c:371:34: warning: ‘ltc3676_of_match’ defined but not used [-Wunused-const-variable=] 371 | static const struct of_device_id ltc3676_of_match[] = { | ^~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111517.59d7b8c8@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: ltc3589: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/ltc3589.c:460:34: warning: ‘ltc3589_of_match’ defined but not used [-Wunused-const-variable=] 460 | static const struct of_device_id ltc3589_of_match[] = { | ^~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111449.7cf580f2@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: fixed: Fix W=1 build warnings when CONFIG_OF=nJisheng Zhang
Fix below warnings when CONFIG_OF=n: drivers/regulator/fixed.c:48:36: warning: ‘fixed_clkenable_data’ defined but not used [-Wunused-const-variable=] 48 | static const struct fixed_dev_type fixed_clkenable_data = { | ^~~~~~~~~~~~~~~~~~~~ drivers/regulator/fixed.c:44:36: warning: ‘fixed_voltage_data’ defined but not used [-Wunused-const-variable=] 44 | static const struct fixed_dev_type fixed_voltage_data = { | ^~~~~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111403.3e8b58a3@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: fan53555: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/fan53555.c:439:34: warning: ‘fan53555_dt_ids’ defined but not used [-Wunused-const-variable=] 439 | static const struct of_device_id fan53555_dt_ids[] = { | ^~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111324.430fe1da@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: da9210: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/da9210-regulator.c:128:34: warning: ‘da9210_dt_ids’ defined but not used [-Wunused-const-variable=] 128 | static const struct of_device_id da9210_dt_ids[] = { | ^~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Link: https://lore.kernel.org/r/20200821111235.14473a88@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: 88pg86x: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fix below warning when CONFIG_OF=n: drivers/regulator/88pg86x.c:87:34: warning: ‘pg86x_dt_ids’ defined but not used [-Wunused-const-variable=] 87 | static const struct of_device_id pg86x_dt_ids [] = { | ^~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111210.0a0bed94@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-19regulator: rt4801: Select REGMAP_I2C to fix build errorAxel Lin
Fix build error when CONFIG_REGMAP_I2C is not set. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20200819085959.1914471-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: dbx500: no need to check return value of debugfs_create functionsGreg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: linux-kernel@vger.kernel.org Link: https://lore.kernel.org/r/20200818133701.462958-1-gregkh@linuxfoundation.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: set of_node for qcom vbus regulatorJonathan Marek
This allows the regulator to be found by devm_regulator_get(). Fixes: 4fe66d5a62fb ("regulator: Add support for QCOM PMIC VBUS booster") Signed-off-by: Jonathan Marek <jonathan@marek.ca> Link: https://lore.kernel.org/r/20200818162508.5246-1-jonathan@marek.ca Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18Merge series "regulator: mp886x: two features and dt json convert" from ↵Mark Brown
Jisheng Zhang <jszhang3@mail.ustc.edu.cn> Jisheng Zhang <Jisheng.Zhang@synaptics.com>: From: Jisheng Zhang <Jisheng.Zhang@synaptics.com> This is to improve the mp886x regulator driver support. patch1 implments .set_ramp_delay patch2 and patch3 support the switch freq setting patch4 converts dt binding to json-schema Since v2: - put any schema conversions at the end of the series as Mark suggested. Jisheng Zhang (4): regulator: mp886x: implement set_ramp_delay dt-bindings: regulator: mp886x: support mps,switch-frequency regulator: mp886x: support setting switch freq dt-bindings: regulator: Convert mp886x to json-schema .../devicetree/bindings/regulator/mp886x.txt | 27 ----- .../bindings/regulator/mps,mp886x.yaml | 58 ++++++++++ drivers/regulator/mp886x.c | 109 +++++++++++++++++- 3 files changed, 164 insertions(+), 30 deletions(-) delete mode 100644 Documentation/devicetree/bindings/regulator/mp886x.txt create mode 100644 Documentation/devicetree/bindings/regulator/mps,mp886x.yaml -- 2.28.0.rc1
2020-08-18Merge series "regulator: fix deadlock vs memory reclaim" from Michał ↵Mark Brown
Mirosław <mirq-linux@rere.qmqm.pl>: For systems that have eg. eMMC storage using voltage regulator, memory reclaim path might call back into regulator subsystem. This means we have to make sure no allocations happen with a regulator or regulator list locked. After this series I see no more lockdep complaints on my test system, but please review and test further. First four patches move allocations out of locked regions, next three came as a drive-by cleanups. --- v2: fix bug in patch #4 spotted by kernel test robot reworded commit #7 description Michał Mirosław (7): regulator: push allocation in regulator_init_coupling() outside of lock regulator: push allocation in regulator_ena_gpio_request() out of lock regulator: push allocations in create_regulator() outside of lock regulator: push allocation in set_consumer_device_supply() out of lock regulator: plug of_node leak in regulator_register()'s error path regulator: cleanup regulator_ena_gpio_free() regulator: remove superfluous lock in regulator_resolve_coupling() drivers/regulator/core.c | 164 +++++++++++++++++++++------------------ 1 file changed, 87 insertions(+), 77 deletions(-) -- 2.20.1
2020-08-18regulator: qcom_spmi: Improve readability for setting up enable/mode pin controlAxel Lin
By checking data->pin_ctrl_enable / data->pin_ctrl_hpm flags first, then use switch-case to improve readability. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20200801054820.134859-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: Remove pointer table overallocationMichał Mirosław
The code allocates sizeof(regulator_dev) for a pointer. Make it less generous. Let kcalloc() calculate the size, while at it. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/407fbd06a02caf038a9ba3baa51c7d6d47cd6517.1597000795.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: rpi-panel: Add regulator/backlight driver for RPi panelMarek Vasut
This regulator/backlight driver handles the ATTINY88 present on the RPi 7" touchscreen panel and exposes the power/backlight interfaces. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Eric Anholt <eric@anholt.net> Cc: Mark Brown <broonie@kernel.org> Cc: Sam Ravnborg <sam@ravnborg.org> To: dri-devel@lists.freedesktop.org Link: https://lore.kernel.org/r/20200809105938.6388-2-marex@denx.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: Avoid grabbing regulator lock during suspend/resumeStephen Boyd
I see it takes about 5us per regulator to grab the lock, check that this regulator isn't going to do anything for suspend, and then release the lock. When that is combined with PMICs that have dozens of regulators we get into a state where we spend a few miliseconds doing a bunch of locking operations synchronously to figure out that there's nothing to do. Let's reorganize the code here a bit so that we don't grab the lock until we're actually going to do something so that suspend is a little faster. Signed-off-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Cc: Matthias Kaehlcke <mka@chromium.org> Cc: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20200804070837.1084024-1-swboyd@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: sy8827n: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang
Fixing W=1 build warning when no support for device tree is there. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200810095753.59ce9f75@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: da9211: add cache_typeHsin-Yi Wang
Add regmap_cache to reduce wakeups events of interrupt if regulator is accessed frequently. This results in saving more power. Suggested-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Link: https://lore.kernel.org/r/20200812133101.2513317-1-hsinyi@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: lp8755: Get rid of lp8755_read/lp8755_write/lp8755_update_bitsAxel Lin
Just use regmap_read/regmap_write/regmap_update_bits instead. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20200802090638.380589-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: rt4801: Add support for RT4801 Display Bias regulator driverChiYuan Huang
Adds support for the RT4801 DSV. It has two regulators (DSVP/DSVN) with an I2C interface. DSVP/DSVN can provide the display panel module for the positive/negative voltage range from (+/-)4V to (+/-)6V. Signed-off-by: ChiYuan Huang <cy_huang@richtek.com> Link: https://lore.kernel.org/r/1597461262-25878-1-git-send-email-u0084500@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: remove superfluous lock in regulator_resolve_coupling()Michał Mirosław
The code modifies rdev, but locks c_rdev instead. Remove the lock as this is held together by regulator_list_mutex taken in the caller. Fixes: f9503385b187 ("regulator: core: Mutually resolve regulators coupling") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/25eb81cefb37a646f3e44eaaf1d8ae8881cfde52.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: cleanup regulator_ena_gpio_free()Michał Mirosław
Since only regulator_ena_gpio_request() allocates rdev->ena_pin, and it guarantees that same gpiod gets same pin structure, it is enough to compare just the pointers. Also we know there can be only one matching entry on the list. Rework the code take advantage of the facts. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/3ff002c7aa3bd774491af4291a9df23541fcf892.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: plug of_node leak in regulator_register()'s error pathMichał Mirosław
By calling device_initialize() earlier and noting that kfree(NULL) is ok, we can save a bit of code in error handling and plug of_node leak. Fixed commit already did part of the work. Fixes: 9177514ce349 ("regulator: fix memory leak on error path of regulator_register()") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Vladimir Zapolskiy <vz@mleia.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/f5035b1b4d40745e66bacd571bbbb5e4644d21a1.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: push allocation in set_consumer_device_supply() out of lockMichał Mirosław
Pull regulator_list_mutex into set_consumer_device_supply() and keep allocations outside of it. Fourth of the fs_reclaim deadlock case. Fixes: 45389c47526d ("regulator: core: Add early supply resolution for regulators") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/f0380bdb3d60aeefa9693c4e234d2dcda7e56747.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: push allocations in create_regulator() outside of lockMichał Mirosław
Move all allocations outside of the regulator_lock()ed section. ====================================================== WARNING: possible circular locking dependency detected 5.7.13+ #535 Not tainted ------------------------------------------------------ f2fs_discard-179:7/702 is trying to acquire lock: c0e5d920 (regulator_list_mutex){+.+.}-{3:3}, at: regulator_lock_dependent+0x54/0x2c0 but task is already holding lock: cb95b080 (&dcc->cmd_lock){+.+.}-{3:3}, at: __issue_discard_cmd+0xec/0x5f8 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: [...] -> #3 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire.part.11+0x40/0x50 fs_reclaim_acquire+0x24/0x28 __kmalloc_track_caller+0x54/0x218 kstrdup+0x40/0x5c create_regulator+0xf4/0x368 regulator_resolve_supply+0x1a0/0x200 regulator_register+0x9c8/0x163c [...] other info that might help us debug this: Chain exists of: regulator_list_mutex --> &sit_i->sentry_lock --> &dcc->cmd_lock [...] Fixes: f8702f9e4aa7 ("regulator: core: Use ww_mutex for regulators locking") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/6eebc99b2474f4ffaa0405b15178ece0e7e4f608.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: push allocation in regulator_ena_gpio_request() out of lockMichał Mirosław
Move another allocation out of regulator_list_mutex-protected region, as reclaim might want to take the same lock. WARNING: possible circular locking dependency detected 5.7.13+ #534 Not tainted ------------------------------------------------------ kswapd0/383 is trying to acquire lock: c0e5d920 (regulator_list_mutex){+.+.}-{3:3}, at: regulator_lock_dependent+0x54/0x2c0 but task is already holding lock: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire.part.11+0x40/0x50 fs_reclaim_acquire+0x24/0x28 kmem_cache_alloc_trace+0x40/0x1e8 regulator_register+0x384/0x1630 devm_regulator_register+0x50/0x84 reg_fixed_voltage_probe+0x248/0x35c [...] other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(fs_reclaim); lock(regulator_list_mutex); lock(fs_reclaim); lock(regulator_list_mutex); *** DEADLOCK *** [...] 2 locks held by kswapd0/383: #0: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 #1: cb70e5e0 (hctx->srcu){....}-{0:0}, at: hctx_lock+0x60/0xb8 [...] Fixes: 541d052d7215 ("regulator: core: Only support passing enable GPIO descriptors") [this commit only changes context] Fixes: f8702f9e4aa7 ("regulator: core: Use ww_mutex for regulators locking") [this is when the regulator_list_mutex was introduced in reclaim locking path] Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/41fe6a9670335721b48e8f5195038c3d67a3bf92.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: push allocation in regulator_init_coupling() outside of lockMichał Mirosław
Allocating memory with regulator_list_mutex held makes lockdep unhappy when memory pressure makes the system do fs_reclaim on eg. eMMC using a regulator. Push the lock inside regulator_init_coupling() after the allocation. ====================================================== WARNING: possible circular locking dependency detected 5.7.13+ #533 Not tainted ------------------------------------------------------ kswapd0/383 is trying to acquire lock: cca78ca4 (&sbi->write_io[i][j].io_rwsem){++++}-{3:3}, at: __submit_merged_write_cond+0x104/0x154 but task is already holding lock: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire.part.11+0x40/0x50 fs_reclaim_acquire+0x24/0x28 __kmalloc+0x54/0x218 regulator_register+0x860/0x1584 dummy_regulator_probe+0x60/0xa8 [...] other info that might help us debug this: Chain exists of: &sbi->write_io[i][j].io_rwsem --> regulator_list_mutex --> fs_reclaim Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(fs_reclaim); lock(regulator_list_mutex); lock(fs_reclaim); lock(&sbi->write_io[i][j].io_rwsem); *** DEADLOCK *** 1 lock held by kswapd0/383: #0: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 [...] Fixes: d8ca7d184b33 ("regulator: core: Introduce API for regulators coupling customization") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/1a889cf7f61c6429c9e6b34ddcdde99be77a26b6.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17Merge existing fixes from regulator/for-5.9Mark Brown
2020-08-10regulator: fix spelling mistake "Cant" -> "Can't"Colin Ian King
There is a spelling mistake in a dev_err message. Fix it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20200810093931.50624-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-04regulator: cros-ec-regulator: Add NULL test for devm_kmemdup callAxel Lin
Fix possible NULL pointer dereference. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20200802032509.305425-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-31regulator: mp886x: support setting switch freqJisheng Zhang
Both MP8867 and MP8869 support different switch frequency. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200729131023.77cc1dd2@xhacker Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-31regulator: mp886x: implement set_ramp_delayJisheng Zhang
Implement the .set_ramp_delay for MP8867 and MP8869. MP8867 and MP8869 could share the implementation, the only difference is the slew_rates array. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200729130913.3ac38b32@xhacker Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-30Merge remote-tracking branch 'regulator/for-5.9' into regulator-nextMark Brown
2020-07-28regulator: cros-ec-regulator: Fix double free of desc->name.Pi-Hsun Shih
The desc->name field is allocated with devm_kstrdup, but is also kfreed on the error path, causing it to be double freed. Remove the kfree on the error path. Fixes: 8d9f8d57e023 ("regulator: Add driver for cros-ec-regulator") Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20200728091909.2009771-1-pihsun@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-27regulator: pca9450: Convert to use module_i2c_driverAxel Lin
Use module_i2c_driver to simplify driver init boilerplate. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20200725014414.1825183-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>