summaryrefslogtreecommitdiff
path: root/drivers/power/regulator/regulator_common.c
AgeCommit message (Collapse)Author
2026-01-22power: regulator: common: fix compilation issueJulien Stephan
If CONFIG_DM_GPIO is not enabled, compilation fails with the following errors: aarch64-none-linux-gnu-ld: drivers/power/regulator/regulator_common.o: in function `regulator_common_of_to_plat': <...>/u-boot/drivers/power/regulator/regulator_common.c:30: undefined reference to `gpio_request_by_name' aarch64-none-linux-gnu-ld: drivers/power/regulator/regulator_common.o: in function `regulator_common_get_enable': <...>/u-boot/drivers/power/regulator/regulator_common.c:57: undefined reference to `dm_gpio_get_value' aarch64-none-linux-gnu-ld: drivers/power/regulator/regulator_common.o: in function `regulator_common_set_enable': <...>/u-boot/drivers/power/regulator/regulator_common.c:92: undefined reference to `dm_gpio_set_value' make: *** [Makefile:2029: u-boot] Error 139 Since the enable gpio is optional we can conditionally skip these calls. Reviewed-by: Tanmay Kathpalia <[email protected]> Reviewed-by: Peng Fan <[email protected]> Signed-off-by: Julien Stephan <[email protected]> Reviewed-by: Quentin Schulz <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2026-01-22power: regulator: common: use dm_gpio_is_valid helperJulien Stephan
Use dm_gpio_is_valid() helper function instead of manually checking the gpio. Reviewed-by: Peng Fan <[email protected]> Reviewed-by: Tanmay Kathpalia <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Julien Stephan <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2026-01-22power: regulator: common: remove unnecessary debug traceJulien Stephan
Drop the ftrace like debug() that checkpatch --strict complains about: WARNING: Unnecessary ftrace-like logging - prefer using ftrace Reviewed-by: Peng Fan <[email protected]> Reviewed-by: Tanmay Kathpalia <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Julien Stephan <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2025-11-06Revert "power: regulator: Add vin-supply for GPIO and Fixed regulators"Jonas Karlman
Rockchip boards may depend on a working MMC regulator in SPL to successfully load FIT payload from MMC. Typically, these boards only include the vmmc-supply regulator and not its vin-supply in SPL control FDT. The commit f98d812e5353 ("power: regulator: Add vin-supply for GPIO and Fixed regulators") breaks loading FIT from MMC in SPL on some of these boards due to now requiring the vin-supply to be included in the SPL control FDT. The commit also strangely enables any found vin-supply in regulator_common_of_to_plat() and not when a regulator is enabled or as part of regulator_autoset(). Revert the commit to fix FIT loading in SPL on broken boards. If a board needs to have its vin-supply enabled, two options come to mind: - Add regulator-always-on prop to the regulator in the -u-boot.dtsi for any board. - Implement full support for reference counting of regulators and then update the regulator-uclass to enable any found vin-supply when a regulator is enabled. This reverts commit f98d812e5353408ef77a46bad1f1cdc793ff8a03. Reported-by: Dang Huynh <[email protected]> Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Dragan Simic <[email protected]>
2025-10-30power: regulator: Remove duplicate include of regulator_common.hTanmay Kathpalia
Remove duplicate #include "regulator_common.h" statements from regulator driver files. Signed-off-by: Tanmay Kathpalia <[email protected]> Reviewed-by: Peng Fan <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2025-09-20power: regulator: Add vin-supply for GPIO and Fixed regulatorsYe Li
Enable the vin-supply when probing the regulator device. Signed-off-by: Ye Li <[email protected]>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-07power: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini <[email protected]>
2023-09-24common: Drop linux/printk.h from common headerSimon Glass
This old patch was marked as deferred. Bring it back to life, to continue towards the removal of common.h Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass <[email protected]>
2023-07-04regulator: rename dev_pdata to platEugen Hristev
Simplify the subsystem by renaming `dev_pdata` to just `plat`. No functional change, just trivial renaming. Suggested-by: Simon Glass <[email protected]> Signed-off-by: Eugen Hristev <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Patrice Chotard <[email protected]>
2023-07-04regulator: implement basic reference counterEugen Hristev
Some devices share a regulator supply, when the first one will request regulator disable, the second device will have it's supply cut off before graciously shutting down. Hence there will be timeouts and other failed operations. Implement a reference counter mechanism similar with what is done in Linux, to keep track of enable and disable requests, and only disable the regulator when the last of the consumers has requested shutdown. Signed-off-by: Eugen Hristev <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Patrice Chotard <[email protected]>
2020-12-13dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass
Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <[email protected]>
2020-12-13dm: treewide: Rename ofdata_to_platdata() to of_to_plat()Simon Glass
This name is far too long. Rename it to remove the 'data' bits. This makes it consistent with the platdata->plat rename. Signed-off-by: Simon Glass <[email protected]>
2020-08-03power: Tidy up inclusion of regulator_common.hSimon Glass
This file should not include common.h and dm.h so remove them. Also move the inclusion of this file to after the normal includes. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Jaehoon Chung <[email protected]>
2020-06-15regulator: fix: enable gpio when requestedMark Kettenis
The fix in commit b7adcdd073c0 has the side-effect that the regulator will be disabled when requesting the relevant gpio in regulator_common_ofdata_to_platdata() and enabled in regulator_pre_probe() when the regulator was already enabled. This leads to a short interruption in the 3.3V power to the PCIe slot on the firefly-rk3399 which makes an ADATA SX8000NP NVMe SSD unhappy. Fix this by setting the GPIOD_IS_OUT_ACTIVE flag again when the 'regulator-boot-on' property is set, but check for this property explicitly instead of relying on the "boot_on" member of the uclass platdata. Signed-off-by: Mark Kettenis <[email protected]> Tested-by: Patrice Chotard <[email protected]>
2020-05-18common: Drop linux/delay.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <[email protected]>
2020-05-18common: Drop log.h from common headerSimon Glass
Move this header out of the common header. Signed-off-by: Simon Glass <[email protected]>
2020-02-10regulator: fix: Move code to enable gpio regulator to pre_probe from ↵Lukasz Majewski
ofdata_to_platdata The commit e8e9715df2d4 ("regulator: fixed: Modify enable-active-high behavior") fixed the regulator driver behavior when 'enable-active-high' is defined. Unfortunately, this patch used dm_regulator_platdata()'s "boot_on" member to set GPIOD_IS_OUT_ACTIVE flag and enable the regulator. The issue here is that regulator_common_ofdata_to_platdata() is called _before_ regulator_pre_probe() function in which the 'regulator-boot-on' property is asserted. As a result the GPIOD_IS_OUT_ACTIVE flag is not set and gpio_request_by_name() called in the former function is not enabling the regulator. This is problematic for e.g. i.MX ethernet driver, which then tries to perform initialization without power (and fails). The solution here is to explicitly enable regulator in regulator_pre_probe() callback only when 'regulator-boot-on' property is present in device tree. The GPIOD_IS_OUT_ACTIVE flag is not set at all, but relevant gpio is requested. Signed-off-by: Lukasz Majewski <[email protected]> Reviewed-by: Patrice Chotard <[email protected]> Tested-by: Patrice Chotard <[email protected]>
2020-01-07power: regulator: support off-on-delay-usPeng Fan
off-on-delay-us has been supported by Linux, so let's use it. Signed-off-by: Peng Fan <[email protected]>
2019-10-11regulator: fixed: Modify enable-active-high behaviorPatrice Chotard
Regulator should not be enabled at probe time if regulator-boot-on property is not in the dt node. "enable-active-high" property is only used to indicate the GPIO polarity. See kernel documentation : - Documentation/devicetree/bindings/regulator/fixed-regulator.yaml - Documentation/devicetree/bindings/regulator/gpio-regulator.yaml Signed-off-by: Christophe Kerello <[email protected]> Signed-off-by: Patrice Chotard <[email protected]>
2019-07-18regulator: Factor out common enable codeSven Schwermer
In preparation of being able to enable/disable GPIO regulators, the code that will be shared among the two kinds to regulators is factored out into its own source files. Signed-off-by: Sven Schwermer <[email protected]> Reviewed-by: Lukasz Majewski <[email protected]>