aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
AgeCommit message (Collapse)AuthorFilesLines
5 daysMerge tag 'regulator-v6.10' of ↵Linus Torvalds20-62/+583
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator updates from Mark Brown: "There's one API update here, a new API factoring out a common pattern for reference voltage supplies. These are supplies used as a reference by analogue circuits where the consumer requests and enables the supply, reads the voltage to calibrate the user and then never touches it again. This is factored out into a single operation which just returns the voltage and uses devm_ to manage the request and enable portion. Otherwise this has been a very quiet release, we've got some new device support, some small fixes, housekeeping and cleanup work but nothing substantial. There's also some non-regulator changes in here, a number of users for the new reference voltage API were merged along with it and some MFD changes were pulled in as dependencies for new driver work. Highlights: - Add a new API for single operation handling of reference voltages - Support for Allwinner AXP717 and D1, and NXP PCA9561A" * tag 'regulator-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (33 commits) regulator: sun20i: Add Allwinner D1 LDOs driver regulator: dt-bindings: Add Allwinner D1 system LDOs regulator: Mention regulator id in error message about dummy supplies staging: iio: impedance-analyzer: ad5933: Use devm_regulator_get_enable_read_voltage() iio: frequency: admv1013: Use devm_regulator_get_enable_read_voltage() iio: addac: ad74115: Use devm_regulator_get_enable_read_voltage() hwmon: (adc128d818) simplify final return in probe regulator: devres: fix devm_regulator_get_enable_read_voltage() return hwmon: (da9052) Use devm_regulator_get_enable_read_voltage() hwmon: (adc128d818) Use devm_regulator_get_enable_read_voltage() regulator: devres: add API for reference voltage supplies regulator: rtq2208: Fix LDO discharge register and add vsel setting regulator: dt-bindings: fixed-regulator: Add a preferred node name regulator: axp20x: add support for the AXP717 mfd: axp20x: Add support for AXP717 PMIC dt-bindings: mfd: x-powers,axp152: Document AXP717 regulator: axp20x: fix typo-ed identifier dt-bindings: regulator: qcom,usb-vbus-regulator: Add PM7250B compatible regulator: pca9450: add pca9451a support regulator: dt-bindings: pca9450: add pca9451a support ...
10 daysregulator: sun20i: Add Allwinner D1 LDOs driverSamuel Holland3-0/+166
D1 contains two pairs of LDOs, "analog" LDOs and "system" LDOs. They are similar and can share a driver, but only the system LDOs have a DT binding defined so far. The system LDOs have a single linear range. The voltage step is not an integer, so a custom .list_voltage is needed to get the rounding right. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Chen-Yu Tsai <wens@csie.org> Link: https://lore.kernel.org/r/20240509153107.438220-3-wens@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
10 daysregulator: core: fix debugfs creation regressionJohan Hovold1-11/+16
regulator_get() may sometimes be called more than once for the same consumer device, something which before commit dbe954d8f163 ("regulator: core: Avoid debugfs: Directory ... already present! error") resulted in errors being logged. A couple of recent commits broke the handling of such cases so that attributes are now erroneously created in the debugfs root directory the second time a regulator is requested and the log is filled with errors like: debugfs: File 'uA_load' in directory '/' already present! debugfs: File 'min_uV' in directory '/' already present! debugfs: File 'max_uV' in directory '/' already present! debugfs: File 'constraint_flags' in directory '/' already present! on any further calls. Fixes: 2715bb11cfff ("regulator: core: Fix more error checking for debugfs_create_dir()") Fixes: 08880713ceec ("regulator: core: Streamline debugfs operations") Cc: stable@vger.kernel.org Cc: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20240509133304.8883-1-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
12 daysregulator: Mention regulator id in error message about dummy suppliesUwe Kleine-König1-2/+2
With the name that is currently looked up it is considerably easier to understand the issue and fix the warning. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20240507104703.2070117-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
13 daysregulator: devres: fix devm_regulator_get_enable_read_voltage() returnDavid Lechner1-1/+1
The devm_regulator_get_enable_read_voltage() function is supposed to return the voltage that the regulator is currently set to. However, it currently returns 0. Fixes: b250c20b6429 ("regulator: devres: add API for reference voltage supplies") Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20240506-regulator-devm_regulator_get_enable_read_voltage-fixes-v1-1-356cdd152067@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
14 daysregulator: new API for voltage reference suppliesMark Brown2-0/+66
Merge series from David Lechner <dlechner@baylibre.com>: In the IIO subsystem, we noticed a pattern in many drivers where we need to get, enable and get the voltage of a supply that provides a reference voltage. In these cases, we only need the voltage and not a handle to the regulator. Another common pattern is for chips to have an internal reference voltage that is used when an external reference is not available. There are also a few drivers outside of IIO that do the same. So we would like to propose a new regulator consumer API to handle these specific cases to avoid repeating the same boilerplate code in multiple drivers. As an example of how these functions are used, I have included a few patches to consumer drivers. But to avoid a giant patch bomb, I have omitted the iio/adc and iio/dac patches I have prepared from this series. I will send those separately but these will add 36 more users of devm_regulator_get_enable_read_voltage() in addition to the 6 here. In total, this will eliminate nearly 1000 lines of similar code and will simplify writing and reviewing new drivers in the future.
2024-05-03regulator: devres: add API for reference voltage suppliesDavid Lechner1-0/+59
A common use case for regulators is to supply a reference voltage to an analog input or output device. This adds a new devres API to get, enable, and get the voltage in a single call. This allows eliminating boilerplate code in drivers that use reference supplies in this way. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20240429-regulator-get-enable-get-votlage-v2-1-b1f11ab766c1@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-01regulator: rtq2208: Fix LDO discharge register and add vsel settingAlina Yu1-39/+61
The LDO's Vout is adjustable if the hardware setting allows it, and it can be set either 1800mv or 3300mv. Additionally, the discharge register has been moved to another position. Signed-off-by: Alina Yu <alina_yu@richtek.com> Link: https://lore.kernel.org/r/5d56b79c94de63fc86b5a70b7e374da4240fee8b.1714467553.git.alina_yu@richtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-01regulator: rtq2208: Fix the BUCK ramp_delay range to maximum of 16mVstep/usAlina Yu1-4/+3
The maximum ramp up and down range of BUCK are shorten from 64mVstep/us to 16mVstep/us. Therefore, the RTQ2208_RAMP_VALUE_MAX_uV is modified to 16000uV in this version. Signed-off-by: Alina Yu <alina_yu@richtek.com> Link: https://lore.kernel.org/r/1777b18c0faa1f6b7196630e679a03362686c301.1714467553.git.alina_yu@richtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-04-10regulator: vqmmc-ipq4019: fix module autoloadingKrzysztof Kozlowski1-0/+1
Add MODULE_DEVICE_TABLE(), so the module could be properly autoloaded based on the alias from of_device_id table. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://msgid.link/r/20240410172615.255424-2-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-04-10regulator: qcom-refgen: fix module autoloadingKrzysztof Kozlowski1-0/+1
Add MODULE_DEVICE_TABLE(), so the module could be properly autoloaded based on the alias from of_device_id table. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://msgid.link/r/20240410172615.255424-1-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-04-09regulator: mt6360: De-capitalize devicetree regulator subnodesAngeloGioacchino Del Regno1-12/+20
The MT6360 regulator binding, the example in the MT6360 mfd binding, and the devicetree users of those bindings are rightfully declaring MT6360 regulator subnodes with non-capital names, and luckily without using the deprecated regulator-compatible property. With this driver declaring capitalized BUCKx/LDOx as of_match string for the node names, obviously no regulator gets probed: fix that by changing the MT6360_REGULATOR_DESC macro to add a "match" parameter which gets assigned to the of_match. Fixes: d321571d5e4c ("regulator: mt6360: Add support for MT6360 regulator") Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://msgid.link/r/20240409144438.410060-1-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-04-08regulator: irq_helpers: duplicate IRQ nameMatti Vaittinen1-0/+3
The regulator IRQ helper requires caller to provide pointer to IRQ name which is kept in memory by caller. All other data passed to the helper in the regulator_irq_desc structure is copied. This can cause some confusion and unnecessary complexity. Make the regulator_irq_helper() to copy also the provided IRQ name information so caller can discard the name after the call to regulator_irq_helper() completes. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://msgid.link/r/ZhJMuUYwaZbBXFGP@drtxq0yyyyyyyyyyyyydy-3.rev.dnainternet.fi Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-28regulator: Merge axp20x changesMark Brown1-5/+89
There will be at least one incremental change on top of some MFD overlapping device additions for this driver so merge now. Merge tag 'ib-mfd-regulator-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into regulator-6.10
2024-03-28regulator: axp20x: add support for the AXP717Andre Przywara1-0/+84
The X-Powers AXP717 is a typical PMIC from X-Powers, featuring four DC/DC converters and 15 LDOs, on the regulator side. Describe the chip's voltage settings and switch registers, how the voltages are encoded, and connect this to the MFD device via its regulator ID. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Mark Brown <broonie@kernel.org> Tested-by: Ryan Walklin <ryan@testtoast.com> Link: https://lore.kernel.org/r/20240310010211.28653-5-andre.przywara@arm.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28regulator: axp20x: fix typo-ed identifierAndre Przywara1-5/+5
The registers to set the X-Powers AXP313 regulators are of course "CONTROL" registers, not "CONRTOL" ones. Fix the typo in the header file and in its users. No functional change. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Tested-by: Ryan Walklin <ryan@testtoast.com> Link: https://lore.kernel.org/r/20240310010211.28653-2-andre.przywara@arm.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-26regulator: convert to use maple tree registerMark Brown13-14/+14
Merge series from Bo Liu <liubo03@inspur.com>: The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Bo Liu (13): regulator: da9121: convert to use maple tree register cache regulator: da9211: convert to use maple tree register cache regulator: isl9305: convert to use maple tree register cache regulator: max8973: convert to use maple tree register cache regulator: mt6311: convert to use maple tree register cache regulator: pca9450: convert to use maple tree register cache regulator: pf8x00: convert to use maple tree register cache regulator: pfuze100: convert to use maple tree register cache regulator: rtmv20: convert to use maple tree register cache regulator: rtq6752: convert to use maple tree register cache regulator: tps51632: convert to use maple tree register cache regulator: tps62360: convert to use maple tree register cache regulator: rpi-panel-attiny: convert to use maple tree register cache drivers/regulator/da9121-regulator.c | 4 ++-- drivers/regulator/da9211-regulator.c | 2 +- drivers/regulator/isl9305.c | 2 +- drivers/regulator/max8973-regulator.c | 2 +- drivers/regulator/mt6311-regulator.c | 2 +- drivers/regulator/pca9450-regulator.c | 2 +- drivers/regulator/pf8x00-regulator.c | 2 +- drivers/regulator/pfuze100-regulator.c | 2 +- drivers/regulator/rpi-panel-attiny-regulator.c | 2 +- drivers/regulator/rtmv20-regulator.c | 2 +- drivers/regulator/rtq6752-regulator.c | 2 +- drivers/regulator/tps51632-regulator.c | 2 +- drivers/regulator/tps62360-regulator.c | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) -- 2.18.2
2024-03-25regulator: tps65132: Add of_match tableAndré Apitzsch1-0/+7
Add of_match table for "ti,tps65132" compatible string. This fixes automatic driver loading when using device-tree, and if built as a module like major linux distributions do. Signed-off-by: André Apitzsch <git@apitzsch.eu> Link: https://msgid.link/r/20240325-of_tps65132-v1-1-86a5f7ef4ede@apitzsch.eu Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: pca9450: add pca9451a supportJoy Zou1-2/+192
Adding support for new pmic pca9451a. Signed-off-by: Joy Zou <joy.zou@nxp.com> Link: https://msgid.link/r/20240318095633.4079027-3-joy.zou@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: rpi-panel-attiny: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-14-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: tps62360: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-13-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: tps51632: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-12-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: rtq6752: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-11-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: rtmv20: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-10-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: pfuze100: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-9-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: pf8x00: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-8-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: pca9450: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-7-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: mt6311: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-6-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: max8973: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-5-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: isl9305: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-4-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: da9211: convert to use maple tree register cacheBo Liu1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-3-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-25regulator: da9121: convert to use maple tree register cacheBo Liu1-2/+2
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://msgid.link/r/20240320085740.4604-2-liubo03@inspur.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-22Merge tag 'regulator-fix-v6.9-merge-window' of ↵Linus Torvalds1-0/+11
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator fix from Mark Brown: "One fix that came in during the merge window, fixing a problem with bootstrapping the state of exclusive regulators which have a parent regulator" * tag 'regulator-fix-v6.9-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: core: Propagate the regulator state in case of exclusive get
2024-03-14Merge tag 'mm-nonmm-stable-2024-03-14-09-36' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Pull non-MM updates from Andrew Morton: - Kuan-Wei Chiu has developed the well-named series "lib min_heap: Min heap optimizations". - Kuan-Wei Chiu has also sped up the library sorting code in the series "lib/sort: Optimize the number of swaps and comparisons". - Alexey Gladkov has added the ability for code running within an IPC namespace to alter its IPC and MQ limits. The series is "Allow to change ipc/mq sysctls inside ipc namespace". - Geert Uytterhoeven has contributed some dhrystone maintenance work in the series "lib: dhry: miscellaneous cleanups". - Ryusuke Konishi continues nilfs2 maintenance work in the series "nilfs2: eliminate kmap and kmap_atomic calls" "nilfs2: fix kernel bug at submit_bh_wbc()" - Nathan Chancellor has updated our build tools requirements in the series "Bump the minimum supported version of LLVM to 13.0.1". - Muhammad Usama Anjum continues with the selftests maintenance work in the series "selftests/mm: Improve run_vmtests.sh". - Oleg Nesterov has done some maintenance work against the signal code in the series "get_signal: minor cleanups and fix". Plus the usual shower of singleton patches in various parts of the tree. Please see the individual changelogs for details. * tag 'mm-nonmm-stable-2024-03-14-09-36' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (77 commits) nilfs2: prevent kernel bug at submit_bh_wbc() nilfs2: fix failure to detect DAT corruption in btree and direct mappings ocfs2: enable ocfs2_listxattr for special files ocfs2: remove SLAB_MEM_SPREAD flag usage assoc_array: fix the return value in assoc_array_insert_mid_shortcut() buildid: use kmap_local_page() watchdog/core: remove sysctl handlers from public header nilfs2: use div64_ul() instead of do_div() mul_u64_u64_div_u64: increase precision by conditionally swapping a and b kexec: copy only happens before uchunk goes to zero get_signal: don't initialize ksig->info if SIGNAL_GROUP_EXIT/group_exec_task get_signal: hide_si_addr_tag_bits: fix the usage of uninitialized ksig get_signal: don't abuse ksig->info.si_signo and ksig->sig const_structs.checkpatch: add device_type Normalise "name (ad@dr)" MODULE_AUTHORs to "name <ad@dr>" dyndbg: replace kstrdup() + strchr() with kstrdup_and_replace() list: leverage list_is_head() for list_entry_is_head() nilfs2: MAINTAINERS: drop unreachable project mirror site smp: make __smp_processor_id() 0-argument macro fat: fix uninitialized field in nostale filehandles ...
2024-03-13Merge tag 'regulator-v6.9' of ↵Linus Torvalds15-283/+428
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator updates from Mark Brown: "This has been a very quiet release, mostly cleanups, API updates and simple device additions. I messed up slightly and there are a couple of duplicated commits resulting from me leaving things in my inbox which didn't seem worth removing by the time I noticed them. - Conversion of several drivers to GPIO descriptors - Build out the features of of the MP8859 driver - Support for Qualcomm PM4125 and PM6150" * tag 'regulator-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (31 commits) regulator: lp8788-buck: fix copy and paste bug in lp8788_dvs_gpio_request() regulator: core: make regulator_class constant regulator: da9121: Remove unused of_gpio.h regulator: userspace-consumer: add module device table regulator: dt-bindings: gpio-regulator: Fix "gpios-states" and "states" array bounds regulator: mp8859: Implement set_current_limit() regulator: mp8859: Report slew rate regulator: mp8859: Support status and error readback regulator: mp8859: Support active discharge control regulator: mp8859: Support mode operations regulator: mp8859: Support enable control regulator: mp8859: Validate and log device identifier information regulator: mp8859: Specify register accessibility and enable caching regulator: max8998: Convert to GPIO descriptors regulator: max8997: Convert to GPIO descriptors regulator: lp8788-buck: Fully convert to GPIO descriptors regulator: da9055: Fully convert to GPIO descriptors regulator: max8973: Finalize switch to GPIO descriptors regulator: dt-bindings: qcom,usb-vbus-regulator: add support for PM4125 regulator: dt-bindings: qcom,usb-vbus-regulator: add support for PM4125 ...
2024-03-12regulator: core: Propagate the regulator state in case of exclusive getKory Maincent1-0/+11
Previously, performing an exclusive get on an already-enabled regulator resulted in inconsistent state initialization between child and parent regulators. While the child's counts were updated, its parent's counters remained unaffected. Consequently, attempting to disable an already-enabled exclusive regulator triggered unbalanced disables warnings from its parent regulator. This commit addresses the issue by propagating the enable state to the parent regulator using a regulator_enable call. This ensures consistent state management across the regulator hierarchy, preventing warnings! Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> Link: https://msgid.link/r/20240312091638.1266167-1-kory.maincent@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-06regulator: lp8788-buck: fix copy and paste bug in lp8788_dvs_gpio_request()Dan Carpenter1-3/+3
"gpio2" as intended here, not "gpio1". Fixes: 95daa868f22b ("regulator: lp8788-buck: Fully convert to GPIO descriptors") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://msgid.link/r/19f62cc2-bdcf-46f7-a5c5-971ef05e1ea7@moroto.mountain Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-05regulator: core: make regulator_class constantRicardo B. Marliere2-2/+2
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the regulator_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Link: https://msgid.link/r/20240305-class_cleanup-regulator-v1-1-4950345d6d8f@marliere.net Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-04regulator: rk808: fix LDO range on RK806Quentin Schulz1-2/+2
The linear ranges aren't really matching what they should be. Indeed, the range is inclusive of the min value, so it makes sense the previous range does NOT include the max step value representing the min value of the range in question. Since 3.4V is represented by the decimal value 232, the previous range max step value should be 231 and not 232. No expected change in behavior since 3.4V was mapped with step 232 from the first range but is now mapped with step 232 from the second range. While at it, remove the incorrect comment from the second range. Fixes: f991a220a447 ("regulator: rk808: add rk806 support") Cc: Quentin Schulz <foss+kernel@0leil.net> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Link: https://msgid.link/r/20240223-rk806-regulator-ranges-v1-2-3904ab70d250@theobroma-systems.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-03-04regulator: rk808: fix buck range on RK806Quentin Schulz1-3/+3
The linear ranges aren't really matching what they should be. Indeed, the range is inclusive of the min value, so it makes sense the previous range does NOT include the max step value representing the min value of the range in question. Since 1.5V is represented by the decimal value 160, the previous range max step value should be 159 and not 160. Similarly, 3.4V is represented by the decimal value 236, so the previous range max value should be 235 and not 237. The only change in behavior this makes is that this actually modeled the ranges to map step with decimal value 237 with 3.65V instead of 3.4V (the max supported by the HW). Fixes: f991a220a447 ("regulator: rk808: add rk806 support") Cc: Quentin Schulz <foss+kernel@0leil.net> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Link: https://msgid.link/r/20240223-rk806-regulator-ranges-v1-1-3904ab70d250@theobroma-systems.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-29regulator: da9121: Remove unused of_gpio.hAndy Shevchenko1-1/+0
of_gpio.h is deprecated and subject to remove. The driver doesn't use it, simply remove the unused header. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://msgid.link/r/20240228195730.3607154-1-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Cleanups and enhancementsMark Brown1-1/+251
Merge series from Mark Brown <broonie@kernel.org>: I had cause to look at the MP8859 driver together with the datasheet and noticed a few small issues and missing features. This series deals with many of these issues, the device also has support for interrupts which are not implemented here.
2024-02-26Convert some regulator drivers to GPIO descriptorsMark Brown5-242/+141
Merge series from Linus Walleij <linus.walleij@linaro.org>: Despite the work to convert the regulator core to GPIO descriptors, there are some outliers that use legacy GPIO numbers in various ways. Convert them all over.
2024-02-26regulator: userspace-consumer: add module device tableJohn Keeping1-0/+1
The userspace consumer can be built as a module but it cannot be automatically probed as there is no device table to match it up with device tree nodes. Add the missing macro so that the module can load automatically. Fixes: 5c51d4afcf3fd ("regulator: userspace-consumer: Handle regulator-output DT nodes") Signed-off-by: John Keeping <jkeeping@inmusicbrands.com> Link: https://msgid.link/r/20240226160554.1453283-1-jkeeping@inmusicbrands.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Implement set_current_limit()Mark Brown1-0/+55
The mp8859 implements support for current limiting, provide support for configuring this via the driver. The datasheet recommends that if the device has hit the current limit then any changes should be implemented via a ramp so we do so in the driver. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-8-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Report slew rateMark Brown1-0/+15
The MP8859 implements voltage changes at the rate of 1mV/us, tell the core about this so that it can provide appropriate delays on voltage changes. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-7-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Support status and error readbackMark Brown1-0/+59
The MP8859 can report if it is in regulation and detect over temperature conditions, report this information via the relevant regulator API calls. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-6-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Support active discharge controlMark Brown1-0/+5
The MP8859 can actively discharge the output when disabled, add support for controlling this feature. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-5-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Support mode operationsMark Brown1-0/+39
The MP8859 provides mode control, implement the relevant regulator API operations. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-4-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Support enable controlMark Brown1-0/+7
The MP8859 provides a software enable control, support it in the regulator driver. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-3-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Validate and log device identifier informationMark Brown1-0/+34
Ensure that we are talking to a device which reports the expected ID register information and log the OTP and revision information for diagnostic purposes. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-2-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: mp8859: Specify register accessibility and enable cachingMark Brown1-1/+37
Avoid needless accesses to the hardware by caching register values that we know, marking status registers as volatile as appropriate. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-1-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: max8998: Convert to GPIO descriptorsLinus Walleij1-96/+54
This rewrites the max8998 regulator driver to fetch the dvs regulators as descriptors. This will likely mostly come from the device tree since there are no in-tree users of the platform data, but supplying GPIO descriptor tables from board files is also possible if needed. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://msgid.link/r/20240220-descriptors-regulators-v1-5-097f608694be@linaro.org Acked-by: Lee Jones <lee@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: max8997: Convert to GPIO descriptorsLinus Walleij1-60/+25
This rewrites the max8997 regulator driver to fetch the dvs regulators as descriptors. This will likely mostly come from the device tree since there are no in-tree users of the platform data, but supplying GPIO descriptor tables from board files is also possible if needed. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://msgid.link/r/20240220-descriptors-regulators-v1-4-097f608694be@linaro.org Acked-by: Lee Jones <lee@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: lp8788-buck: Fully convert to GPIO descriptorsLinus Walleij1-38/+26
This converts the LP8788 BUCK regulator driver to use GPIO descriptors. BUCK1 can use one DVS GPIO and BUCK2 can use two DVS GPIOS, and no more so just hardcode two GPIO descriptors into the per-DVS state containers. Obtain the descriptors from each regulators subdevice. As there are no in-tree users, board files need to populate descriptor tables for the buck regulator devices when they want to use this driver. BUCK1 need a GPIO descriptor at index 0 and BUCK2 needs two GPIO descriptors at indices 0 and 1. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://msgid.link/r/20240220-descriptors-regulators-v1-3-097f608694be@linaro.org Acked-by: Lee Jones <lee@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: da9055: Fully convert to GPIO descriptorsLinus Walleij1-24/+24
The DA9055 regulator was touched before, requireing enable GPIOs to be passed from pdata. As we have a device for each regulator, obtain the three gpios ren ("regulator enable"), rsel ("regulator select") and the ena ("enable") GPIO associated with the regulator enable directly from the device and cut down on the amount of GPIO numbers passed as platform data. The ren and rsel are just requested as inputs: these are actually handled by hardware. The ena gpios are driven actively by the regulator core. There are no in-tree users, but the regulators are instantiated from the (undocumed) device tree nodes with "dlg,da9055-regulator" as compatible, and by simply adding regulator-enable-gpios, regulator-select-gpios and enable-gpios to this DT node, all will work as before. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://msgid.link/r/20240220-descriptors-regulators-v1-2-097f608694be@linaro.org Acked-by: Lee Jones <lee@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-26regulator: max8973: Finalize switch to GPIO descriptorsLinus Walleij1-24/+12
The dvs gpio was still using a legacy number passed from the platform data. There are no in-tree users of the platform data so just switch it to a gpio descriptor and obtain it in probe(), the device tree users will work just as fine with this. Drop the entirely unused enable_gpio from the platform data as well. The device tree bindings mentions this but the driver does not look for it and makes no use of it: it should probably be implemented properly in a separate patch. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://msgid.link/r/20240220-descriptors-regulators-v1-1-097f608694be@linaro.org Acked-by: Lee Jones <lee@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-22treewide: update LLVM Bugzilla linksNathan Chancellor1-1/+1
LLVM moved their issue tracker from their own Bugzilla instance to GitHub issues. While all of the links are still valid, they may not necessarily show the most up to date information around the issues, as all updates will occur on GitHub, not Bugzilla. Another complication is that the Bugzilla issue number is not always the same as the GitHub issue number. Thankfully, LLVM maintains this mapping through two shortlinks: https://llvm.org/bz<num> -> https://bugs.llvm.org/show_bug.cgi?id=<num> https://llvm.org/pr<num> -> https://github.com/llvm/llvm-project/issues/<mapped_num> Switch all "https://bugs.llvm.org/show_bug.cgi?id=<num>" links to the "https://llvm.org/pr<num>" shortlink so that the links show the most up to date information. Each migrated issue links back to the Bugzilla entry, so there should be no loss of fidelity of information here. Link: https://lkml.kernel.org/r/20240109-update-llvm-links-v1-3-eb09b59db071@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Fangrui Song <maskray@google.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Mykola Lysenko <mykolal@fb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-02-19regulator: core: Remove redundant assignment to variable possible_uVColin Ian King1-1/+0
The variable possible_uV being assigned a value that is never read, the control flow via the following goto statement takes a path where the variable is not accessed. The assignment is redundant and can be removed. Cleans up clang scan build warning: drivers/regulator/core.c:3935:3: warning: Value stored to 'possible_uV' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://msgid.link/r/20240216134918.2108262-1-colin.i.king@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19regulator: core: Remove redundant assignment to variable possible_uVColin Ian King1-1/+0
The variable possible_uV being assigned a value that is never read, the control flow via the following goto statement takes a path where the variable is not accessed. The assignment is redundant and can be removed. Cleans up clang scan build warning: drivers/regulator/core.c:3935:3: warning: Value stored to 'possible_uV' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://msgid.link/r/20240216134918.2108262-1-colin.i.king@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19regulator: pwm-regulator: Use dev_err_probe() for error paths in .probe()Uwe Kleine-König1-23/+17
One error path already used the dev_err_probe() helper. Make use of it in the other error paths, too, for consistent output. This results in a more compact source code and symbolic output of the error code. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/20240216071829.1513748-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19regulator: pwm-regulator: Use dev_err_probe() for error paths in .probe()Uwe Kleine-König1-23/+17
One error path already used the dev_err_probe() helper. Make use of it in the other error paths, too, for consistent output. This results in a more compact source code and symbolic output of the error code. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/20240216071829.1513748-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19regulator: Merge up v6.8-rc5Mark Brown3-4/+63
There are dependencies on the PWM fixes for some new work on the PWM driver.
2024-02-15regulator: lp873x: Use bitfield helpersGeert Uytterhoeven1-1/+2
Use the FIELD_PREP() helper, instead open-coding the same operation. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://msgid.link/r/15edeaa9a644c4025234088da3dabb023fce04ac.1708002503.git.geert+renesas@glider.be Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-15regulator: lp87565: Use bitfield helpersGeert Uytterhoeven1-1/+2
Use the FIELD_PREP() helper, instead open-coding the same operation. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://msgid.link/r/5e8781d31c983caf6bdabe36c5552077422cb8da.1708002575.git.geert+renesas@glider.be Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13regulator: max5970: Fix regulator child node nameNaresh Solanki1-4/+4
Update regulator child node name to lower case i.e., sw0 & sw1 as descibed in max5970 dt binding. Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Link: https://msgid.link/r/20240213145801.2564518-1-naresh.solanki@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-30regulator (max5970): Fix IRQ handlerPatrick Rudolph1-1/+1
The max5970 datasheet gives the impression that IRQ status bits must be cleared by writing a one to set bits, as those are marked with 'R/C', however tests showed that a zero must be written. Fixes an IRQ storm as the interrupt handler actually clears the IRQ status bits. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Link: https://msgid.link/r/20240130150257.3643657-1-naresh.solanki@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-23regulator: ti-abb: don't use devm_platform_ioremap_resource_byname for ↵Romain Naour1-3/+19
shared interrupt register We can't use devm_platform_ioremap_resource_byname() to remap the interrupt register that can be shared between regulator-abb-{ivahd,dspeve,gpu} drivers instances. The combined helper introduce a call to devm_request_mem_region() that creates a new busy resource region on PRM_IRQSTATUS_MPU register (0x4ae06010). The first devm_request_mem_region() call succeeds for regulator-abb-ivahd but fails for the two other regulator-abb-dspeve and regulator-abb-gpu. # cat /proc/iomem | grep -i 4ae06 4ae06010-4ae06013 : 4ae07e34.regulator-abb-ivahd int-address 4ae06014-4ae06017 : 4ae07ddc.regulator-abb-mpu int-address regulator-abb-dspeve and regulator-abb-gpu are missing due to devm_request_mem_region() failure (EBUSY): [ 1.326660] ti_abb 4ae07e30.regulator-abb-dspeve: can't request region for resource [mem 0x4ae06010-0x4ae06013] [ 1.326660] ti_abb: probe of 4ae07e30.regulator-abb-dspeve failed with error -16 [ 1.327239] ti_abb 4ae07de4.regulator-abb-gpu: can't request region for resource [mem 0x4ae06010-0x4ae06013] [ 1.327270] ti_abb: probe of 4ae07de4.regulator-abb-gpu failed with error -16 >From arm/boot/dts/dra7.dtsi: The abb_mpu is the only instance using its own interrupt register: (0x4ae06014) PRM_IRQSTATUS_MPU_2, ABB_MPU_DONE_ST (bit 7) The other tree instances (abb_ivahd, abb_dspeve, abb_gpu) share PRM_IRQSTATUS_MPU register (0x4ae06010) but use different bits ABB_IVA_DONE_ST (bit 30), ABB_DSPEVE_DONE_ST( bit 29) and ABB_GPU_DONE_ST (but 28). The commit b36c6b1887ff ("regulator: ti-abb: Make use of the helper function devm_ioremap related") overlooked the following comment implicitly explaining why devm_ioremap() is used in this case: /* * We may have shared interrupt register offsets which are * write-1-to-clear between domains ensuring exclusivity. */ Fixes and partially reverts commit b36c6b1887ff ("regulator: ti-abb: Make use of the helper function devm_ioremap related"). Improve the existing comment to avoid further conversion to devm_platform_ioremap_resource_byname(). Fixes: b36c6b1887ff ("regulator: ti-abb: Make use of the helper function devm_ioremap related") Signed-off-by: Romain Naour <romain.naour@skf.com> Reviewed-by: Yoann Congal <yoann.congal@smile.fr> Link: https://msgid.link/r/20240123111456.739381-1-romain.naour@smile.fr Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-22regulator: fixed-helper: Save a few bytes of memory when registering a ↵Christophe JAILLET1-2/+2
'nfc_llc' engine regulator_register_always_on() calls pass a string literal as the 'name' parameter. So kstrdup_const() can be used instead of kfree() to avoid a memory allocation in such cases. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://msgid.link/r/3f990a7b80d72c31371735b24ed08acbb8392c80.1705748586.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-22regulator: pwm-regulator: Manage boot-on with disabled PWM channelsMartin Blumenstingl1-0/+33
Odroid-C1 uses a Monolithic Power Systems MP2161 controlled via PWM for the VDDEE voltage supply of the Meson8b SoC. Commit 6b9352f3f8a1 ("pwm: meson: modify and simplify calculation in meson_pwm_get_state") results in my Odroid-C1 crashing with memory corruption in many different places (seemingly at random). It turns out that this is due to a currently not supported corner case. The VDDEE regulator can generate between 860mV (duty cycle of ~91%) and 1140mV (duty cycle of 0%). We consider it to be enabled by the bootloader (which is why it has the regulator-boot-on flag in .dts) as well as being always-on (which is why it has the regulator-always-on flag in .dts) because the VDDEE voltage is generally required for the Meson8b SoC to work. The public S805 datasheet [0] states on page 17 (where "A5" refers to the Cortex-A5 CPU cores): [...] So if EE domains is shut off, A5 memory is also shut off. That does not matter. Before EE power domain is shut off, A5 should be shut off at first. It turns out that at least some bootloader versions are keeping the PWM output disabled. This is not a problem due to the specific design of the regulator: when the PWM output is disabled the output pin is pulled LOW, effectively achieving a 0% duty cycle (which in return means that VDDEE voltage is at 1140mV). The problem comes when the pwm-regulator driver tries to initialize the PWM output. To do so it reads the current state from the hardware, which is: period: 3666ns duty cycle: 3333ns (= ~91%) enabled: false Then those values are translated using the continuous voltage range to 860mV. Later, when the regulator is being enabled (either by the regulator core due to the always-on flag or first consumer - in this case the lima driver for the Mali-450 GPU) the pwm-regulator driver tries to keep the voltage (at 860mV) and just enable the PWM output. This is when things start to go wrong as the typical voltage used for VDDEE is 1100mV. Commit 6b9352f3f8a1 ("pwm: meson: modify and simplify calculation in meson_pwm_get_state") triggers above condition as before that change period and duty cycle were both at 0. Since the change to the pwm-meson driver is considered correct the solution is to be found in the pwm-regulator driver. Update the duty cycle during driver probe if the regulator is flagged as boot-on so that a call to pwm_regulator_enable() (by the regulator core during initialization of a regulator flagged with boot-on) without any preceding call to pwm_regulator_set_voltage() does not change the output voltage. [0] https://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://msgid.link/r/20240113224628.377993-4-martin.blumenstingl@googlemail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-22regulator: pwm-regulator: Calculate the output voltage for disabled PWMsMartin Blumenstingl1-0/+7
If a PWM output is disabled then it's voltage has to be calculated based on a zero duty cycle (for normal polarity) or duty cycle being equal to the PWM period (for inverted polarity). Add support for this to pwm_regulator_get_voltage(). Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://msgid.link/r/20240113224628.377993-3-martin.blumenstingl@googlemail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-22regulator: pwm-regulator: Add validity checks in continuous .get_voltageMartin Blumenstingl1-0/+3
Continuous regulators can be configured to operate only in a certain duty cycle range (for example from 0..91%). Add a check to error out if the duty cycle translates to an unsupported (or out of range) voltage. Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://msgid.link/r/20240113224628.377993-2-martin.blumenstingl@googlemail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-22regulator: qcom_smd: Keep one rpm handle for all vregsKonrad Dybcio1-9/+10
For no apparent reason (as there's just one RPM per SoC), all vregs currently store a copy of a pointer to smd_rpm. Introduce a single, global one to save up on space in each definition. bloat-o-meter reports a slight uptick: Total: Before=44008, After=44080, chg +0.16% However the saved n * sizeof(ptr) for every dynamically allocated regulator quickly makes up for it. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://msgid.link/r/20240109-rpm_vreg_cleanup-v3-1-fa0201029f78@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-12Merge tag 'pwm/for-6.8-rc1' of ↵Linus Torvalds1-2/+2
git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm Pull pwm updates from Thierry Reding: "This contains a bunch of cleanups and simplifications across the board, as well as a number of small fixes. Perhaps the most notable change here is the addition of an API that allows PWMs to be used in atomic contexts, which is useful when time- critical operations are involved, such as using a PWM to generate IR signals. Finally, I have decided to step down as PWM subsystem maintainer. Due to other responsibilities I have lately not been able to find the time that the subsystem deserves and Uwe, who has been helping out a lot for the past few years and has many things planned for the future, has kindly volunteered to take over. I have no doubt that he will be a suitable replacement" * tag 'pwm/for-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (44 commits) MAINTAINERS: pwm: Thierry steps down, Uwe takes over pwm: linux/pwm.h: fix Excess kernel-doc description warning pwm: Add pwm_apply_state() compatibility stub pwm: cros-ec: Drop documentation for dropped struct member pwm: Drop two unused API functions pwm: lpc18xx-sct: Don't modify the cached period of other PWM outputs pwm: meson: Simplify using dev_err_probe() pwm: stmpe: Silence duplicate error messages pwm: Reduce number of pointer dereferences in pwm_device_request() pwm: crc: Use consistent variable naming for driver data pwm: omap-dmtimer: Drop locking dt-bindings: pwm: ti,pwm-omap-dmtimer: Update binding for yaml media: pwm-ir-tx: Trigger edges from hrtimer interrupt context pwm: bcm2835: Allow PWM driver to be used in atomic context pwm: Make it possible to apply PWM changes in atomic context pwm: renesas: Remove unused include pwm: Replace ENOTSUPP with EOPNOTSUPP pwm: Rename pwm_apply_state() to pwm_apply_might_sleep() pwm: Stop referencing pwm->chip pwm: Update kernel doc for struct pwm_chip ...
2024-01-04regulator: event: Ensure atomicity for sequence numberNaresh Solanki1-4/+4
Previously, the sequence number in the regulator event subsystem was updated without atomic operations, potentially leading to race conditions. This commit addresses the issue by making the sequence number atomic. Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Link: https://msgid.link/r/20240104141314.3337037-1-naresh.solanki@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-20pwm: Rename pwm_apply_state() to pwm_apply_might_sleep()Sean Young1-2/+2
In order to introduce a pwm api which can be used from atomic context, we will need two functions for applying pwm changes: int pwm_apply_might_sleep(struct pwm *, struct pwm_state *); int pwm_apply_atomic(struct pwm *, struct pwm_state *); This commit just deals with renaming pwm_apply_state(), a following commit will introduce the pwm_apply_atomic() function. Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> # for input Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Lee Jones <lee@kernel.org> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2023-12-18regulator: qcom_smd: Add LDO5 MP5496 regulatorVaradarajan Narayanan1-0/+1
Add support for LDO5 regulator. This is used by IPQ9574 USB. Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com> Rule: <add> Link: https://lore.kernel.org/stable/20231214104052.3267039-1-quic_varada%40quicinc.com Link: https://msgid.link/r/20231214104052.3267039-1-quic_varada@quicinc.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-14Add pm8010 RPMH regulators for sm8550 boardsMark Brown1-26/+151
Merge series from Fenglin Wu <quic_fenglinw@quicinc.com>: There are 2 PM8010 PMICs present in sm8550-mtp/sm8550-qrd boards and each of them exposes 7 LDOs. Add RPMH regulator support for them. Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com> --- Changes in v2: - Updated subject prefix in the dt-binding commit and fixed the typo. - Separate the DTS commit with board name prefixes. - Link to v1: https://lore.kernel.org/r/20231211-pm8010-regulator-v1-0-571e05fb4ecc@quicinc.com --- Fenglin Wu (5): regulator: qcom-rpmh: extend to support multiple linear voltage ranges regulator: dt-bindings: qcom,rpmh: add compatible for pm8010 regulator: qcom-rpmh: add support for pm8010 regulators arm64: dts: qcom: sm8550-mtp: Add pm8010 regulators arm64: dts: qcom: sm8550-qrd: add PM8010 regulators .../bindings/regulator/qcom,rpmh-regulator.yaml | 14 ++ arch/arm64/boot/dts/qcom/sm8550-mtp.dts | 120 ++++++++++++++ arch/arm64/boot/dts/qcom/sm8550-qrd.dts | 120 ++++++++++++++ drivers/regulator/qcom-rpmh-regulator.c | 177 ++++++++++++++++++--- 4 files changed, 405 insertions(+), 26 deletions(-) --- base-commit: 753e4d5c433da57da75dd4c3e1aececc8e874a62 change-id: 20231205-pm8010-regulator-0348cb19087a Best regards, -- Fenglin Wu <quic_fenglinw@quicinc.com>
2023-12-14regulator: qcom-rpmh: add support for pm8010 regulatorsFenglin Wu1-0/+62
Add RPMH regulators exposed by Qualcomm Technologies, Inc. PM8010 PMIC. It has 7 LDOs with 3 different types, LDO1 - LDO2 are L502 NMOS LDOs, LDO5 and LDO7 are L502 PMOS LDOs, LDO3/LDO4/LDO6 are L502 PMOS LDO for low noise applications. Also, LDO3 - LDO7 don't support LPM. Suggested-by: David Collins <quic_collinsd@quicinc.com> Reviewed-by: David Collins <quic_collinsd@quicinc.com> Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com> Link: https://msgid.link/r/20231214-pm8010-regulator-v2-3-82131df6b97b@quicinc.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-14regulator: qcom-rpmh: extend to support multiple linear voltage rangesFenglin Wu1-26/+89
Update rpmh_vreg_hw_data to support multiple linear voltage ranges for potential regulators which have discrete voltage program ranges. Suggested-by: David Collins <quic_collinsd@quicinc.com> Reviewed-by: David Collins <quic_collinsd@quicinc.com> Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com> Link: https://msgid.link/r/20231214-pm8010-regulator-v2-1-82131df6b97b@quicinc.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-11regulator: wm8350: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/1f7bbc545829a1cc3df40be0424fe46d7449fb72.1701778038.git.u.kleine-koenig@pengutronix.de Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-11regulator: virtual: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/d9954f02ae51b1b0b0077c710d16bfaeafa216ec.1701778038.git.u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-11regulator: userspace-consumer: Convert to platform remove callback returning ↵Uwe Kleine-König1-4/+2
void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/89c5f261707bf178e1508cf5dd55121f0da2dc3f.1701778038.git.u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-11regulator: uniphier: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/ced2a73a1aeca3f33d4b194e4dbe2672ad84a50a.1701778038.git.u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-11regulator: stm32-vrefbuf: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/2e96cf99c8d97b728d891a745e8f94ee39fbfee8.1701778038.git.u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-11regulator: db8500-prcmu: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/fcaa42d7dd707031ed8dd9e8c28483891b879965.1701778038.git.u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-11regulator: bd9571mwv: Convert to platform remove callback returning voidUwe Kleine-König1-3/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/639e796b36815a219ff1172cc758ba7378211d74.1701778038.git.u.kleine-koenig@pengutronix.de Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-11regulator: arizona-ldo1: Convert to platform remove callback returning voidUwe Kleine-König1-5/+3
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/76c7af01e2c8b3ab6585a04bc3f0d163fbb7fdf7.1701778038.git.u.kleine-koenig@pengutronix.de Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-06regulator: event: Add regulator netlink event supportNaresh Solanki5-1/+133
This commit introduces netlink event support to the regulator subsystem. Changes: - Introduce event.c and regnl.h for netlink event handling. - Implement reg_generate_netlink_event to broadcast regulator events. - Update Makefile to include the new event.c file. Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Link: https://lore.kernel.org/r/20231205105207.1262928-1-naresh.solanki@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13regulator: add under-voltage support (part 2)Mark Brown2-0/+47
Merge series from Oleksij Rempel <o.rempel@pengutronix.de>: This series add under-voltage and emergency shutdown for system critical regulators
2023-11-13Add PM8937 PMIC supportMark Brown2-0/+68
Merge series from Dang Huynh <danct12@riseup.net>: PM8937 is a power management IC. It is used in various boards with MSM8917, MSM8937, MSM8940 and APQ variants.
2023-11-13regulator: stpmic1: Fix kernel-doc notation warningsJiapeng Chong1-1/+1
No functional modification involved. drivers/regulator/stpmic1_regulator.c:31: warning: expecting prototype for struct stpmic1. Prototype was for struct stpmic1_regulator_cfg instead. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7206 Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Link: https://lore.kernel.org/r/20231109073925.98783-1-jiapeng.chong@linux.alibaba.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13regulator: palmas: remove redundant initialization of pointer pdataColin Ian King1-1/+1
Pointer pdata is being initialized with a value that is never read. It is being re-assigned later on with the return from a devm_kzalloc call. Remove the redundant initialization, cleans up clang scan build warning: drivers/regulator/palmas-regulator.c:1597:36: warning: Value stored to 'pdata' during its initialization is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20231111195330.338324-1-colin.i.king@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13regulator: core: Only increment use_count when enable_count changesRui Zhang1-26/+30
The use_count of a regulator should only be incremented when the enable_count changes from 0 to 1. Similarly, the use_count should only be decremented when the enable_count changes from 1 to 0. In the previous implementation, use_count was sometimes decremented to 0 when some consumer called unbalanced disable, leading to unexpected disable even the regulator is enabled by other consumers. With this change, the use_count accurately reflects the number of users which the regulator is enabled. This should make things more robust in the case where a consumer does leak references. Signed-off-by: Rui Zhang <zr.zhang@vivo.com> Link: https://lore.kernel.org/r/20231103074231.8031-1-zr.zhang@vivo.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13regulator: core: Add option to prevent disabling unused regulatorsJavier Martinez Canillas1-0/+17
This may be useful for debugging and develompent purposes, when there are drivers that depend on regulators to be enabled but do not request them. It is inspired from the clk_ignore_unused and pd_ignore_unused parameters, that are used to keep firmware-enabled clocks and power domains on even if these are not used by drivers. The parameter is not expected to be used in normal cases and should not be needed on a platform with proper driver support. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20231107190926.1185326-1-javierm@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13regulator: Implement uv_survival_time for handling under-voltage eventsOleksij Rempel2-1/+8
Add 'uv_survival_time' field to regulation_constraints for specifying survival time post critical under-voltage event. Update the regulator notifier call chain and Device Tree property parsing to use this new field, allowing a configurable timeout before emergency shutdown. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/20231026144824.4065145-6-o.rempel@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13regulator: Introduce handling for system-critical under-voltage eventsOleksij Rempel2-0/+40
Handle under-voltage events for crucial regulators to maintain system stability and avoid issues during power drops. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/20231026144824.4065145-3-o.rempel@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13regulator: qcom_smd: Add PM8937 regulatorsDang Huynh1-0/+34
The PM8937 is found on boards with MSM8917, MSM8937, MSM8940 SoCs and APQ variants. It provides 6 SMPS (two are controlled by SPMI) and 23 LDO regulators. Signed-off-by: Dang Huynh <danct12@riseup.net> Reviewed-by: Stephan Gerhold <stephan@gerhold.net> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20231106-pm8937-v1-5-ec51d9eeec53@riseup.net Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13regulator: qcom_spmi: Add PM8937 SPMI regulatorDang Huynh1-0/+34
The PM8937 has 4 HFSMPS, 2 FTSMPS2.5 (for controlling APC voltage) and 23 LDO regulators. Add the configuration for this chip. Signed-off-by: Dang Huynh <danct12@riseup.net> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20231106-pm8937-v1-3-ec51d9eeec53@riseup.net Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-30regulator: Merge up pending fixMark Brown3-11/+19
One small fix didn't get sent before the merge window.
2023-10-27regulator (max5970): Remove duplicate lineNaresh Solanki1-1/+0
Remove redundant/duplicate line. Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Link: https://lore.kernel.org/r/20231027152830.1269895-2-naresh.solanki@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-27regulator (max5970): Add hwmon supportNaresh Solanki1-1/+143
Utilize the integrated 10-bit ADC in Max5970/Max5978 to enable voltage and current monitoring. This feature is seamlessly integrated through the hwmon subsystem. Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231027152830.1269895-1-naresh.solanki@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-25regulator: qcom-rpmh: Fix smps4 regulator for pm8550veAbel Vesa1-1/+1
The type of the smps4 regulator from pm8550ve is actually FTSMPS525 medium voltage. So fix it accordingly. Fixes: e6e3776d682d ("regulator: qcom-rpmh: Add support for PM8550 regulators") Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Link: https://lore.kernel.org/r/20231024134626.2364426-1-abel.vesa@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-25regulator: qcom-rpmh: Add regulators support for PMC8380Rajendra Nayak1-0/+19
Add support from RPMH regulators found in PMC8380 for SC8380XP platform. Signed-off-by: Rajendra Nayak <quic_rjendra@quicinc.com> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20231025135550.13162-3-quic_sibis@quicinc.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-25regulator: fixed: add support for under-voltage IRQOleksij Rempel1-0/+50
Add interrupt support for under-voltage notification. This functionality can be used on systems capable to detect under-voltage state and having enough capacity to let the SoC do some emergency preparation. This change enforce default policy to shutdown system as soon as interrupt is triggered. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/20231025084614.3092295-6-o.rempel@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-23regulator: max77503: Add ADI MAX77503 supportGokhan Celik3-0/+148
Add ADI MAX77503 buck converter driver support. Signed-off-by: Gokhan Celik <gokhan.celik@analog.com> Link: https://lore.kernel.org/r/10bb3894fea31a098d768e346c8721e730d7cb21.1698000185.git.gokhan.celik@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-17regulator: Use device_get_match_data()Rob Herring7-42/+22
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20231017203442.2699322-1-robh@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-17regulator: da9121: Use i2c_get_match_data()Rob Herring1-13/+2
Use preferred i2c_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20231017203429.2699039-1-robh@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-17regulator: Drop unnecessary of_match_device() callsRob Herring3-30/+2
If probe is reached, we've already matched the device and in the case of DT matching, the struct device_node pointer will be set. Therefore, there is no need to call of_match_device() in probe. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20231017203507.2699826-1-robh@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-10regulator: da9063: Annotate struct da9063_regulators with __counted_byKees Cook1-1/+1
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct da9063_regulators. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Support Opensource <support.opensource@diasemi.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: "Gustavo A. R. Silva" <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20230922175207.work.576-kees@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-09regulator: da9062: Annotate struct da9062_regulators with __counted_byKees Cook1-1/+1
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct da9062_regulators. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Support Opensource <support.opensource@diasemi.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: "Gustavo A. R. Silva" <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20230922175330.work.066-kees@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-02regulator: mt6358: Add supply names for MT6366 regulatorsChen-Yu Tsai1-40/+37
The DT bindings for MT6366 regulator defines the supply names for the PMIC. Add support for them by adding .supply_name field settings for each regulator. The buck regulators each have their own supply whose name can be derived from the regulator name. The LDOs have shared supplies. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230928085537.3246669-12-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-02regulator: mt6358: Add missing regulators for MT6366Chen-Yu Tsai1-0/+20
When support for the MT6366 PMIC regulators was added, it was assumed that it had the same functionality as MT6358. In reality there are differences. A few regulators have different ranges, or were renamed and repurposed, or removed altogether. Add the 3 regulators that were missing from the original submission. These are added for completeness. VSRAM_CORE is not used in existing projects. VM18 and VMDDR feed DRAM related consumers, and are not used in-kernel. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20230928085537.3246669-11-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-02regulator: mt6358: Make MT6366 vcn18 LDO configurableChen-Yu Tsai1-1/+23
The VCN18 regulator on the MT6366 (only) actually has a wide configurable range of voltages, even though its name suggests a fixed output voltage. Convert it from a fixed LDO to a configurable LDO. Its range of settings is the same as the VM18 regulator, which is missing and will be added in a subsequent patch. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230928085537.3246669-10-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-02regulator: mt6358: fix and drop type prefix in MT6366 regulator node namesChen-Yu Tsai1-35/+35
The new MT6366 binding does away with the type prefix ("buck_", "ldo_") in the regulator node names. This better matches the PMIC pin names. Remaining underscores in names are also replaced with hyphens. Drop the type prefixes and replace remaining underscores to match the MT6366 binding. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230928085537.3246669-9-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-02regulator: mt6358: Add supply names for MT6358 regulatorsChen-Yu Tsai1-55/+51
The DT bindings for MT6358 regulator now defines the supply names for the PMIC. Add support for them by adding .supply_name field settings for each regulator. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230928085537.3246669-8-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-02regulator: mt6358: Use mt6397-regulator.h binding header for buck mode macrosChen-Yu Tsai1-7/+6
The (undocumented) possible values for the buck operating modes on the MT6358 are the same as those on the MT6397, both for the device tree bindings and the actual hardware register values. Reuse the macros for the MT6397 PMIC in the MT6358 regulator driver by including the mt6397-regulator.h binding header and replacing the existing macros. This aligns it with other PMIC. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230928085537.3246669-7-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-26regulator: qcom_spmi: Add PMA8084 regulatorsStephan Gerhold1-0/+49
Add the necessary definitions for the PMA8084 PMIC to the qcom_spmi-regulator driver to allow reading the actual voltages applied to the hardware at runtime. This is mainly intended for debugging since the regulators are usually controlled through the RPM firmware (via qcom_smd-regulator). Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20230912-spmi-pm8909-v1-6-ba4b3bfaf87d@gerhold.net Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-26regulator: qcom_spmi: Add PM8019 regulatorsStephan Gerhold1-0/+23
Add the necessary definitions for the PM8019 PMIC to the qcom_spmi-regulator driver to allow reading the actual voltages applied to the hardware at runtime. This is mainly intended for debugging since the regulators are usually controlled through the RPM firmware (via qcom_smd-regulator). Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20230912-spmi-pm8909-v1-4-ba4b3bfaf87d@gerhold.net Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-26regulator: qcom_spmi: Add PM8909 regulatorsStephan Gerhold1-0/+24
Add the necessary definitions for the PM8909 PMIC to the qcom_spmi-regulator driver to allow reading the actual voltages applied to the hardware at runtime. This is mainly intended for debugging since the regulators are usually controlled through the RPM firmware (via qcom_smd-regulator). Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com> Link: https://lore.kernel.org/r/20230912-spmi-pm8909-v1-2-ba4b3bfaf87d@gerhold.net Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-26regulator/core: Revert "fix kobject release warning and memory leak in ↵Michał Mirosław1-5/+1
regulator_register()" This reverts commit 5f4b204b6b8153923d5be8002c5f7082985d153f. Since rdev->dev now has a release() callback, the proper way of freeing the initialized device can be restored. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/d7f469f3f7b1f0e1d52f9a7ede3f3c5703382090.1695077303.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-26regulator/core: regulator_register: set device->class earlierMichał Mirosław1-2/+2
When fixing a memory leak in commit d3c731564e09 ("regulator: plug of_node leak in regulator_register()'s error path") it moved the device_initialize() call earlier, but did not move the `dev->class` initialization. The bug was spotted and fixed by reverting part of the commit (in commit 5f4b204b6b81 "regulator: core: fix kobject release warning and memory leak in regulator_register()") but introducing a different bug: now early error paths use `kfree(dev)` instead of `put_device()` for an already initialized `struct device`. Move the missing assignments to just after `device_initialize()`. Fixes: d3c731564e09 ("regulator: plug of_node leak in regulator_register()'s error path") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/b5b19cb458c40c9d02f3d5a7bd1ba7d97ba17279.1695077303.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-26regulator: mt6358: Remove bogus regulators andMark Brown2-167/+139
Merge series from Chen-Yu Tsai <wenst@chromium.org>: Hi, This is v3 of the remainder of the MT6358 regulator driver cleanup and improvement series. v1 can be found here [1]; v2 is here [2]. Changes since v2: - Merged patches dropped - Fixed up pickable linear ranges' selector values - Collected tags - Patch adding missing regulator definitions squashed into patch using the definitions; recommended by Krzysztof on my MT6366 series. - Remaining dts patch split out to be sent separately Changes since v1: - Merged patches dropped - Added patch to move VCN33 regulator status sync after ID check - Added patch to fix VCN33 sync fail error message - Added patch to add missing register definitions Various discrepancies were found while preparing to upstream MT8186 device trees, which utilize the MT6366 PMIC, that is also covered by this driver. Patches 1~3 should go through the regulator tree, and patch 4 through the soc/mediatek tree. ** Note: patch 2 needs an ack from Lee for the mfd header change. This v3 series can be seen as two parts. v1 had three parts, but one part was fully merged, and then v2 gained another cleanup. v3 drops the "fixing bogus regulators" part: driver changes are fully merged and device tree change will be sent separately. Part 1 - Robust chip ID checking (patch 1) Angelo suggested making the driver fail to probe if an unexpected chip ID was found. Patch 1 implements this. Part 2 - Output voltage fine tuning support (patches 2, 3) Many of the LDOs on these PMIC support an extra level of output voltage fine tuning. Most default to no offset, but a couple have a non-zero offset by default. Previously this was unaccounted for in the driver and device tree constraints. On the outputs with non-zero offset, this ends up becoming a discrepancy between the device tree and actual hardware. These two patches adds support for this second level of tuning, modeled as bunch of linear ranges. While it's unlikely we need this level of control, it's nice to be able to read back the accurate hardware settings. Please have a look. Thanks ChenYu [1] https://lore.kernel.org/linux-arm-kernel/20230609083009.2822259-1-wenst@chromium.org/ [2] https://lore.kernel.org/linux-mediatek/20230721082903.2038975-1-wenst@chromium.org/ Chen-Yu Tsai (3): regulator: mt6358: Fail probe on unknown chip ID regulator: mt6358: Add output voltage fine tuning to fixed regulators regulator: mt6358: Add output voltage fine tuning to variable LDOs drivers/regulator/mt6358-regulator.c | 304 ++++++++++++--------------- include/linux/mfd/mt6358/registers.h | 6 + 2 files changed, 144 insertions(+), 166 deletions(-) -- 2.42.0.283.g2d96d420d3-goog
2023-09-25regulator: mt6358: Add output voltage fine tuning to variable LDOsChen-Yu Tsai1-160/+115
Some of the LDO regulators in the MT6358/MT6366 have sparsely populated voltage tables, supported by custom get/set operators. While it works, it requires more code and an extra field to store the lookup table. These LDOs also have fine voltage calibration settings that can slightly boost the output voltage from 0 mV to 100 mV, in 10 mV increments. These combined could be modeled as a pickable set of linear ranges. The coarse voltage setting is modeled as the range selector, while each range has 11 selectors, starting from the range's base voltage, up to +100 mV, in 10mV increments. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230913082919.1631287-4-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25regulator: mt6358: Add output voltage fine tuning to fixed regulatorsChen-Yu Tsai1-2/+13
The "fixed" LDO regulators found on the MT6358 and MT6366 PMICs have either no voltage selection register, or only one valid setting. However these do have a fine voltage calibration setting that can slightly boost the output voltage from 0 mV to 100 mV, in 10 mV increments. Add support for this by changing these into linear range regulators. Some register definitions that are missing are also added. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20230913082919.1631287-3-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25regulator: mt6358: Fail probe on unknown chip IDChen-Yu Tsai1-4/+10
The MT6358 and MT6366 PMICs, and likely many others from MediaTek, have a chip ID register, making the chip semi-discoverable. The driver currently supports two PMICs and expects to be probed on one or the other. It does not account for incorrect mfd driver entries or device trees. While these should not happen, if they do, it could be catastrophic for the device. The driver should be sure the hardware is what it expects. Make the driver fail to probe if the chip ID presented is not a known one. Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Fixes: f0e3c6261af1 ("regulator: mt6366: Add support for MT6366 regulator") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230913082919.1631287-2-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-22regulator: mc13xxx: Annotate struct mc13xxx_regulator_priv with __counted_byKees Cook1-1/+1
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct mc13xxx_regulator_priv. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20230922175402.work.819-kees@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-20regulator: mt6358: split ops for buck and linear range LDO regulatorsChen-Yu Tsai1-3/+15
The buck and linear range LDO (VSRAM_*) regulators share one set of ops. This set includes support for get/set mode. However this only makes sense for buck regulators, not LDOs. The callbacks were not checking whether the register offset and/or mask for mode setting was valid or not. This ends up making the kernel report "normal" mode operation for the LDOs. Create a new set of ops without the get/set mode callbacks for the linear range LDO regulators. Fixes: f67ff1bd58f0 ("regulator: mt6358: Add support for MT6358 regulator") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://lore.kernel.org/r/20230920085336.136238-1-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-12regulator: rk808: Drop useless headersLinus Walleij1-2/+0
The RK808 is already using the proper <linux/gpio/consumer.h> header and includes the legacy headers <linux/gpio.h> and <linux/of_gpio.h> for no reason, drop the includes. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230911-descriptors-regulator-v2-1-ce978c52c557@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-12Match data improvements for pv880x0 regulatorMark Brown1-41/+17
Merge series from Biju Das <biju.das.jz@bp.renesas.com>: This patch series aims to add match data improvements for pv880x0 regulator driver. These patches are only compile tested.
2023-09-11regulator: Fix voltage range selectionVincent Whitchurch1-1/+1
Use the correct field to fix wrong voltage range selection on regulators such as tps6287x since the blamed commit. Fixes: 269cb04b601d ("regulator: Use bitfield values for range selectors") Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Link: https://lore.kernel.org/r/20230911-regulator-voltage-sel-v1-1-886eb1ade8d8@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11regulator: mp5416: Make similar OF and ID tableBiju Das1-5/+5
Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the driver_data is wrong for ID match. While at it, remove trailing comma in the terminator entry for OF/ID table and drop a space from terminator entry for ID table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230903160301.79111-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11regulator: max20086: Make similar OF and ID tableBiju Das1-34/+31
Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the driver_data is wrong for ID match. While at it, drop blank lines before MODULE_DEVICE_TABLE* and remove trailing comma in the terminator entry for OF/ID table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230903154257.70800-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11regulator: mp886x: Make similar OF and ID tableBiju Das1-10/+4
Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the driver_data is wrong for ID match. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230826173841.91807-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11regulator: ltc3589: Convert enum->pointer for data in the match tablesBiju Das1-35/+26
Convert enum->pointer for data in the match tables, so that the hw differences can be stored in pointer and there by simpily the code. Add struct ltc3589_info for hw differences between the devices and replace ltc3589_variant->ltc3589_info for data in the match table. Simplify the probe() by replacing of_device_get_match_data() and ID lookup for retrieving data by i2c_get_match_data(). Drop enum ltc3589_variant and variant from struct ltc3589_info as there are no users. While at it, dropped trailing comma in the terminator entries for ID table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230828162830.97881-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11regulator: sy8824x: Make similar OF and ID tableBiju Das1-19/+7
Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the driver_data is wrong for ID match. While at it, drop trailing comma in the terminator entry from ID table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230828165447.106058-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11regulator: fan53555: Simplify probe()Biju Das1-7/+2
Simplify probe() by replacing of_device_get_match_data() and ID lookup for retrieving match data by i2c_get_match_data(). While at it, use dev_fwnode() API instead of 'client->dev.of_node'. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230828164746.102992-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11regulator: pv880x0: Simplify probe()Biju Das1-37/+14
Replace pv88080_types->pv88080_compatible_regmap in OF/ID tables and simplify the probe() by replacing of_match_node() and ID lookup for retrieving match data by i2c_get_match_data(). After this there is no user of enum pv88080_types. So drop it. While at it, move OF table near to the user. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230903164832.83077-3-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11regulator: pv880x0: Drop ifdefferyBiju Das1-5/+4
Drop of_match_ptr() from pv88080_regulator_driver and get rid of ugly CONFIG_OF ifdeffery. This slightly increases the size of pv88080_dt_ids on non-OF system and shouldn't be an issue. Add mod_devicetable.h include. While at it, remove trailing comma in the terminator entry for OF/ID table. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230903164832.83077-2-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-07Merge tag 'regulator-fix-v6.6-merge-window' of ↵Linus Torvalds2-17/+16
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator fixes from Mark Brown: "A couple of fixes that came in during the merge window, both driver specific - one for a bug that came up in testing, one for a bug due to a misreading of the datasheet" * tag 'regulator-fix-v6.6-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: tps6594-regulator: Fix random kernel crash regulator: tps6287x: Fix n_voltages
2023-09-05regulator: tps6594-regulator: Fix random kernel crashJerome Neanne1-16/+15
Random kernel crash detected in TI CICD when regulator driver is added. This is root caused to irq index increment being done twice causing irq_data being allocated outside of the range. - Rework tps6594_request_reg_irqs with correct index increment - Adjust irq_data kmalloc size to the exact size needed for the device This has been reported on TI mainline. No public bug report associated. Reported-by: Udit Kumar <u-kumar1@ti.com> Fixes: f17ccc5deb4d ("regulator: tps6594-regulator: Add driver for TI TPS6594 regulators") Signed-off-by: Jerome Neanne <jneanne@baylibre.com> Link: https://lore.kernel.org/r/20230828-tps6594_random_boot_crash_fix-v1-1-f29cbf9ddb37@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-29regulator: tps6287x: Fix n_voltagesVincent Whitchurch1-1/+1
There are 256 possible voltage settings for each range, not 256 possible voltage settings in total. Fixes: 15a1cd245d5b ("regulator: tps6287x: Fix missing .n_voltages setting") Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com Link: https://lore.kernel.org/r/20230829-tps-voltages-v1-1-7ba4f958a194@axis.com Signed-off-by: Mark Brown <broonie@kernel.org
2023-08-29Merge tag 'regulator-v6.6' of ↵Linus Torvalds69-170/+1869
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator updates from Mark Brown: "Other than new device support and some minor fixes this has been a really quiet release, the only notable things are the new drivers. There's a couple of MFDs among the new devices so the generic parts are pulled in: - Support for Analog Devices MAX77831/57/59, Awinc AW37503, Qualcom PMX75 and RFGEN, RealTek RT5733, RichTek RTQ2208 and Texas Instruments TPS65086" * tag 'regulator-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (68 commits) regulator: userspace-consumer: Drop event support for this cycle regulator: aw37503: Switch back to use struct i2c_driver's .probe() dt-bindings: regulator: qcom,rpmh-regulator: allow i, j, l, m & n as RPMh resource name suffix regulator: dt-bindings: Add Awinic AW37503 regulator: aw37503: add regulator driver for Awinic AW37503 regulator: tps65086: Select dedicated regulator config for chip variant mfd: tps65086: Read DEVICE ID register 1 from device regulator: raa215300: Update help description regulator: raa215300: Add missing blank space regulator: raa215300: Change rate from 32000->32768 regulator: db8500-prcmu: Remove unused declaration power_state_active_is_enabled() regulator: raa215300: Add const definition regulator: raa215300: Fix resource leak in case of error regulator: rtq2208: Switch back to use struct i2c_driver's .probe() regulator: lp872x: Fix Wvoid-pointer-to-enum-cast warning regulator: max77857: Fix Wvoid-pointer-to-enum-cast warning regulator: ltc3589: Fix Wvoid-pointer-to-enum-cast warning regulator: qcom_rpm-regulator: Use devm_kmemdup to replace devm_kmalloc + memcpy regulator: tps6286x-regulator: Remove redundant of_match_ptr() macros regulator: pfuze100-regulator: Remove redundant of_match_ptr() macro ...
2023-08-24regulator: userspace-consumer: Drop event support for this cycleMark Brown1-51/+1
Drop commit 22475bcc2083 ("regulator: userspace-consumer: Add regulator event support") since Zev Weiss points out that it leaks the constants we use for notifications out as ABI which isn't ideal, we should have something more abstracted there. There's a definite need for this feature but it needs some more work on the interface. Signed-off-by: Mark Brown <broonie@kernel.org Link: https://lore.kernel.org/r/20230824-regulator-remove-status-sysfs-v1-1-554956e8c1ca@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org
2023-08-24regulator: aw37503: Switch back to use struct i2c_driver's .probe()Uwe Kleine-König1-1/+1
struct i2c_driver::probe_new is about to go away. Switch the driver to use the probe callback with the same prototype. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de Link: https://lore.kernel.org/r/20230824195617.8888-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org
2023-08-22regulator: aw37503: add regulator driver for AwinicMark Brown3-0/+249
Merge series from like@awinic.com: Add regulator driver for the device Awinic AW37503 which is single inductor - dual output power supply device. AW37503 device is designed to support general positive/negative driven applications like TFT display panels.
2023-08-21regulator: aw37503: add regulator driver for Awinic AW37503Alec Li3-0/+249
Add regulator driver for the device Awinic AW37503 which is single inductor - dual output power supply device. AW37503 device is designed to support general positive/negative driven applications like TFT display panels. AW37503 regulator driver supports to enable/disable and set voltage on its output. Signed-off-by: Alec Li <like@awinic.com> Link: https://lore.kernel.org/r/20230821035355.1269976-2-like@awinic.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-18regulator: tps65086: Select dedicated regulator config for chip variantAndre Werner1-8/+180
Some configurations differ between chip variants, e,g. the register to control the on of state of LDOA1 and SWB2. Thus, it is necessary to choose the correct configuration for a dedicated device. If the wrong configuration was used, the LDOA1 output that was disabled by the bootloader was enabled in Kernel again. Each chip variant gets its dedicated configuration selected by the chip ID previously collected from MFD probe function. The VTT enum value (tps65086_regulators) is shifted because not all chip variants have a separate SWB2 switch. Sometimes they are merged. So the configuration possibilities differ, thus the regulator configuration arrays have a different length. Signed-off-by: Andre Werner <andre.werner@systec-electronic.com> Link: https://lore.kernel.org/r/20230818083721.29790-5-andre.werner@systec-electronic.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-18regulator: raa215300: Update help descriptionBiju Das1-1/+5
Add module description to the help section and update the existing help description. Reported-by: Pavel Machek <pavel@denx.de> Closes: https://lore.kernel.org/all/ZN3%2FSjL50ls+3dnD@duo.ucw.cz/ Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230818141815.314197-4-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-18regulator: raa215300: Add missing blank spaceBiju Das1-1/+1
Add the missing space in the comment block. Reported-by: Pavel Machek <pavel@denx.de> Closes: https://lore.kernel.org/all/ZN3%2FSjL50ls+3dnD@duo.ucw.cz/ Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230818141815.314197-3-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-18regulator: raa215300: Change rate from 32000->32768Biju Das1-1/+1
Replace the rate 32000->32768 in devm_clk_hw_register_fixed_rate() as the 32kHz frequency mentioned in the hardware manual is actually 32.768kHz. Reported-by: Pavel Machek <pavel@denx.de> Closes: https://lore.kernel.org/all/ZN3%2FSjL50ls+3dnD@duo.ucw.cz/ Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230818141815.314197-2-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-16regulator: raa215300: Add const definitionBiju Das1-1/+1
Add const definition to the initialized local variable name to avoid overriding. Also the second parameter in strscpy is const char * instead of char *. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230816135550.146657-3-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-16regulator: raa215300: Fix resource leak in case of errorBiju Das1-8/+8
The clk_register_clkdev() allocates memory by calling vclkdev_alloc() and this memory is not freed in the error path. Similarly, resources allocated by clk_register_fixed_rate() are not freed in the error path. Fix these issues by using devm_clk_hw_register_fixed_rate() and devm_clk_hw_register_clkdev(). After this, the static variable clk is not needed. Replace it with  local variable hw in probe() and drop calling clk_unregister_fixed_rate() from raa215300_rtc_unregister_device(). Fixes: 7bce16630837 ("regulator: Add Renesas PMIC RAA215300 driver") Cc: stable@kernel.org Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230816135550.146657-2-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-14regulator: rtq2208: Switch back to use struct i2c_driver's .probe()Uwe Kleine-König1-1/+1
struct i2c_driver::probe_new is about to go away. Switch the driver to use the probe callback with the same prototype. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230814210759.26395-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-10regulator: lp872x: Fix Wvoid-pointer-to-enum-cast warningKrzysztof Kozlowski1-1/+1
'id' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: lp872x.c:867:5: error: cast to smaller integer type 'enum lp872x_regulator_id' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230810111914.204847-3-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-10regulator: max77857: Fix Wvoid-pointer-to-enum-cast warningKrzysztof Kozlowski1-3/+3
'id' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: max77857-regulator.c:56:24: error: cast to smaller integer type 'enum max77857_id' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230810111914.204847-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-10regulator: ltc3589: Fix Wvoid-pointer-to-enum-cast warningKrzysztof Kozlowski1-2/+1
'variant' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: ltc3589.c:394:22: error: cast to smaller integer type 'enum ltc3589_variant' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230810111914.204847-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-10regulator: qcom_rpm-regulator: Use devm_kmemdup to replace devm_kmalloc + memcpyLi Zetao1-2/+1
Use the helper function devm_kmemdup() rather than duplicating its implementation, which helps to enhance code readability. Signed-off-by: Li Zetao <lizetao1@huawei.com> Link: https://lore.kernel.org/r/20230810114858.2103928-1-lizetao1@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-09regulator: tps6286x-regulator: Remove redundant of_match_ptr() macrosChen Jiahao1-3/+3
Since the driver tps6286x-regulator depends on CONFIG_OF, it makes no difference to wrap of_match_ptr() here. Remove of_match_ptr() macros to clean it up. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> Link: https://lore.kernel.org/r/20230809100428.2669817-8-chenjiahao16@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-09regulator: pfuze100-regulator: Remove redundant of_match_ptr() macroChen Jiahao1-2/+1
Since the driver pfuze100-regulator depends on CONFIG_OF, it makes no difference to wrap of_match_ptr() here. Remove the of_match_ptr() macro to clean it up. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> Link: https://lore.kernel.org/r/20230809100428.2669817-7-chenjiahao16@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-09regulator: mpq7920: Remove redundant of_match_ptr() macroChen Jiahao1-1/+1
Since the driver mpq7920 depends on CONFIG_OF, it makes no difference to wrap of_match_ptr() here. Remove the of_match_ptr() macro to clean it up. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> Link: https://lore.kernel.org/r/20230809100428.2669817-6-chenjiahao16@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-09regulator: mcp16502: Remove redundant of_match_ptr() macrosChen Jiahao1-3/+3
Since the driver mcp16502 depends on CONFIG_OF, it makes no difference to wrap of_match_ptr() here. Remove of_match_ptr() macros to clean it up. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> Link: https://lore.kernel.org/r/20230809100428.2669817-5-chenjiahao16@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-09regulator: hi6421: Remove redundant of_match_ptr() macrosChen Jiahao1-10/+10
Since the driver hi6421-regulator depends on CONFIG_OF, it makes no difference to wrap of_match_ptr() here. Remove of_match_ptr() macros to clean it up. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> Link: https://lore.kernel.org/r/20230809100428.2669817-4-chenjiahao16@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-09regulator: lp87565: Remove redundant of_match_ptr() macrosChen Jiahao1-2/+2
Since the driver lp87565-regulator depends on CONFIG_OF, it makes no difference to wrap of_match_ptr() here. Remove of_match_ptr() macros to clean it up. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> Link: https://lore.kernel.org/r/20230809100428.2669817-3-chenjiahao16@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-09regulator: da9121-regulator: Remove redundant of_match_ptr() macrosChen Jiahao1-9/+9
Since the driver da9121-regulator depends on CONFIG_OF, it makes no difference to wrap of_match_ptr() here. Remove of_match_ptr() macros to clean it up. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> Link: https://lore.kernel.org/r/20230809100428.2669817-2-chenjiahao16@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: bd71815: Drop useless headerLinus Walleij1-1/+0
The bd71815 regulator driver includes the legacy header <linux/gpio.h> for no reason, it is already using the proper <linux/gpio/consumer.h> include. Drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-11-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: bd71828: Drop useless headerLinus Walleij1-1/+0
The bd71828 includes the legacy header <linux/gpio.h> for no reason, drop the include. The documentation mentions GPIO but there is no usage of the GPIO namespace. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-10-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: lp8755: Drop useless headerLinus Walleij1-1/+0
The lp8755 includes the legacy header <linux/gpio.h> for no reason, drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-9-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: max20086: Drop useless headerLinus Walleij1-1/+0
The max20086 regulator driver includes the legacy header <linux/gpio.h> for no reason, it is already using the proper <linux/gpio/consumer.h> include. Drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-8-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: mcp16502: Drop useless headerLinus Walleij1-1/+0
The mcp16502 regulator driver includes the legacy header <linux/gpio.h> for no reason, it is already using the proper <linux/gpio/consumer.h> include. Drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-7-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: mt6311: Drop useless headerLinus Walleij1-1/+0
The mt6311 includes the legacy header <linux/gpio.h> for no reason, drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-6-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: rc5t583: Drop useless headerLinus Walleij1-1/+0
The RC5T583 includes the legacy header <linux/gpio.h> for no reason, drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-5-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: rpi-panel-attiny: Drop useless headerLinus Walleij1-1/+0
The RPI panel regulator driver includes the legacy header <linux/gpio.h> for no reason, this is a driver and <linux/gpio/driver.h> is already included. Drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-3-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: s2mpa01: Drop useless headerLinus Walleij1-1/+0
The TPS65910 includes the legacy header <linux/gpio.h> for no reason, drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-2-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: tps65910: Drop useless headerLinus Walleij1-1/+0
The TPS65910 includes the legacy header <linux/gpio.h> for no reason, drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-1-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-07regulator: rpi-panel-attiny-regulator: Remove redundant of_match_ptr()Ruan Jinjie1-1/+1
The driver depends on CONFIG_OF, so it is not necessary to use of_match_ptr() here, and __maybe_unused can also be removed. Even for drivers that do not depend on CONFIG_OF, it's almost always better to leave out the of_match_ptr(), since the only thing it can possibly do is to save a few bytes of .text if a driver can be used both with and without it. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Link: https://lore.kernel.org/r/20230807134127.2380390-1-ruanjinjie@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-07Add Richtek RTQ2208 SubPMIC supportMark Brown3-0/+595
Merge series from Alina Yu <alina_yu@richtek.com>: This patch series adds support for RTQ2208 SubPMIC regulators. The RTQ2208 is a multi-phase, programmable power management IC that integrate with dual multi-configurable, synchronous buck converters and two ldos. The bucks features wide output voltage range from 0.4V to 2.05V and the capability to configure the corresponding power stages.
2023-08-07regulator: qcom-rpmh: Fix LDO 12 regulator for PM8550Abel Vesa1-1/+1
The LDO 12 is NLDO 515 low voltage type, so fix accordingly. Fixes: e6e3776d682d ("regulator: qcom-rpmh: Add support for PM8550 regulators") Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20230801095702.2891127-1-abel.vesa@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-07regulator: max5970: Rename driver and remove wildcardNaresh Solanki3-18/+18
The previous version of this driver included wildcards in file names and descriptions. This patch renames the driver to only support MAX5970 and MAX5978, which are the only chips that the driver actually supports. Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> Link: https://lore.kernel.org/r/20230801102453.1798292-1-Naresh.Solanki@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-07regulator: rtq2208: Add Richtek RTQ2208 SubPMIC driverAlina Yu3-0/+595
Add support for the RTQ2208 SubPMIC This ic integrates with configurable, synchrnous buck converters and two ldos. Signed-off-by: Alina Yu <alina_yu@richtek.com> Link: https://lore.kernel.org/r/1691389687-31211-3-git-send-email-alina_yu@richtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-04regulator: da9063: better fix null deref with partial DTMartin Fuzzey1-6/+6
Two versions of the original patch were sent but V1 was merged instead of V2 due to a mistake. So update to V2. The advantage of V2 is that it completely avoids dereferencing the pointer, even just to take the address, which may fix problems with some compilers. Both versions work on my gcc 9.4 but use the safer one. Fixes: 98e2dd5f7a8b ("regulator: da9063: fix null pointer deref with partial DT config") Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group> Tested-by: Benjamin Bara <benjamin.bara@skidata.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20230804083514.1887124-1-martin.fuzzey@flowbird.group Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-03regulator: max77857: fix build error in max77857-regulator.cYang Yingliang1-2/+4
When using low verion gcc(7.5) to build the max77857-regulator driver, got the following error: drivers/regulator/max77857-regulator.c:312:16: error: initializer element is not constant .ramp_delay = max77857_ramp_table[0][0], To fix this by introducing a macro RAMAP_DELAY_INIT_VAL to define the value of max77857_ramp_table[0[0]. Fixes: af71cccadece ("regulator: max77857: Add ADI MAX77857/59/MAX77831 Regulator Support") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230803113654.818640-1-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-03regulator: userspace-consumer: Add regulator event supportNaresh Solanki1-1/+51
Add sysfs attribute to track regulator events received from regulator notifier block handler. Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> Link: https://lore.kernel.org/r/20230803111225.107572-1-Naresh.Solanki@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-01regulator: max77857: change some variables to staticYang Yingliang1-2/+2
max77857_regmap_config and max77857_driver are only used in max77857-regulator.c now, change them to static. Fixes: af71cccadeced ("regulator: max77857: Add ADI MAX77857/59/MAX77831 Regulator Support") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230801130354.552243-1-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-30regulator: Merge up fixes from Linus' treeMark Brown1-5/+5
Gets us pine64plus back if nothing else.
2023-07-25regulator: REGULATOR_QCOM_REFGEN should depend on ARCH_QCOMGeert Uytterhoeven1-0/+1
The Qualcomm MMIO-mapped reference voltage regulator is only present on Qualcomm SoCs. Hence add a dependency on ARCH_QCOM, to prevent asking the user about this driver when configuring a kernel without Qualcomm SoC support. Fixes: 7cbfbe23796086fd ("regulator: Introduce Qualcomm REFGEN regulator driver") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/60938ed138c9331ba3d2891fbd3b3d6644d3fbdc.1690300012.git.geert+renesas@glider.be Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-25regulator: Use bitfield values for range selectorsChen-Yu Tsai7-26/+29
Right now the regulator helpers expect raw register values for the range selectors. This is different from the voltage selectors, which are normalized as bitfield values. This leads to a bit of confusion. Also, raw values are harder to copy from datasheets or match up with them, as datasheets will typically have bitfield values. Make the helpers expect bitfield values, and convert existing users. The field in regulator_desc is renamed to |linear_range_selectors_bitfield|. This is intended to cause drivers added in the same merge window and out-of-tree drivers using the incorrect variable and values to break, preventing incorrect values being used on actual hardware and potentially producing magic smoke. Also include bitops.h explicitly for ffs(), and reorder the header include statements. While at it, also replace module.h with export.h, since the only use is EXPORT_SYMBOL_GPL. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://lore.kernel.org/r/20230714081408.274567-1-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-23regulator: mt6358: Fix incorrect VCN33 sync error messageChen-Yu Tsai1-1/+1
After syncing the enable status of VCN33_WIFI to VCN33_BT, the driver will disable VCN33_WIFI. If it fails it will error out with a message. However the error message incorrectly refers to VCN33_BT. Fix the error message so that it correctly refers to VCN33_WIFI. Suggested-by: Fei Shao <fshao@chromium.org> Fixes: 65bae54e08c1 ("regulator: mt6358: Merge VCN33_* regulators") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230721082903.2038975-4-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-23regulator: mt6358: Sync VCN33_* enable status after checking IDChen-Yu Tsai1-4/+4
Syncing VCN33_* enable status should be done after checking the PMIC's ID, to avoid setting random bits on other PMICs. Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Fixes: 65bae54e08c1 ("regulator: mt6358: Merge VCN33_* regulators") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20230721082903.2038975-3-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-23regulator: Merge up fixes from mainlineMark Brown1-0/+3
There's several things here that will really help my CI.
2023-07-21Add regulators support for PMX75Mark Brown1-0/+38
Merge series from Rohit Agarwal <quic_rohiagar@quicinc.com>: This series adds regulators supports in PMX75 found on SDX75 platform.
2023-07-21regulator: qcom-rpmh: Add regulators support for PMX75Rohit Agarwal1-0/+38
Add support from RPMH regulators found in PMX75 for SDX75 platform. Signed-off-by: Rohit Agarwal <quic_rohiagar@quicinc.com> Link: https://lore.kernel.org/r/1689062414-3654-4-git-send-email-quic_rohiagar@quicinc.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-21regulator: max8893: Drop "_new" from probe callbackUwe Kleine-König1-2/+2
The driver was introduced when .probe_new was the right probe callback to use for i2c drivers. Today .probe is the right one (again) and the driver was already switched in commit 964e186547b2 ("regulator: Switch i2c drivers back to use .probe()") but the name continued to include "_new". To prevent code readers wondering about what might be new here, drop that part of the name. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230721073303.112597-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-19regulator: max77857: mark more functions staticArnd Bergmann1-3/+3
A few functions in the new driver are global but only used in this file: drivers/regulator/max77857-regulator.c:209:5: error: no previous prototype for 'max77859_get_voltage_sel' [-Werror=missing-prototypes] drivers/regulator/max77857-regulator.c:221:5: error: no previous prototype for 'max77859_set_current_limit' [-Werror=missing-prototypes] drivers/regulator/max77857-regulator.c:235:5: error: no previous prototype for 'max77859_get_current_limit' [-Werror=missing-prototypes] Mark them static, which produces potentially better code and avoids the warning. Fixes: af71cccadeced ("regulator: max77857: Add ADI MAX77857/59/MAX77831 Regulator Support") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20230718193938.3593118-1-arnd@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-19regulator: max77857: Switch back to use struct i2c_driver's .probe()Uwe Kleine-König1-1/+1
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230718201453.3953602-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-18regulator: Remove duplicated include in mt6359-regulator.cYang Li1-1/+0
./drivers/regulator/mt6359-regulator.c: linux/platform_device.h is included more than once. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5901 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Link: https://lore.kernel.org/r/20230718003255.124594-1-yang.lee@linux.alibaba.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-17regulator: max77857: Add ADI MAX77857/59/MAX77831 Regulator SupportOkan Sahin3-0/+470
Regulator driver for MAX77857/59 and MAX77831. The MAX77857 is a high-efficiency, high-performance buck-boost converter targeted for systems requiring a wide input voltage range (2.5V to 16V). The MAX77859 is high-Efficiency Buck-Boost Converter for USB-PD/PPS Applications. It has wide input range (2.5V to 22V) The MAX77831 is a high-efficiency, high-performance buck-boost converter targeted for systems requiring wide input voltage range (2.5V to 16V). Signed-off-by: Okan Sahin <okan.sahin@analog.com> Link: https://lore.kernel.org/r/20230717050736.10075-3-okan.sahin@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-17regulator: da9063: fix null pointer deref with partial DT configMartin Fuzzey1-0/+3
When some of the da9063 regulators do not have corresponding DT nodes a null pointer dereference occurs on boot because such regulators have no init_data causing the pointers calculated in da9063_check_xvp_constraints() to be invalid. Do not dereference them in this case. Fixes: b8717a80e6ee ("regulator: da9063: implement setter for voltage monitoring") Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group> Link: https://lore.kernel.org/r/20230616143736.2946173-1-martin.fuzzey@flowbird.group Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-14regulator: Explicitly include correct DT includesRob Herring36-38/+28
The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230714174930.4063320-1-robh@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-13regulator: da9062: Make the use of IRQ optionalChristoph Niedermaier1-6/+5
This patch makes the use of IRQ optional to make the DA9061/62 usable for designs that don't have the IRQ pin connected, because the regulator is usable without IRQ. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Reviewed-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20230713090328.3879-1-cniedermaier@dh-electronics.com Signed-off-by: Mark Brown <broonie@kernel.org>