aboutsummaryrefslogtreecommitdiff
path: root/drivers/power
AgeCommit message (Collapse)AuthorFilesLines
2023-12-19drivers: gpio: implement PALMAS GPIO cellSvyatoslav Ryhel1-1/+9
Add gpio driver for TI Palmas series PMIC. This has 8 gpio which can work as input/output. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-12-19drivers: gpio: implement MAX77663 GPIO cellSvyatoslav Ryhel1-0/+9
MAXIM Semiconductor's PMIC, MAX77663 has 8 GPIO pins and 3 GPIO-like pins. It also supports interrupts from these pins. Add GPIO driver for these pins to control via GPIO APIs. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-12-06sunxi: H616: remove default AXP305 selectionAndre Przywara1-1/+0
The original H616 devices released about three years ago were typically paired with an X-Powers AXP305 PMIC. Newer devices uses the smaller AXP313, and there seem to be far more systems with this PMIC around now. Remove the default AXP305 selection for the H616 SoC from the Kconfig, and move the PMIC selection into the board defconfig files instead. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-11-12power: regulator: add AXP313 supportAndre Przywara2-0/+18
The X-Powers AXP313a is a small PMIC with just three buck converters and three LDOs, one of which is actually fixed (so not modelled here). Add the compatible string and the respective regulator ranges to allow drivers to adjust voltages. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-11-12power: pmic: sunxi: add AXP313 SPL driverAndre Przywara3-2/+150
On boards using the AXP313 PMIC, the DRAM rail is often not setup correctly at reset time, so we have to program the PMIC very early in the SPL, before running the DRAM initialisation. Add a simple AXP313 PMIC driver that knows about DCDC2(CPU) and DCDC3(DRAM), so that we can bump up the voltage before the DRAM init. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2023-11-12sunxi: board: simplify early PMIC setup conditionsAndre Przywara1-1/+1
So far we have a convoluted #ifdef mesh that guards the early AXP PMIC setup in board.c. That combination of &&, || and negations is very hard to read, maintain and especially to extend. Fortunately we have those same conditions already modelled in the Kconfig file, so they are actually redundant. On top of that the real reason we have those preprocessor guards in the first place is about the symbols that are *conditionally* defined: without #ifdefs the build would break because of them being undefined for many boards. To simplify this, just change the guards to actually look at the symbols needed, so CONFIG_AXP_xxx_VOLT instead of CONFIG_AXPyyy_POWER. This drastically improves the readability of this code, and makes adding PMIC support a pure Kconfig matter. Doing this revealed one bug in Kconfig: there is no axp_set_dcdc4() for the AXP818, even though CONFIG_AXP_DCDC4_VOLT includes that PMIC. Since the AXP818 wasn't included when calling axp_set_dcdc4() in board.c, this wasn't an issue, but becomes one now, so also remove the AXP818 from the DCDC4 Kconfig symbol. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-11-10tree-wide: Replace http:// link with https:// link for ti.comNishanth Menon4-4/+4
Replace instances of http://www.ti.com with https://www.ti.com Signed-off-by: Nishanth Menon <nm@ti.com>
2023-11-03sysreset: implement PALMAS sysreset functionsSvyatoslav Ryhel1-2/+31
PALMAS PMIC family has embedded poweroff function used by some device to initiane device power off. Implement it as sysreset driver. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03sysreset: implement TPS65910 sysreset functionsSvyatoslav Ryhel1-1/+11
TPS65910/TPS65911 PMICs have embedded power control functions used by some device to initiane device power off. Implement it as sysreset driver. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03sysreset: implement TPS80031 sysreset functionsSvyatoslav Ryhel1-1/+10
TPS80031/TPS80032 PMICs have embedded power control functions used by some device to initiane device power off. Implement it as sysreset driver. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03sysreset: implement MAX77663 sysreset functionsSvyatoslav Ryhel1-1/+10
MAX77663 PMIC has embedded poweroff function used by some device to initiane device power off. Implement it as sysreset driver. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03power: regulator: tps65911: add regulator supportSvyatoslav Ryhel3-0/+407
The driver provides regulator set/get voltage enable/disable functions for TI TPS5911 PMIC. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-03power: pmic: tps65910: add TPS65911 PMIC supportSvyatoslav Ryhel1-3/+12
Add support to bind the regulators/child nodes with the pmic. Also adds the pmic i2c based read/write functions to access pmic registers. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-03power: regulator: tps80031: add regulator supportSvyatoslav Ryhel3-0/+356
The driver provides regulator set/get voltage enable/disable functions for TI TPS80031/TPS80032 PMICs. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-03power: pmic: add the base TPS80031 PMIC supportSvyatoslav Ryhel3-0/+94
Add support to bind the regulators/child nodes with the pmic. Also adds the pmic i2c based read/write functions to access pmic registers. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-03power: regulator: max77663: add regulator supportSvyatoslav Ryhel3-0/+385
The driver provides regulator set/get voltage enable/disable functions for MAXIM MAX77663 PMICs. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-11-03power: pmic: add the base MAX77663 PMIC supportSvyatoslav Ryhel3-0/+91
Add support to bind the regulators/child nodes with the pmic. Also adds the pmic i2c based read/write functions to access pmic registers. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-11-03power: regulator: palmas: fix ldoln and ldousb detectionSvyatoslav Ryhel1-10/+14
dev->driver_data will carry the tail of ldo if there is a number and if there is no number it will be an error code, anyway it will not be zero. This results in a wrong ldo regulator detection. To avoid this check for non-numerical ldo first and then manipulate dev->driver_data. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03power: pmic: palmas: support TI TPS65913 PMICSvyatoslav Ryhel1-0/+1
Existing PALMAS PMIC driver is fully compatible with TI TPS65913 PMIC found in many Tegra 4 devices, like Tegra Note 7 and ASUS TF701T. TPS65913 shares same structure of regulators like TPS659038 so data can be reused. Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # NVIDIA Tegratab Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-10-24power: domain: add SCMI driverAKASHI Takahiro3-0/+200
Add power domain driver based on SCMI power domain management protocol. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-10-13scmi: refactor the code to hide a channel from devicesAKASHI Takahiro1-20/+6
The commit 85dc58289238 ("firmware: scmi: prepare uclass to pass channel reference") added an explicit parameter, channel, but it seems to make the code complex. Hiding this parameter will allow for adding a generic (protocol-agnostic) helper function, i.e. for PROTOCOL_VERSION, in a later patch. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
2023-10-07power: pmic: rk8xx: Fix power-on source check in SPLJonas Karlman1-7/+13
The commit 30975fb73d51 ("rockchip: Add option to prevent booting on power plug-in") introduce an option to prevent booting a device when the device was powered on due to power plug-in instead of pressing a power button. This feature works by checking the power-on source during PMIC probe and powers off the device if power-on source was power plug-in. This check currently runs very late at PMIC probe in U-Boot proper. Fix so that the power-on source check can work at probe time in SPL. Also enable probe after bind and remove the PMIC banner in SPL. With this we can use ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON and SPL_PMIC_RK8XX to power off the device very quickly after TPL instead of after TF-A and U-Boot proper has been loaded and run. DDR V1.18 f366f69a7d typ 23/07/17-15:48:58 ln LP4/4x derate en, other dram:1x trefi ddrconfig:7 LPDDR4X, 324MHz BW=32 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=16 Size=8192MB change to: 324MHz clk skew:0x64 change to: 528MHz clk skew:0x58 change to: 780MHz clk skew:0x58 change to: 1056MHz(final freq) clk skew:0x40 out Power Off due to plug-in event Fixes: 30975fb73d51 ("rockchip: Add option to prevent booting on power plug-in") Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2023-10-07power: pmic: rk8xx: Use sysreset implementation of the poweroff commandJonas Karlman1-0/+1
Select SYSRESET_CMD_POWEROFF to use the sysreset implementation of the poweroff command when PMIC_RK8XX is enabled. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-07regulator: rk8xx: Return correct voltage for switchout convertersshengfei Xu1-0/+19
The voltage value for switchout converters is always reported as 0 uV. When the switch is enabled, it's voltage is same as input supply. Fix this by implementing get_value for switchout converters. Fixes: ee30068fa574 ("power: pmic: rk809: support rk809 pmic") Signed-off-by: shengfei Xu <xsf@rock-chips.com> [jonas@kwiboo.se: fix checkpatch error, update commit message] Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-07regulator: rk8xx: Return correct voltage for buck convertersJoseph Chen1-36/+40
Information from the first range group is always used to calculate the voltage returned for buck converters. This may result in wrong voltage reported back to the regulator_get_value caller. Traverse all the possible BUCK ranges to fix this issue. Fixes: addd062beacc ("power: pmic: rk816: support rk816 pmic") Fixes: b62280745e55 ("power: pmic: rk805: support rk805 pmic") Fixes: b4a35574b38d ("power: pmic: rk817: support rk817 pmic") Fixes: ee30068fa574 ("power: pmic: rk809: support rk809 pmic") Signed-off-by: Joseph Chen <chenjh@rock-chips.com> [jonas@kwiboo.se: fix checkpatch error, simplify buck get_value, update commit message] Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-10-07power: regulator: Only run autoset once for each regulatorJonas Karlman1-4/+14
With the commit 4fcba5d556b4 ("regulator: implement basic reference counter"), keeping regulator enablement in balance become more important. Calling regulator_autoset multiple times on a fixed regulator increase the enable count for each call, resulting in an unbalanced enable count. Introduce a AUTOSET_DONE flag and use it to mark that autoset has run for the regulator. Return -EALREADY on any subsequent call to autoset. This fixes so that the enable count is only ever increased by one per regulator for autoset. Fixes: 4fcba5d556b4 ("regulator: implement basic reference counter") Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-09-24common: Drop linux/printk.h from common headerSimon Glass33-0/+36
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 <sjg@chromium.org>
2023-07-31power: regulator: rk8xx: Add 500us delay after LDO regulator is enabledJonas Karlman1-0/+4
A quick power cycle of a LDO regulator during dw-mmc signal voltage change has shown that SD-card does not always get recognized. Linux driver use an enable_time of 400us for LDO regulators. Apply a 500us delay when a LDO regulator is enabled to fix possible issues. Fixes: 94afc1cb466a ("power: regulator: rk8xx: update the driver for rk808 and rk818") Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: elaine.zhang<elaine.zhang@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-07-28regulator: fixed: Add support for gpios propJonas Karlman1-1/+3
The commit 12df2c182ccb ("regulator: dt-bindings: fixed-regulator: allow gpios property") in linux v6.3-rc1 added support for use of either a gpios or gpio prop with a fixed-regulator. This adds support for the new gpios prop to the fixed-regulator driver. gpios prop is used by vcc3v3-pcie-regulator on Radxa ROCK 3 Model A. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-07-13imx: mach: correct SCU API usagePeng Fan1-5/+4
The return value is int type, not sc_err_t(u8), correct the usage. Signed-off-by: Peng Fan <peng.fan@nxp.com>
2023-07-11power: imx8m-power-domain: Add delay to align with kernel driverFabio Estevam1-0/+3
In the imx8m power domain kernel driver, there is an extra udelay(5) prior to requesting the domain to power up: https://github.com/torvalds/linux/blob/v6.3/drivers/soc/imx/gpcv2.c#L347-L375 Haven't observed any issues due to the lack of this delay in U-Boot yet, but better to align it with the kernel driver implementation. Signed-off-by: Fabio Estevam <festevam@denx.de> Reviewed-by: Marek Vasut <marex@denx.de>
2023-07-04regulator: handle different error codes in regulator_set_enable_if_allowedEugen Hristev1-0/+6
The regulator core can return different codes which are not considered a real error for this function. Return success in such cases. Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-07-04regulator: rename dev_pdata to platEugen Hristev5-67/+66
Simplify the subsystem by renaming `dev_pdata` to just `plat`. No functional change, just trivial renaming. Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-07-04regulator: implement basic reference counterEugen Hristev2-0/+43
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 <eugen.hristev@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-06-28drivers: meson: introduce secure power controller driverAlexey Romanov3-0/+168
This patch adds Power controller driver support for Amlogic A1 family using secure monitor calls. The power domains register only can access in secure world. Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20230531093156.29240-4-avromanov@sberdevices.ru Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-06-16pmic: stpmic1: support new prefix node name for regulatorPatrick Delaunay1-0/+2
The '_' character is discouraged in the node name, this patch adds the new prefix of regulator subnode, with the '-' character, in STM32MP1 driver to support the new naming rule in Linux kernel device trees. It is a preliminary patch before Linux device tree synchronization for STMicroelectronics boards. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-06-12power: zynqmp: Mask node already configured errorStefan Herbrechtsmeier1-3/+8
Do not return an error (ENODEV) from the request function if the node is already configured. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Link: https://lore.kernel.org/r/20230523124215.30915-3-stefan.herbrechtsmeier-oss@weidmueller.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-05-21imx: move imx8 sci header file to include/firmware/imxPeng Fan2-2/+2
Move imx8 sci header file to include/firmware/imx, then we could use build macro to reuse some i.MX8 drivers for i.MX9, such as drivers/cpu/imx8_cpu.c. Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Stefano Babic <sbabic@denx.de>
2023-04-28power: regulator: Add a driver for the AXP USB power supplySamuel Holland3-0/+57
This driver reports the presence/absence of voltage on the PMIC's USB VBUS pin. This information is used by the USB PHY driver. The corresponding Linux driver uses the power supply class, which does not exist in U-Boot. UCLASS_REGULATOR seems to be the closest match. Signed-off-by: Samuel Holland <samuel@sholland.org> Acked-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-03-30power: pmic: Add NXP PCA9451A PMIC supportYe Li2-1/+11
PCA9451A uses similar BUCKs and LDO regulators as PCA9450B/C but has LDO2 and LDO3 removed. So reuse pca9450 PMIC and regulator driver and add new type for PCA9451A. Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Marek Vasut <marex@denx.de>
2023-02-07power: Drop unused muic_max8997 driverSimon Glass2-75/+0
This is not used. Drop the driver and Kconfig option. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07power: Drop unused muic_max77693 driver and mfd codeSimon Glass3-84/+0
This driver is not used and has lain unconverted since: fc47cf9d054 arm: exynos: i2c: Convert exynos boards to use DM_I2C Drop it and the entire mfd directory, since there is nothing left. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07power: Drop unused fg_max17042 driver and fuel gauge codeSimon Glass3-294/+0
This driver is not used. Drop it and the entire fuel_gauge directory, since there is nothing left. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07power: Drop unused bat_trats driver and battery codeSimon Glass4-164/+0
This driver and bat_trats2 are not used. Drop them and the entire battery directory, since there is nothing left. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07freescale: Drop unused ftpmu010 driverSimon Glass2-88/+0
Drop this unused code. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07power: Drop pmic_max77693.cSimon Glass2-97/+0
Drop this driver and the associated CONFIG option, as it is not used. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07power: Drop fg_max77693Simon Glass2-138/+0
This is not used in U-Boot. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-30pmic: pca9450: Make warm reset on WDOG_B assertionMarek Vasut1-1/+10
The default configuration of the PMIC behavior makes the PMIC power cycle most regulators on WDOG_B assertion. This power cycling causes the memory contents of OCRAM to be lost. Some systems neeeds some memory that survives reset and reboot, therefore this patch is created. The implementation is taken almost verbatim from Linux commit 2364a64d0673f ("regulator: pca9450: Make warm reset on WDOG_B assertion") Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Fabio Estevam <festevam@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-01-23power: pmic: axp: Bind regulators from the DTSamuel Holland1-0/+18
Now that a regulator driver exists for this PMIC, hook it up to the device tree "regulators" subnodes. Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-01-23power: regulator: Add a driver for AXP PMIC regulatorsSamuel Holland3-0/+327
This driver handles most voltage regulators found in X-Powers AXP PMICs. It is based on, and intended to replace, the regulator driver in TF-A. AXP PMIC regulators can be divided into 6 categories: - Switches without voltage control => fully supported. - Single linear range => fully supported. - Two linear ranges, "step" and "2 * step" => fully supported. - Two linear ranges, "step" and "5 * step" => only the first range is supported. No boards are known to use the second range. - Non-linear voltage values => fully supported. - LDOs shared with GPIO pins => not supported. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>