summaryrefslogtreecommitdiff
path: root/drivers/regulator
AgeCommit message (Collapse)Author
2020-09-25Merge tag 'regulator-fix-v5.9-rc6' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator fix from Mark Brown: "A single fix for incorrect specification of some of the register fields on axp20x devices which would break voltage setting on affected systems" * tag 'regulator-fix-v5.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: axp20x: fix LDO2/4 description
2020-09-23regulator: axp20x: fix LDO2/4 descriptionIcenowy Zheng
Currently we wrongly set the mask of value of LDO2/4 both to the mask of LDO2, and the LDO4 voltage configuration is left untouched. This leads to conflict when LDO2/4 are both in use. Fix this issue by setting different vsel_mask to both regulators. Fixes: db4a555f7c4c ("regulator: axp20x: use defines for masks") Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Link: https://lore.kernel.org/r/20200923005142.147135-1-icenowy@aosc.io Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-11Merge tag 'regulator-fix-v5.9-rc4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator fixes from Mark Brown: "The biggest set of fixes here is those from Michał Mirosław fixing some locking issues with coupled regulators that are triggered in cases where a coupled regulator is used by a device involved in fs_reclaim like eMMC storage. These are relatively serious for the affected systems, though the circumstances where they trigger are very rare" * tag 'regulator-fix-v5.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: pwm: Fix machine constraints application regulator: core: Fix slab-out-of-bounds in regulator_unlock_recursive() regulator: remove superfluous lock in regulator_resolve_coupling() regulator: cleanup regulator_ena_gpio_free() regulator: plug of_node leak in regulator_register()'s error path regulator: push allocation in set_consumer_device_supply() out of lock regulator: push allocations in create_regulator() outside of lock regulator: push allocation in regulator_ena_gpio_request() out of lock regulator: push allocation in regulator_init_coupling() outside of lock regulator: fix spelling mistake "Cant" -> "Can't" regulator: cros-ec-regulator: Add NULL test for devm_kmemdup call
2020-09-02regulator: pwm: Fix machine constraints applicationVincent Whitchurch
If the zero duty cycle doesn't correspond to any voltage in the voltage table, the PWM regulator returns an -EINVAL from get_voltage_sel() which results in the core erroring out with a "failed to get the current voltage" and ending up not applying the machine constraints. Instead, return -ENOTRECOVERABLE which makes the core set the voltage since it's at an unknown value. For example, with this device tree: fooregulator { compatible = "pwm-regulator"; pwms = <&foopwm 0 100000>; regulator-min-microvolt = <2250000>; regulator-max-microvolt = <2250000>; regulator-name = "fooregulator"; regulator-always-on; regulator-boot-on; voltage-table = <2250000 30>; }; Before this patch: fooregulator: failed to get the current voltage(-22) After this patch: fooregulator: Setting 2250000-2250000uV fooregulator: 2250 mV Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Link: https://lore.kernel.org/r/20200902130952.24880-1-vincent.whitchurch@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-01regulator: core: Fix slab-out-of-bounds in regulator_unlock_recursive()Dmitry Osipenko
The recent commit 7d8196641ee1 ("regulator: Remove pointer table overallocation") changed the size of coupled_rdevs and now KASAN is able to detect slab-out-of-bounds problem in regulator_unlock_recursive(), which is a legit problem caused by a typo in the code. The recursive unlock function uses n_coupled value of a parent regulator for unlocking supply regulator, while supply's n_coupled should be used. In practice problem may only affect platforms that use coupled regulators. Cc: stable@vger.kernel.org # 5.0+ Fixes: f8702f9e4aa7 ("regulator: core: Use ww_mutex for regulators locking") Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200831204335.19489-1-digetx@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-25Merge tag 'v5.9-rc2' into regulator-5.9Mark Brown
Linux 5.9-rc2
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-08-17regulator: remove superfluous lock in regulator_resolve_coupling()Michał Mirosław
The code modifies rdev, but locks c_rdev instead. Remove the lock as this is held together by regulator_list_mutex taken in the caller. Fixes: f9503385b187 ("regulator: core: Mutually resolve regulators coupling") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/25eb81cefb37a646f3e44eaaf1d8ae8881cfde52.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: cleanup regulator_ena_gpio_free()Michał Mirosław
Since only regulator_ena_gpio_request() allocates rdev->ena_pin, and it guarantees that same gpiod gets same pin structure, it is enough to compare just the pointers. Also we know there can be only one matching entry on the list. Rework the code take advantage of the facts. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/3ff002c7aa3bd774491af4291a9df23541fcf892.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: plug of_node leak in regulator_register()'s error pathMichał Mirosław
By calling device_initialize() earlier and noting that kfree(NULL) is ok, we can save a bit of code in error handling and plug of_node leak. Fixed commit already did part of the work. Fixes: 9177514ce349 ("regulator: fix memory leak on error path of regulator_register()") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Vladimir Zapolskiy <vz@mleia.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/f5035b1b4d40745e66bacd571bbbb5e4644d21a1.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: push allocation in set_consumer_device_supply() out of lockMichał Mirosław
Pull regulator_list_mutex into set_consumer_device_supply() and keep allocations outside of it. Fourth of the fs_reclaim deadlock case. Fixes: 45389c47526d ("regulator: core: Add early supply resolution for regulators") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/f0380bdb3d60aeefa9693c4e234d2dcda7e56747.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: push allocations in create_regulator() outside of lockMichał Mirosław
Move all allocations outside of the regulator_lock()ed section. ====================================================== WARNING: possible circular locking dependency detected 5.7.13+ #535 Not tainted ------------------------------------------------------ f2fs_discard-179:7/702 is trying to acquire lock: c0e5d920 (regulator_list_mutex){+.+.}-{3:3}, at: regulator_lock_dependent+0x54/0x2c0 but task is already holding lock: cb95b080 (&dcc->cmd_lock){+.+.}-{3:3}, at: __issue_discard_cmd+0xec/0x5f8 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: [...] -> #3 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire.part.11+0x40/0x50 fs_reclaim_acquire+0x24/0x28 __kmalloc_track_caller+0x54/0x218 kstrdup+0x40/0x5c create_regulator+0xf4/0x368 regulator_resolve_supply+0x1a0/0x200 regulator_register+0x9c8/0x163c [...] other info that might help us debug this: Chain exists of: regulator_list_mutex --> &sit_i->sentry_lock --> &dcc->cmd_lock [...] Fixes: f8702f9e4aa7 ("regulator: core: Use ww_mutex for regulators locking") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/6eebc99b2474f4ffaa0405b15178ece0e7e4f608.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: push allocation in regulator_ena_gpio_request() out of lockMichał Mirosław
Move another allocation out of regulator_list_mutex-protected region, as reclaim might want to take the same lock. WARNING: possible circular locking dependency detected 5.7.13+ #534 Not tainted ------------------------------------------------------ kswapd0/383 is trying to acquire lock: c0e5d920 (regulator_list_mutex){+.+.}-{3:3}, at: regulator_lock_dependent+0x54/0x2c0 but task is already holding lock: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire.part.11+0x40/0x50 fs_reclaim_acquire+0x24/0x28 kmem_cache_alloc_trace+0x40/0x1e8 regulator_register+0x384/0x1630 devm_regulator_register+0x50/0x84 reg_fixed_voltage_probe+0x248/0x35c [...] other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(fs_reclaim); lock(regulator_list_mutex); lock(fs_reclaim); lock(regulator_list_mutex); *** DEADLOCK *** [...] 2 locks held by kswapd0/383: #0: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 #1: cb70e5e0 (hctx->srcu){....}-{0:0}, at: hctx_lock+0x60/0xb8 [...] Fixes: 541d052d7215 ("regulator: core: Only support passing enable GPIO descriptors") [this commit only changes context] Fixes: f8702f9e4aa7 ("regulator: core: Use ww_mutex for regulators locking") [this is when the regulator_list_mutex was introduced in reclaim locking path] Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/41fe6a9670335721b48e8f5195038c3d67a3bf92.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-17regulator: push allocation in regulator_init_coupling() outside of lockMichał Mirosław
Allocating memory with regulator_list_mutex held makes lockdep unhappy when memory pressure makes the system do fs_reclaim on eg. eMMC using a regulator. Push the lock inside regulator_init_coupling() after the allocation. ====================================================== WARNING: possible circular locking dependency detected 5.7.13+ #533 Not tainted ------------------------------------------------------ kswapd0/383 is trying to acquire lock: cca78ca4 (&sbi->write_io[i][j].io_rwsem){++++}-{3:3}, at: __submit_merged_write_cond+0x104/0x154 but task is already holding lock: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire.part.11+0x40/0x50 fs_reclaim_acquire+0x24/0x28 __kmalloc+0x54/0x218 regulator_register+0x860/0x1584 dummy_regulator_probe+0x60/0xa8 [...] other info that might help us debug this: Chain exists of: &sbi->write_io[i][j].io_rwsem --> regulator_list_mutex --> fs_reclaim Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(fs_reclaim); lock(regulator_list_mutex); lock(fs_reclaim); lock(&sbi->write_io[i][j].io_rwsem); *** DEADLOCK *** 1 lock held by kswapd0/383: #0: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 [...] Fixes: d8ca7d184b33 ("regulator: core: Introduce API for regulators coupling customization") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/1a889cf7f61c6429c9e6b34ddcdde99be77a26b6.1597195321.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-10regulator: fix spelling mistake "Cant" -> "Can't"Colin Ian King
There is a spelling mistake in a dev_err message. Fix it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20200810093931.50624-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-04regulator: cros-ec-regulator: Add NULL test for devm_kmemdup callAxel Lin
Fix possible NULL pointer dereference. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20200802032509.305425-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-30Merge remote-tracking branch 'regulator/for-5.9' into regulator-nextMark Brown
2020-07-28regulator: cros-ec-regulator: Fix double free of desc->name.Pi-Hsun Shih
The desc->name field is allocated with devm_kstrdup, but is also kfreed on the error path, causing it to be double freed. Remove the kfree on the error path. Fixes: 8d9f8d57e023 ("regulator: Add driver for cros-ec-regulator") Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20200728091909.2009771-1-pihsun@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-27regulator: pca9450: Convert to use module_i2c_driverAxel Lin
Use module_i2c_driver to simplify driver init boilerplate. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20200725014414.1825183-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-24regulator: fix memory leak on error path of regulator_register()Vladimir Zapolskiy
The change corrects registration and deregistration on error path of a regulator, the problem was manifested by a reported memory leak on deferred probe: as3722-regulator as3722-regulator: regulator 13 register failed -517 # cat /sys/kernel/debug/kmemleak unreferenced object 0xecc43740 (size 64): comm "swapper/0", pid 1, jiffies 4294937640 (age 712.880s) hex dump (first 32 bytes): 72 65 67 75 6c 61 74 6f 72 2e 32 34 00 5a 5a 5a regulator.24.ZZZ 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZZZZZZZZZ backtrace: [<0c4c3d1c>] __kmalloc_track_caller+0x15c/0x2c0 [<40c0ad48>] kvasprintf+0x64/0xd4 [<109abd29>] kvasprintf_const+0x70/0x84 [<c4215946>] kobject_set_name_vargs+0x34/0xa8 [<62282ea2>] dev_set_name+0x40/0x64 [<a39b6757>] regulator_register+0x3a4/0x1344 [<16a9543f>] devm_regulator_register+0x4c/0x84 [<51a4c6a1>] as3722_regulator_probe+0x294/0x754 ... The memory leak problem was introduced as a side ef another fix in regulator_register() error path, I believe that the proper fix is to decouple device_register() function into its two compounds and initialize a struct device before assigning any values to its fields and then using it before actual registration of a device happens. This lets to call put_device() safely after initialization, and, since now a release callback is called, kfree(rdev->constraints) shall be removed to exclude a double free condition. Fixes: a3cde9534ebd ("regulator: core: fix regulator_register() error paths to properly release rdev") Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Cc: Wen Yang <wenyang@linux.alibaba.com> Link: https://lore.kernel.org/r/20200724005013.23278-1-vz@mleia.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-22regulator: Replace HTTP links with HTTPS onesAlexander A. Klimov
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Acked-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20200719200623.61524-1-grandmaster@al2klimov.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-20Merge series "regulator_sync_state() support" from Saravana Kannan ↵Mark Brown
<saravanak@google.com>: Consider the following example: - regulator-X is provided by device-X. - regulator-X is a supplier to device-A, device-B and device-C. - device-A is off/inactive from boot. - device-B and device-C are left on/active by the bootloader - regulator-X is left on boot by the bootloader at 2000 mV to supply device-B and device-C. Example boot sequence 1: 1. device-X is probed successfully. 2. device-A is probed by driver-A a. driver-A gets regulator-X b. driver-A votes on regulator-X c. driver-A initializes device-A d. driver-A votes off regulator-X e. regulator-X is turned off. 3. System crashes or device-B and device-C become unreliable because regulator-X was turned off without following the proper quiescing steps for device-B and device-C. Example boot sequence 2: 1. device-X is probed successfully. 2. device-B is probed by driver-B a. driver-B gets regulator-X b. driver-B votes on regulator-X c. driver-B lowers device-B performance point. d. driver-B lowers voltage vote to 1000 mV. e. regulator-X voltage is lowered to 1000 mV. 3. System crashes or device-C becomes unreliable because regulator-X voltage was lowered to 1000 mV when device-C still needed it at 2000 mV This patch series makes sure these examples are handled correctly and system crash or device instability is avoided and the system remains usable. More details provided in the commit texts. v2->v3: Patch 2/4 - No functional change. Simple refactor. Patch 3/4 - Was Patch 2/2 in v2. - Rewrote commit text to hopefully address all previous points. - Renamed variable/functions. Hope it's clearer. - Added more comments. - Added logging - Fixed timeout functionality. - Handle exclusive consumers properly - Handle coupled regulators properly Patch 4/4 - Prevents voltage from going too low during boot. v1->v2: Patch 1/2 - New patch Patch 2/2 - This was the only patch in v1 - Made the late_initcall_sync timeout a commandline param - If timeout is set, we also give up waiting for all consumers after the timeout expires. - Made every regulator driver add sync_state() support Saravana Kannan (4): driver core: Add dev_set_drv_sync_state() regulator: core: Add destroy_regulator() regulator: core: Add basic enable/disable support for sync_state() callbacks regulator: core: Add voltage support for sync_state() callbacks drivers/regulator/core.c | 200 ++++++++++++++++++++++++++++--- include/linux/device.h | 12 ++ include/linux/regulator/driver.h | 2 + 3 files changed, 198 insertions(+), 16 deletions(-) -- 2.28.0.rc0.105.gf9edc3c819-goog
2020-07-20regulator: gpio: Honor regulator-boot-on propertyChen-Yu Tsai
When requesting the enable GPIO, the driver should do so with the correct output level matching some expected state. This is especially important if the regulator is a critical one, such as a supply for the boot CPU. This is currently done by checking for the enable-at-boot property, but this is not documented in the device tree binding, nor does it match the common regulator properties. Honor the common regulator-boot-on property by checking the boot_on constraint setting within the DT probe path. This is the same as what is done in the fixed regulator driver. Also add a comment stating that the enable-at-boot property should not be used. Fixes: 006694d099e8 ("regulator: gpio-regulator: Allow use of GPIO controlled regulators though DT") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Link: https://lore.kernel.org/r/20200720132809.26908-1-wens@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-20regulator: core: Add destroy_regulator()Saravana Kannan
Part of the regulator_get() code is already factored out into create_regulator(). This patch factors out some of the regulator_put() code into destroy_regulator() so that create_regulator() has a corresponding unwind function. Subsequent patches will use this function. Signed-off-by: Saravana Kannan <saravanak@google.com> Link: https://lore.kernel.org/r/20200716042053.1927676-3-saravanak@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-15regulator: qcom: Add labibb driverNisha Kumari
Qualcomm platforms have LAB(LCD AMOLED Boost)/IBB(Inverting Buck Boost) regulators, labibb for short, which are used as power supply for LCD Mode displays. This patch adds labibb regulator driver for pmi8998 PMIC, found on SDM845 platforms. [sumits: reworked the driver design as per upstream review] Signed-off-by: Nisha Kumari <nishakumari@codeaurora.org> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Link: https://lore.kernel.org/r/20200622124110.20971-5-sumit.semwal@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-15regulator: Allow regulators to verify enabled during enable()Sumit Semwal
Some regulators might need to verify that they have indeed been enabled after the enable() call is made and enable_time delay has passed. This is implemented by repeatedly checking is_enabled() upto poll_enabled_time, waiting for the already calculated enable delay in each iteration. Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Link: https://lore.kernel.org/r/20200622124110.20971-2-sumit.semwal@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-13regulator: cros-ec: Constify cros_ec_regulator_voltage_opsRikard Falkeborn
It is never modified, so make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Acked-by: Pi-Hsun Shih <pihsun@chromium.org> Link: https://lore.kernel.org/r/20200711114409.9911-1-rikard.falkeborn@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-08regulator: devres: Standardise on function documentation headersLee Jones
Line up descriptions, start description with a lower-case character and omit old definitions such as quoting the old argument "consumer". Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20200708124832.3441649-4-lee.jones@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-08regulator: of_regulator: Add missing colon for rdev kerneldoc argumentLee Jones
Kerneldoc validation gets confused if syntax isn't "@.*: ". Adding the missing colons squashes the following W=1 warnings: Signed-off-by: Lee Jones <lee.jones@linaro.org> Cc: Rajendra Nayak <rnayak@ti.com> Link: https://lore.kernel.org/r/20200708124832.3441649-3-lee.jones@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-08regulator: devres: Fix issues with kerneldoc headersLee Jones
Provide descriptions for some missing function args and rename others to match the names used. Fixes the following W=1 warning(s): drivers/regulator/devres.c:187: warning: Function parameter or member 'dev' not described in 'devm_regulator_register' drivers/regulator/devres.c:226: warning: Function parameter or member 'dev' not described in 'devm_regulator_unregister' drivers/regulator/devres.c:226: warning: Function parameter or member 'rdev' not described in 'devm_regulator_unregister' drivers/regulator/devres.c:226: warning: Excess function parameter 'regulator' description in 'devm_regulator_unregister' Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20200708124832.3441649-2-lee.jones@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-07regulator: fan53880: Add support for COMPILE_TESTChristoph Fritz
This patch adds support for COMPILE_TEST while fixing a warning when no support for device tree is there. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Link: https://lore.kernel.org/r/1c437154873ace65ff738a0ebca511308f1cecc1.camel@googlemail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-06Merge series "Add pca9450 driver" from Robin Gong <yibin.gong@nxp.com>:Mark Brown
Add pca9450 driver for i.mx8mn-evk board. PCA9450A/B/C supported now. Please refer to below link for PCA9450 datasheet: https://www.nxp.com/docs/en/data-sheet/PCA9450DS.pdf v2: 1. rebase with the latest code to use linear_ranges helper instead. 2. address Frieder's comments, such as dulipcated buck4 description, debug info added etc. Robin Gong (4): regulator: pca9450: add pca9450 pmic driver dt-bindings: regulator: add pca9450 regulator yaml arm64: dts: imx8mn-evk: add pca9450 for i.mx8mn-evk board arm64: configs: add pca9450 pmic driver .../bindings/regulator/nxp,pca9450-regulator.yaml | 190 +++++ arch/arm64/boot/dts/freescale/imx8mn-evk.dts | 96 +++ arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi | 6 + arch/arm64/configs/defconfig | 1 + drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/pca9450-regulator.c | 859 +++++++++++++++++++++ include/linux/regulator/pca9450.h | 219 ++++++ 8 files changed, 1380 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml create mode 100644 drivers/regulator/pca9450-regulator.c create mode 100644 include/linux/regulator/pca9450.h -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2020-07-06regulator: fan53880: Add missing .owner field in regulator_descAxel Lin
Add missing .owner field in regulator_desc, which is used for refcounting. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20200706080944.663750-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-06regulator: pca9450: add pca9450 pmic driverRobin Gong
Add NXP pca9450 pmic driver. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de> Link: https://lore.kernel.org/r/1593793178-9737-2-git-send-email-yibin.gong@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-03regulator: fan53880: Add initial supportChristoph Fritz
This patch adds support for ON Semiconductor FAN53880 regulator. The FAN53880 is an I2C porgrammable power management IC (PMIC) that contains a BUCK (step-down converter), four LDOs (low dropouts) and one BOOST (step-up converter). It is designed for mobile power applications. Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Link: https://lore.kernel.org/r/20200702210846.31659-2-chf.fritz@googlemail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02Merge series "regulator: mt6397: Implement of_map_mode regulator_desc ↵Mark Brown
function" from Anand K Mistry <amistry@google.com>: This patchset adds support for being able to change regulator modes for the mt6397 regulator. This is needed to allow the voltage scaling support in the MT8173 SoC to be used on the elm (Acer Chromebook R13) and hana (several Lenovo Chromebooks) devices. Without a of_map_mode implementation, the regulator-allowed-modes devicetree field is skipped, and attempting to change the regulator mode results in an error: [ 1.439165] vpca15: mode operation not allowed Changes in v2: - Introduce constants in dt-bindings - Improve conditional readability Anand K Mistry (4): regulator: mt6397: Move buck modes into header file dt-bindings: regulator: mt6397: Document valid modes regulator: mt6397: Implement of_map_mode arm64: dts: mediatek: Update allowed mt6397 regulator modes for elm boards .../bindings/regulator/mt6397-regulator.txt | 3 +++ arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 4 +++- drivers/regulator/mt6397-regulator.c | 17 ++++++++++++++--- .../regulator/mediatek,mt6397-regulator.h | 15 +++++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 include/dt-bindings/regulator/mediatek,mt6397-regulator.h -- 2.27.0.212.ge8ba1cc988-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2020-07-02Merge series "regulator: da9211: support changing modes" from Anand K Mistry ↵Mark Brown
<amistry@google.com>: This patchset adds support for being able to change regulator modes for the da9211 regulator. This is needed to allow the voltage scaling support in the MT8173 SoC to be used in the elm (Acer Chromebook R13) and hana (several Lenovo Chromebooks) devices. Anand K Mistry (4): regulator: da9211: Move buck modes into header file dt-bindings: regulator: da9211: Document allowed modes regulator: da9211: Implement of_map_mode arm64: dts: mediatek: Update allowed regulator modes for elm boards .../devicetree/bindings/regulator/da9211.txt | 4 +++ arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 4 ++- drivers/regulator/da9211-regulator.c | 30 +++++++++++++++---- .../regulator/dlg,da9211-regulator.h | 16 ++++++++++ 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 include/dt-bindings/regulator/dlg,da9211-regulator.h -- 2.27.0.212.ge8ba1cc988-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2020-07-02Merge series "regulator: add support for SY8827N regulator" from Jisheng ↵Mark Brown
Zhang <Jisheng.Zhang@synaptics.com>: The SY8827N from Silergy Corp is a single output DC/DC converter. The voltage can be controlled via I2C. Jisheng Zhang (2): dt-bindings: regulator: add document bindings for sy8827n regulator: add support for SY8827N regulator .../bindings/regulator/silergy,sy8827n.yaml | 45 +++++ drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/sy8827n.c | 185 ++++++++++++++++++ 4 files changed, 238 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/silergy,sy8827n.yaml create mode 100644 drivers/regulator/sy8827n.c -- 2.27.0
2020-07-02regulator: mp886x: use .probe_newJisheng Zhang
Use the new .probe_new for mp886x. It does not use the const struct i2c_device_id * argument, so convert it to utilise the simplified i2c driver registration. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200702100200.1a4c65d1@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02regulator: fix null pointer check on regmapColin Ian King
The null pointer check on regmap that checks for a dev_get_regmap failure is currently returning -ENOENT if the regmap succeeded. Fix this by adding in the missing ! operator. Fixes: 4fe66d5a62fb ("regulator: Add support for QCOM PMIC VBUS booster") Signed-off-by: Colin Ian King <colin.king@canonical.com> Addresses-Coverity: ("Dereference after null check") Link: https://lore.kernel.org/r/20200702115659.38208-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02regulator: da9211: Implement of_map_modeAnand K Mistry
Implementing of_map_mode is necessary to be able to specify operating modes in the devicetree using 'regulator-allowed-modes', and to change regulator modes. Signed-off-by: Anand K Mistry <amistry@google.com> Link: https://lore.kernel.org/r/20200702131350.3.I6a0bc18fcdb2fe13e838a31e6d034d0e095368bc@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02regulator: da9211: Move buck modes into header fileAnand K Mistry
This will allow device trees to make use of these constants. Signed-off-by: Anand K Mistry <amistry@google.com> Link: https://lore.kernel.org/r/20200702131350.1.I96e67ab7b4568287eb939e8a572cbc03e87f1aa0@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02regulator: add support for SY8827N regulatorJisheng Zhang
The SY8827N from Silergy Corp is a single output DC/DC converter. The voltage can be controlled via I2C. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200702171438.20edc523@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02regulator: mt6397: Implement of_map_modeAnand K Mistry
Implementing of_map_mode is necessary to be able to specify operating modes in the devicetree using 'regulator-allowed-modes', and to change regulator modes. Signed-off-by: Anand K Mistry <amistry@google.com> Link: https://lore.kernel.org/r/20200702162231.v2.3.I7acfb591bfacf3b1b04a3d388385098bfcc9fecd@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02regulator: mt6397: Move buck modes into header fileAnand K Mistry
This will allow device trees to make use of these constants. Signed-off-by: Anand K Mistry <amistry@google.com> Link: https://lore.kernel.org/r/20200702162231.v2.1.Icf69e2041b1af4548347018186c3ba6310f53e66@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01Merge series "Introduce PMIC based USB type C detection" from Wesley Cheng ↵Mark Brown
<wcheng@codeaurora.org>: Changes in v4: - Modified qcom,pmic-typec binding to include the SS mux and the DRD remote endpoint nodes underneath port@1, which is assigned to the SSUSB path according to usb-connector - Added usb-connector reference to the typec dt-binding - Added tags to the usb type c and vbus nodes - Removed "qcom" tags from type c and vbus nodes - Modified Kconfig module name, and removed module alias from the typec driver Changes in v3: - Fix driver reference to match driver name in Kconfig for qcom_usb_vbus-regulator.c - Utilize regulator bitmap helpers for enable, disable and is enabled calls in qcom_usb_vbus-regulator.c - Use of_get_regulator_init_data() to initialize regulator init data, and to set constraints in qcom_usb_vbus-regulator.c - Remove the need for a local device structure in the vbus regulator driver Changes in v2: - Use devm_kzalloc() in qcom_pmic_typec_probe() - Add checks to make sure return value of typec_find_port_power_role() is valid - Added a VBUS output regulator driver, which will be used by the PMIC USB type c driver to enable/disable the source - Added logic to control vbus source from the PMIC type c driver when UFP/DFP is detected - Added dt-binding for this new regulator driver - Fixed Kconfig typec notation to match others - Leave type C block disabled until enabled by a platform DTS Add the required drivers for implementing type C orientation and role detection using the Qualcomm PMIC. Currently, PMICs such as the PM8150B have an integrated type C block, which can be utilized for this. This series adds the dt-binding, PMIC type C driver, and DTS nodes. The PMIC type C driver will register itself as a type C port w/ a registered type C switch for orientation, and will fetch a USB role switch handle for the role notifications. It will also have the ability to enable the VBUS output to any connected devices based on if the device is behaving as a UFP or DFP. Wesley Cheng (6): usb: typec: Add QCOM PMIC typec detection driver dt-bindings: usb: Add Qualcomm PMIC type C controller dt-binding arm64: boot: dts: qcom: pm8150b: Add node for USB type C block regulator: Add support for QCOM PMIC VBUS booster dt-bindings: regulator: Add dt-binding for QCOM PMIC VBUS output regulator arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster .../regulator/qcom,usb-vbus-regulator.yaml | 41 +++ .../bindings/usb/qcom,pmic-typec.yaml | 113 +++++++ arch/arm64/boot/dts/qcom/pm8150b.dtsi | 13 + arch/arm64/boot/dts/qcom/sm8150-mtp.dts | 4 + drivers/regulator/Kconfig | 10 + drivers/regulator/Makefile | 1 + drivers/regulator/qcom_usb_vbus-regulator.c | 97 ++++++ drivers/usb/typec/Kconfig | 12 + drivers/usb/typec/Makefile | 1 + drivers/usb/typec/qcom-pmic-typec.c | 275 ++++++++++++++++++ 10 files changed, 567 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml create mode 100644 drivers/regulator/qcom_usb_vbus-regulator.c create mode 100644 drivers/usb/typec/qcom-pmic-typec.c -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
2020-07-01Merge series "regulator/qcom: Constify static structs" from Rikard Falkeborn ↵Mark Brown
<rikard.falkeborn@gmail.com>: Constify some static structs to allow the compiler to put them in read-only memory. Rikard Falkeborn (2): regulator: qcom_rpm: Constify struct regulator_ops regulator: qcom_spmi: Constify struct regulator_ops drivers/regulator/qcom_rpm-regulator.c | 6 +++--- drivers/regulator/qcom_spmi-regulator.c | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) -- 2.27.0
2020-07-01Merge series "Add frequency / voltage scaling support for IPQ6018 SoC" from ↵Mark Brown
Kathiravan T <kathirav@codeaurora.org>: IPQ6018 SoC uses the PMIC MP5496. SMPA2 and LDOA2 regulator of MP5496 controls the APSS and SDCC voltage scaling respectively. Add support for the same. changes since V1: - Moved YAML conversion to the last as per Mark's comments Kathiravan T (6): dt-bindings: soc: qcom: Add IPQ6018 compatible soc: qcom: smd-rpm: Add IPQ6018 compatible dt-bindings: regulator: add MP5496 regulator compatible regulator: qcom_smd: Add MP5496 regulators dt-bindings: soc: qcom: convert the SMD-RPM document to YAML schema dt-bindings: regulator: convert QCOM SMD-RPM regulator document to YAML schema .../bindings/regulator/qcom,smd-rpm-regulator.txt | 320 --------------------- .../bindings/regulator/qcom,smd-rpm-regulator.yaml | 106 +++++++ .../devicetree/bindings/soc/qcom/qcom,smd-rpm.txt | 62 ---- .../devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml | 92 ++++++ drivers/regulator/qcom_smd-regulator.c | 34 +++ drivers/soc/qcom/smd-rpm.c | 1 + 6 files changed, 233 insertions(+), 382 deletions(-) delete mode 100644 Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt create mode 100644 Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml delete mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
2020-07-01regulator: lp87565: enable voltage regardless of ENx pinLuca Ceresoli
This driver enables outputs by setting bit EN_BUCKn in the BUCKn_CTRL1 register. However, if bit EN_PIN_CTRLn in the same register is set, the output is actually enabled only if EN_BUCKn is set AND an enable pin is active. Since the driver does not touch EN_PIN_CTRLn, the choice is left to the hardware, which in turn gets this bit from OTP memory, and in absence of OTP data it uses a default value that is documented in the datasheet for LP8752x, but not for LP8756x. Thus the driver doesn't really "know" whether it is actually enabling the output or not. In order to make sure activation is always driver-controlled, just clear the EN_PIN_CTRLn bit. Now all activation solely depend on the EN_BUCKn bit. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Link: https://lore.kernel.org/r/20200622204329.11147-2-luca@lucaceresoli.net Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01regulator: qcom_smd: Add MP5496 regulatorsKathiravan T
IPQ6018 SoC uses the PMIC MP5496. SMPA2 and LDOA2 regulator controls the APSS and SDCC voltage scaling respectively. Add support for the same. Signed-off-by: Kathiravan T <kathirav@codeaurora.org> Link: https://lore.kernel.org/r/1592889472-6843-5-git-send-email-kathirav@codeaurora.org Signed-off-by: Mark Brown <broonie@kernel.org>