1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-17 12:00:35 +00:00

5249 Commits

Author SHA1 Message Date
Haotian Zhang
636f4618b1
regulator: fixed: fix GPIO descriptor leak on register failure
In the commit referenced by the Fixes tag,
devm_gpiod_get_optional() was replaced by manual
GPIO management, relying on the regulator core to release the
GPIO descriptor. However, this approach does not account for the
error path: when regulator registration fails, the core never
takes over the GPIO, resulting in a resource leak.

Add gpiod_put() before returning on regulator registration failure.

Fixes: 5e6f3ae5c13b ("regulator: fixed: Let core handle GPIO descriptor")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251028172828.625-1-vulab@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-11-05 11:56:16 +00:00
Maud Spierings
47a0925ee4
regulator: bd718x7: Fix voltages scaled by resistor divider
The .min_sel and .max_sel fields remained uninitialized in the new
linear_range, causing an error further down the line. Copy the old
values of these fields to the new one as they represent the range of
register values, which does not change.

Fixes: d2ad981151b3a ("regulator: bd718x7: Support external connection to scale voltages")
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/20251030-mini_iv-v3-2-ef56c4d9f219@gocontroll.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-10-30 11:30:23 +00:00
Linus Torvalds
b4918003cf MFD for v6.18
This round of updates contains a fair amount of new device support, a couple of fixes and
 some refactoring.  The most notable additions include new drivers for Loongson's Security
 Engine, RNG and TPM, new drivers for TI's TPS6594 Power Button and BQ257xx Charger ICs.
 
 The rest of the set provides a return value check fix and a refactoring to use a more modern
 GPIO API for the VEXPRESS sysreg driver, the removal of a deprecated IRQ ACK function from the
 MC13xxx RTC driver and a new DT binding for the aforementioned TI BQ257xx charger.
 
 New Support & Features
 - Add a suite of drivers for the Loongson Security Engine, including the core controller, a
   Random Number Generator (RNG) and Trusted Platform Module (TPM) support.
 - Introduce support for the TI TPS6594 PMIC's power button, including the input driver, MFD
   cell registration, and a system power-off handler.
 - Add comprehensive support for the TI BQ257xx series of charger ICs, including the core MFD
   driver and a power supply driver for the charger functionality.
 
 Improvements & Fixes
 - Check the return value of devm_gpiochip_add_data() in the VEXPRESS sysreg driver to prevent
   potential silent failures.
 
 Cleanups & Refactoring
 - Add a MAINTAINERS entry for the new Loongson Security Engine drivers.
 - Convert the VEXPRESS sysreg driver to use the modern generic GPIO chip API.
 
 Removals
 - Remove the deprecated and unused mc13xxx_irq_ack() function from the MC13xxx RTC, input and
   touchscreen drivers.
 
 Device Tree Bindings Updates
 - Add device tree bindings for the TI BQ25703A charger.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmjdMogACgkQUa+KL4f8
 d2FYEA/+J3U3bzH0JdjGVscQD1vLq+PjT0MsYoNLHSNG55H0Q9FhEv2SVmnRG8LR
 DPvYXqpLHcHTGpPdCK7RX6FhSmXMFqXiWFbn9/lQE/+MX41U0B9E7rbRVCH8m+Vw
 TAOvR86DEcTZFq3BEPDfjc4Q0ZPHKpyo/HOW739frmwC/a66K6G70vKmO+LJlqMk
 asBAZUfRs14iaZte8LDKfcYcvC4NrJqtLD9lxPiuGxapMCGvJ+uReo+44A0F+wb8
 UNq+cwdFK2rqPAur5ehe8C6s9IsANF4+OmAbbmqxfkbroiSYR7I2SeUhgxU/b8Om
 9v+NqfC7Xsb8lcTJ/c0qCW8NfBtOlqer1lEHGTU91fTCAhACb4j7OuJtnTusp9Nk
 W9Z9QcfOv/Mt7I/SUw9n8SQdHgPt9tQa6iqcGrYGp3enm8BISeb2jTTgrkDcCkKb
 UTH8xVmxFgda08RCmPDPvrK0ebQ6gQzdq4g5vN3or1tFIKQHplorbvaAQtCBK02h
 8ef33KrQ4HLV/NjijYrnFhrhj0WYBwmRb8vr43t4wvUdvlOSuK+VswKGIMhQabT3
 uU+YjtCt19siOIx47XZVpj1gKTr24OoK2B+U8zy5oHj7abrRNkseZ8NMeu0vGzCn
 p+ThEq+dxGD0mskaufdbJhejjumgCFaYNElWNHJQUGhMxHM5vQE=
 =h21C
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "This round of updates contains a fair amount of new device support, a
  couple of fixes and some refactoring. The most notable additions
  include new drivers for Loongson's Security Engine, RNG and TPM, new
  drivers for TI's TPS6594 Power Button and BQ257xx Charger ICs.

  The rest of the set provides a return value check fix and a
  refactoring to use a more modern GPIO API for the VEXPRESS sysreg
  driver, the removal of a deprecated IRQ ACK function from the MC13xxx
  RTC driver and a new DT binding for the aforementioned TI BQ257xx
  charger.

  New Support & Features:
   - Add a suite of drivers for the Loongson Security Engine, including
     the core controller, a Random Number Generator (RNG) and Trusted
     Platform Module (TPM) support.
   - Introduce support for the TI TPS6594 PMIC's power button, including
     the input driver, MFD cell registration, and a system power-off
     handler.
   - Add comprehensive support for the TI BQ257xx series of charger ICs,
     including the core MFD driver and a power supply driver for the
     charger functionality.

  Improvements & Fixes:
   - Check the return value of devm_gpiochip_add_data() in the VEXPRESS
     sysreg driver to prevent potential silent failures.

  Cleanups & Refactoring:
   - Add a MAINTAINERS entry for the new Loongson Security Engine
     drivers.
   - Convert the VEXPRESS sysreg driver to use the modern generic GPIO
     chip API.

  Removals:
   - Remove the deprecated and unused mc13xxx_irq_ack() function from
     the MC13xxx RTC, input and touchscreen drivers.

  Device Tree Bindings Updates:
   - Add device tree bindings for the TI BQ25703A charger"

* tag 'mfd-next-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (69 commits)
  mfd: simple-mfd-i2c: Add compatible string for LX2160ARDB
  mfd: simple-mfd-i2c: Keep compatible strings in alphabetical order
  dt-bindings: mfd: twl: Add missing sub-nodes for TWL4030 & TWL603x
  dt-bindings: watchdog: Add SMARC-sAM67 support
  dt-bindings: mfd: tps6594: Allow gpio-line-names
  mfd: intel-lpss: Add Intel Wildcat Lake LPSS PCI IDs
  mfd: 88pm886: Add GPADC cell
  mfd: vexpress-sysreg: Use more common syntax for compound literals
  mfd: rz-mtu3: Fix MTU5 NFCR register offset
  mfd: max77705: Setup the core driver as an interrupt controller
  mfd: cs42l43: Remove IRQ masking in suspend
  mfd: cs42l43: Move IRQ enable/disable to encompass force suspend
  mfd: ls2kbmc: Add Loongson-2K BMC reset function support
  mfd: ls2kbmc: Introduce Loongson-2K BMC core driver
  mfd: bd71828, bd71815: Prepare for power-supply support
  dt-bindings: mfd: aspeed: Add AST2700 SCU compatibles
  dt-bindings: mfd: Convert aspeed,ast2400-p2a-ctrl to DT schema
  dt-bindings: mfd: fsl,mc13xxx: Add buttons node
  dt-bindings: mfd: fsl,mc13xxx: Convert txt to DT schema
  mfd: macsmc: Add "apple,t8103-smc" compatible
  ...
2025-10-01 12:04:12 -07:00
Igor Belwon
abe962346e
regulator: Fix MAX77838 selection
The current entry for the MAX77838 regulator is unselectable (as it
depended on a non-user-selectable config - REGMAP_I2C). Fix this by
making it select the config, and not depending on it.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
Link: https://patch.msgid.link/20250917-maxreg-kconfig-fix-v1-1-1369f88d6272@mentallysanemainliners.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-17 18:46:21 +01:00
Alex Elder
8b84d712ad
regulator: spacemit: support SpacemiT P1 regulators
Add support for the regulators found in the SpacemiT P1 PMIC.  This
PMIC provides 6 buck converters and 12 LDO regulators.

The PMIC is implemented as a multi-function device.  These regulators
are probed based on this driver being named in a MFD cell in the simple
MFD I2C driver.

Signed-off-by: Alex Elder <elder@riscstar.com>
Link: https://patch.msgid.link/20250825172057.163883-4-elder@riscstar.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-16 14:34:44 +01:00
Mark Brown
41b5c85ba9
regulator: max77838: add max77838 regulator driver
Merge series from Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>:

This patchset adds support for the max77838 PMIC. It's used on the Galaxy
S7 lineup of phones, and provides regulators for the display.
2025-09-16 13:52:09 +01:00
Ivaylo Ivanov
6a1f303cba
regulator: max77838: add max77838 regulator driver
The max77838 PMIC contains a BUCK regulator and 4 LDOs. It's primarily
used in the Samsung Galaxy S7 lineup and is accessed over I2C.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
Link: https://patch.msgid.link/20250914130230.2622030-3-ivo.ivanov.ivanov1@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-15 19:27:50 +01:00
Chris Morgan
981dd162b6 regulator: bq257xx: Add bq257xx boost regulator driver
Add support for the boost regulator found in the Texas Instruments
BQ25703. The boost regulator is capable of outputting between 4.48
and 20.8 volts and between 0 and 6.35 amps.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250904160530.66178-5-macroalpha82@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-11 15:55:41 +01:00
Andreas Kemnade
c05d0b32ee
regulator: sy7636a: fix lifecycle of power good gpio
Attach the power good gpio to the regulator device devres instead of the
parent device to fix problems if probe is run multiple times
(rmmod/insmod or some deferral).

Fixes: 8c485bedfb785 ("regulator: sy7636a: Initial commit")
Signed-off-by: Andreas Kemnade <akemnade@kernel.org>
Reviewed-by: Alistair Francis <alistair@alistair23.me>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Message-ID: <20250906-sy7636-rsrc-v1-2-e2886a9763a7@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-08 16:33:24 +01:00
Mark Brown
92b9c2b7a8
regulator: pf530x: NXP PF530x regulator driver
Merge series from Woodrow Douglass <wdouglass@carnegierobotics.com>:

I wrote this driver to read settings and state from the nxp pf530x
regulator. Please consider it for inclusion, any criticism is welcome.
2025-09-05 17:09:18 +01:00
Woodrow Douglass
b497e1a1a2
regulator: pf530x: Add a driver for the NXP PF5300 Regulator
This driver allows reading some regulator settings and adjusting
output voltage. It is based on information from the datasheet
at https://www.nxp.com/docs/en/data-sheet/PF5300.pdf

Signed-off-by: Woodrow Douglass <wdouglass@carnegierobotics.com>
Message-ID: <20250902-pf530x-v7-2-10eb2542f944@carnegierobotics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-05 14:20:37 +01:00
Qianfeng Rong
9d35d068fb
regulator: scmi: Use int type to store negative error codes
Change the 'ret' variable from u32 to int to store negative error codes or
zero returned by of_property_read_u32().

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly as pants. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")
Link: https://patch.msgid.link/20250829101411.625214-1-rongqianfeng@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-09-01 14:04:18 +01:00
Liao Yuanhong
899fb38dd7
regulator: core: Remove redundant ternary operators
For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Message-ID: <20250828122737.43488-1-liaoyuanhong@vivo.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-28 16:02:51 +02:00
Kamal Wadhwa
ef3e9c91ed
regulator: pm8008: fix probe failure due to negative voltage selector
In the current design, the `pm8008_regulator_get_voltage_sel()` callback
can return a negative value if the raw voltage value is read as 0 uV from
the PMIC HW register. This can cause the probe to fail when the
`machine_constraints_voltage()` check is called during the regulator
registration flow.

Fix this by using the helper `regulator_map_voltage_linear_range()` to
convert the raw value to a voltage selector inside the mentioned get
voltage selector function. This ensures that the value returned is always
within the defined range.

Signed-off-by: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>
Message-ID: <20250823-pm8008-negitive-selector-v1-1-52b026a4b5e8@quicinc.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-24 22:41:04 +01:00
Dan Carpenter
f7f804633c
regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info()
The "priv->cdata" pointer isn't an error pointer; this should be a NULL
check instead.  Otherwise it leads to a NULL pointer dereference in the
caller, rt5133_probe().

Fixes: 714165e1c4b0 ("regulator: rt5133: Add RT5133 PMIC regulator Support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aKMc1oK-7yY4cD3K@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-19 16:52:47 +01:00
Dan Carpenter
11cd7a5c21
regulator: tps65219: regulator: tps65219: Fix error codes in probe()
There is a copy and paste error and we accidentally use "PTR_ERR(rdev)"
instead of "error".  The "rdev" pointer is valid at this point.

Also there is no need to print the error code in the error message
because dev_err_probe() already prints that.  So clean up the error
message a bit.

Fixes: 38c9f98db20a ("regulator: tps65219: Add support for TPS65215 Regulator IRQs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aKRGmVdbvT1HBvm8@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-19 16:51:03 +01:00
Qianfeng Rong
550bc517e5
regulator: bd718x7: Use kcalloc() instead of kzalloc()
Replace calls of 'devm_kzalloc(dev, count * sizeof([type]), flags)'
with 'devm_kcalloc(dev, count, sizeof([type]), flags)' in
setup_feedback_loop() for safer memory allocation with built-in
overflow protection.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/20250817142327.174531-1-rongqianfeng@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-18 13:12:17 +01:00
Peng Fan
447be50598
regulator: pca9450: Use devm_register_sys_off_handler
With module test, there is error dump:
------------[ cut here ]------------
  notifier callback pca9450_i2c_restart_handler already registered
  WARNING: kernel/notifier.c:23 at notifier_chain_register+0x5c/0x88,
  CPU#0: kworker/u16:3/50
  Call trace:
  notifier_chain_register+0x5c/0x88 (P)
  atomic_notifier_chain_register+0x30/0x58
  register_restart_handler+0x1c/0x28
  pca9450_i2c_probe+0x418/0x538
  i2c_device_probe+0x220/0x3d0
  really_probe+0x114/0x410
  __driver_probe_device+0xa0/0x150
  driver_probe_device+0x40/0x114
  __device_attach_driver+0xd4/0x12c

So use devm_register_sys_off_handler to let kernel handle the resource
free to avoid kernel dump.

Fixes: 6157e62b07d9 ("regulator: pca9450: Add restart handler")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20250815-pca9450-v1-1-7748e362dc97@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-18 13:09:51 +01:00
Colin Ian King
6d068f1ae2
regulator: rt5133: Fix spelling mistake "regualtor" -> "regulator"
There is a spelling mistake in a dev_err message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://patch.msgid.link/20250814073326.17644-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-14 13:07:21 +01:00
Wolfram Sang
37533933bf
regulator: remove unneeded 'fast_io' parameter in regmap_config
When using MMIO with regmap, fast_io is implied. No need to set it
again.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://patch.msgid.link/20250813161517.4746-16-wsa+renesas@sang-engineering.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-13 19:06:29 +01:00
Jeff Chang
714165e1c4
regulator: rt5133: Add RT5133 PMIC regulator Support
RT5133 is a highly-integrated chip. It includes 8 LDOs and 3 GPOs that can
be used to drive output high/low purpose. The dependency of the GPO block is
internally LDO1 Voltage.

Signed-off-by: Jeff Chang <jeff_chang@richtek.com>
Link: https://patch.msgid.link/20250813020910.2977555-2-jeff_chang@richtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-13 11:10:59 +01:00
Mark Brown
eccd3d9753
regulator: add new PMIC PF0900 support
Merge series from Joy Zou <joy.zou@nxp.com>:

Add binding document and driver.

Signed-off-by: Joy Zou <joy.zou@nxp.com>
---
Changes in v3:

binding part
- change regulator node names into lowercase.
- add more description for nxp,i2c-crc-enable.
- remove the unnecessary nxp,dvs-run/standby-voltage property.
  These changes come from review comments:
  https://lore.kernel.org/imx/e9f38e38-7df7-4d19-b5c0-2f18aeebcc78@kernel.org/
- add regulator-state-mem property for example.

driver part
- convert to use maple tree register cache.
- change of_match_ptr() name to lowercase since dt-binding changed.
- add more nxp,i2c-crc-enable description for commit message.
- remove the of_parse_cb and dvs from pf0900_regulators since the
  unnecessary property nxp,dvs-run/standby-voltage removed.
- add set_suspend_enable/disable/voltage for the SW regulator_ops.
  the run/standby voltage can be adjusted via the API which regulator
  driver provides is recommended.
  These changes come from binding review comments:
  https://lore.kernel.org/imx/e9f38e38-7df7-4d19-b5c0-2f18aeebcc78@kernel.org/
- add bitfield.h header due to build issue.
- correct the sw4 id.
- add PF0900 prefix for short macro define in order to avoid duplication.
- merge the same mask define in order to simplify code.
- Link to v2: https://lore.kernel.org/r/20250721-b4-pf09-v2-v2-0-e2c568548032@nxp.com

Changes in v2:

binding part
- modify the binding file name to match compatible string.
- add one space for dt_binding_check warning.
- remove unnecessary quotes from "VAON".
- remove the unnecessary empty line.
- move unevaluatedProperties after the $ref.
- move additionalProperties after regulator type.
- remove unnecessary regulator description

driver part
- modify the copyright comment block to C++ style.
- add reg_read/write for regmap_bus.
- remove original pf0900_pmic_read/write.
- remove many regulator operations.
- use regmap_read replace pf0900_pmic_read.
- use regmap_update_bits and regmap_write_bits replace pf0900_pmic_write.
- move the code from pf0900.h to pf0900-regulator.c and delete the header file.
- remove unmask status interrupts and add unmask regulator interrupts.
- remove many interrupts check warning print from irq_handler.
- add notifier for regulator event.
- remove unused macro define.
- add PF0900 prefix for IRQ macro define in order to avoid duplication.
- use GENMASK() and BIT() to replace mask marco define
- remove redundant enum pf0900_chip_type.
- remove redundant print info and comments.
- add dvs property present check because this property is optional.
- remove ret == -EINVAL check from sw_set_dvs() function.
- Link to v1: https://lore.kernel.org/imx/20250617102025.3455544-1-joy.zou@nxp.com/

---
Joy Zou (2):
      dt-bindings: regulator: add PF0900 regulator yaml
      regulator: pf0900: Add PMIC PF0900 support

 .../devicetree/bindings/regulator/nxp,pf0900.yaml  | 163 ++++
 drivers/regulator/Kconfig                          |   8 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/pf0900-regulator.c               | 975 +++++++++++++++++++++
 4 files changed, 1147 insertions(+)
---
base-commit: 84b92a499e7eca54ba1df6f6c6e01766025943f1
change-id: 20250714-b4-pf09-v2-91cdee6d1272

Best regards,
--
Joy Zou <joy.zou@nxp.com>
2025-08-12 12:06:18 +01:00
Dzmitry Sankouski
bb24414023
regulator: add s2dos05 regulator support
S2DOS05 has 1 buck and 4 LDO regulators, used for powering
panel/touchscreen.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Link: https://patch.msgid.link/20250805-starqltechn_integration_upstream-v8-1-09d8a321fafe@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-11 14:08:53 +01:00
Liao Yuanhong
f6cc4140e1
regulator: tps6524x: Remove unnecessary memset
devm_kzalloc() has already been initialized to full 0 space, there is no
need to use memset() to initialize again.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Link: https://patch.msgid.link/20250807123949.495193-1-liaoyuanhong@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-11 14:08:52 +01:00
Chen Ni
c6871d56b5
regulator: tps6594-regulator: Remove unneeded semicolon
Remove unnecessary semicolons reported by Coccinelle/coccicheck and the
semantic patch at scripts/coccinelle/misc/semicolon.cocci.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://patch.msgid.link/20250729040044.1851988-1-nichen@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-11 14:08:51 +01:00
Joy Zou
162e23657e regulator: pf0900: Add PMIC PF0900 support
The PF0900 is a power management integrated circuit (PMIC) optimized
for high performance i.MX9x based applications. It features five high
efficiency buck converters, three linear and one vaon regulators. It
provides low quiescent current in Standby and low power off Modes.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202507221720.jxsGRfcE-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202506181134.0Hkvy7CK-lkp@intel.com/
Signed-off-by: Joy Zou <joy.zou@nxp.com>
Link: https://patch.msgid.link/20250731-b4-pf09-v2-v3-2-4c2659516582@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-08-10 21:09:45 +01:00
Linus Torvalds
c5bf33d778 regulator: Fix for v6.17
This fixes an issue with the newly added code for handling large voltage
 changes on regulators which require that individual voltage changes
 cover a limited range, the check for convergence was broken.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmiV71cACgkQJNaLcl1U
 h9BT/wf/RFUziTbJP13+I+Ce+BixwFOfTJ2+aE2xlCWAd8eyylxdOvZwRaxiiU8K
 2o8mfyVpGitROyEgsuXDqiel1hFTSVpuFzT8NhGe9tc5RC+UtF1nuygsMvPAuUlR
 cyrGF4aUSsEGr5R37lZh6dC/kJDHOxoQy+YEk9ngnnfWlddpHJsQMulWU3MIVAaG
 IZ3KVQeZeEpCNkgKr50IG/TQh9bX8Dct/EPSxKhR4EjaKXvEyKcrMnbQpb7h7dxN
 dUFpKk99EKpC6uI7jLIwUgIA4CCN8h2g0+B10zo4Kp2AQLltGs/H/gZJSCzKzEv8
 3UTeyBz8Uzr4srsKRBiP8woqA6hjoA==
 =xTjP
 -----END PGP SIGNATURE-----

Merge tag 'regulator-fix-v6.17-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fix from Mark Brown:
 "This fixes an issue with the newly added code for handling large
  voltage changes on regulators which require that individual voltage
  changes cover a limited range, the check for convergence was broken"

* tag 'regulator-fix-v6.17-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: core: correct convergence check in regulator_set_voltage()
2025-08-09 08:41:53 +03:00
Bartosz Golaszewski
d9d87d90cc treewide: rename GPIO set callbacks back to their original names
The conversion of all GPIO drivers to using the .set_rv() and
.set_multiple_rv() callbacks from struct gpio_chip (which - unlike their
predecessors - return an integer and allow the controller drivers to
indicate failures to users) is now complete and the legacy ones have
been removed. Rename the new callbacks back to their original names in
one sweeping change.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-08-07 10:07:06 +02:00
Linus Torvalds
07b4382043 power supply and reset changes for the 6.17 series
* power-supply core
   - battery-info: replace any DT specific bits with fwnode usage
   - replace any device-tree code with generic fwnode based handling
  * power-supply drivers
   - ug3105_battery: use battery-info API
   - qcom_battmgr: report capacity
   - qcom_battmgr: support LiPo battery reporting
   - add missing missing power-supply ref to a bunch of DT bindings
   - update drivers regarding pm_runtime_autosuspend() usage
   - misc. minor fixes and cleanups
  * reset drivers
   - misc. minor cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmiMECsACgkQ2O7X88g7
 +pq18BAAgwWUJyV1YrzODAEC+GAIScV7E9aWHiWBYaR6huI6sXssgM9sUyQvSDw8
 IawbPGVeqgK2g7JHdLqduMILGrmNh268b2l3aJJzN0erM2bcIs9RtB2bMzJgSChH
 eDPOLKlQJJqR/PMQowHE4UEmbIep+8ISLP9GuiIa0e46ckdPWtAKnxWdReC3Pefs
 h9eRnzZof6A3dfoIhpCe182+RXPbVll7eHk8kvSYZgVUHHMfN509JDC7VMv6dG5p
 XOUiS6h2mebqoaNKBF7swr0nmkv4zLpLWBc//rreP+v26C97Ks+tfNrZ/fKrRR7E
 L7M1peg7KPLFooM3dQrngbaO2/h4am2kPb92YreXuDHMEBJQuauhOgAmrPOCFmJi
 l/nN2IbY4J9ArdsVbwATriFMPyem/N60xiq6Tr0F7DS9GBcO5dqX8g9iHY68Qu/g
 9HZAhiqrmxpUQ5cDUG1eYWSoK6YvdoP5bM7wJz8W5kbnIx2ngsMBhWPPh2fTmtoE
 c3qU7gSZK3jKUYAzu4vbFyL/htKc6ZO8ej2VDwjBb2OjVx+leYeC7kasRPDy5MkO
 G8Zuq9DZ1QAPp9aYAFVmZbHH1bTMD0UeYNMnSW/KaJZ5WecbUlzUkgCJvnH3JcYm
 5JbKDFykvItcyiS7+c6fflrJuv510Hf3R3degaqqXby4v80bMnY=
 =Lfxr
 -----END PGP SIGNATURE-----

Merge tag 'for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:
 "Power-supply core:
   - battery-info: replace any DT specific bits with fwnode usage
   - replace any device-tree code with generic fwnode based handling

  Power-supply drivers:
   - ug3105_battery: use battery-info API
   - qcom_battmgr: report capacity
   - qcom_battmgr: support LiPo battery reporting
   - add missing missing power-supply ref to a bunch of DT bindings
   - update drivers regarding pm_runtime_autosuspend() usage
   - misc minor fixes and cleanups

  Reset drivers:
   - misc minor cleanups"

* tag 'for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (32 commits)
  power: supply: core: fix static checker warning
  power: supply: twl4030_charger: Remove redundant pm_runtime_mark_last_busy() calls
  power: supply: bq24190: Remove redundant pm_runtime_mark_last_busy() calls
  MAINTAINERS: rectify file entry in QUALCOMM SMB CHARGER DRIVER
  power: supply: max1720x correct capacity computation
  MAINTAINERS: add myself as smbx charger driver maintainer
  power: supply: pmi8998_charger: rename to qcom_smbx
  power: supply: qcom_pmi8998_charger: fix wakeirq
  power: supply: max14577: Handle NULL pdata when CONFIG_OF is not set
  power: return the correct error code
  power: reset: POWER_RESET_TORADEX_EC should depend on ARCH_MXC
  power: supply: cpcap-charger: Fix null check for power_supply_get_by_name
  power: supply: bq25980_charger: Constify reg_default array
  power: supply: bq256xx_charger: Constify reg_default array
  power: reset: at91-sama5d2_shdwc: Refactor wake-up source logging to use dev_info
  power: reset: qcom-pon: Rename variables to use generic naming
  power: supply: qcom_battmgr: Add lithium-polymer entry
  power: supply: qcom_battmgr: Report battery capacity
  power: supply: bq24190: Free battery_info
  power: supply: ug3105_battery: Switch to power_supply_batinfo_ocv2cap()
  ...
2025-07-31 21:39:01 -07:00
Romain Gantois
10dfd36f07 regulator: core: correct convergence check in regulator_set_voltage()
The logic in regulator_set_voltage() which checks for a non-convergence
condition on a stepped regulator is flawed.

regulator_set_voltage() checks if the error in target voltage has increased
or decreased, and returns -EWOULDBLOCK if the error has not decreased
enough. The correct non-convergence condition is:

new_delta - delta > -rdev->constraints->max_uV_step

or equivalently:

delta - new_delta < rdev->constraints->max_uV_step

But the currently used condition is:

new_delta - delta > rdev->constraints->max_uV_step

Which may cause an infinite loop if the voltage error doesn't converge.

Fix this by correcting the convergence condition.

Suggested-by: Jon Hunter <jonathanh@nvidia.com>
Fixes: d511206dc7443 ("regulator: core: repeat voltage setting request for stepped regulators")
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
Link: https://patch.msgid.link/20250729-b4-regulator-stepping-fix-v1-1-3f7b8c55d7d7@bootlin.com
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-29 14:56:39 +01:00
Colin Ian King
0bd042ae77
regulator: mt6370: Fix spelling mistake in mt6370_regualtor_register
The function name mt6370_regualtor_register contains a spelling mistake,
fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://patch.msgid.link/20250724114832.146718-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-24 18:04:38 +01:00
Colin Ian King
71d141edbf
regulator: Kconfig: Fix spelling mistake "regualtor" -> "regulator"
There is a spelling mistake in the REGULATOR_RT4803 config. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://patch.msgid.link/20250724113113.143009-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-24 12:39:05 +01:00
Romain Gantois
d511206dc7
regulator: core: repeat voltage setting request for stepped regulators
The regulator_set_voltage() function may exhibit unexpected behavior if the
target regulator has a maximum voltage step constraint. With such a
constraint, the regulator core may clamp the requested voltage to a lesser
value, to ensure that the voltage delta stays under the specified limit.

This means that the resulting regulator voltage depends on the current
voltage, as well as the requested range, which invalidates the assumption
that a repeated request for a specific voltage range will amount to a noop.

Considering the case of a regulator with a maximum voltage step constraint
of 1V:

initial voltage: 2.5V

consumer requests 4V
expected result: 3.5V
resulting voltage: 3.5V

consumer requests 4V again
expected result: 4V
actual result: 3.5V

Correct this by repeating attempts to balance the regulator voltage until
the result converges.

Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
Link: https://patch.msgid.link/20250718-regulator-stepping-v2-1-e28c9ac5d54a@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-18 16:17:09 +01:00
Jeff Chang
63be976da9
regulator: rt6160: Add rt6166 vout min_uV setting for compatible
1. remove unintentional GPL change
2. using switch case for Device ID probe check.

Signed-off-by: Jeff Chang <jeff_chang@richtek.com>
Link: https://patch.msgid.link/20250716021230.2660564-1-jeff_chang@richtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-16 11:15:26 +01:00
Jisheng Zhang
43728a6434
regulator: tps6286x-regulator: Fix a copy & paste error
The volatile_reg function is named as tps6287x_volatile_reg by mistake
when enabing the REGCACHE_MAPLE support.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://patch.msgid.link/20250714010456.4906-1-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-14 14:44:05 +01:00
Mark Brown
b88b7e2096
Add RPMh regulator support for PM7550 & PMR735B
Merge series from Luca Weiss <luca.weiss@fairphone.com>:

Document and add support for the regulators on PM7550 and PMR735B, which
can be paired with the Milos SoC.
2025-07-14 11:34:22 +01:00
Luca Weiss
3aa47d2ec8
regulator: qcom-rpmh: add support for pm7550 regulators
Add RPMH regulators exposed by Qualcomm Technologies, Inc. PM7550 PMIC.
It has 6 FTS525 (FT-SMPS) and 23 LDOs with 3 different types.
L1-L11 are LDO515 LV NMOS, L12-L13 are LDO515 MV PMOS, L14-L23 are
LDO512 MV PMOS.

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Link: https://patch.msgid.link/20250711-pm7550-pmr735b-rpmh-regs-v2-4-bca8cc15c199@fairphone.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-13 22:37:09 +01:00
Luca Weiss
2875843490
regulator: qcom-rpmh: add support for pmr735b regulators
Add RPMH regulators exposed by Qualcomm Technologies, Inc. PMR735B PMIC.
It has 12 LDOs with 2 different types, L4 & L10 are LDO512 LV PMOS
and the rest are LDO512 NMOS.

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Link: https://patch.msgid.link/20250711-pm7550-pmr735b-rpmh-regs-v2-3-bca8cc15c199@fairphone.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-13 22:37:08 +01:00
Michael Walle
b30d390812
regulator: tps6594-regulator: Add TI TPS652G1 PMIC regulators
The TI TPS652G1 is a stripped down version of the TPS65224 PMIC. It
doesn't feature the multiphase buck converter nor any voltage
monitoring. Due to the latter there are no interrupts serviced. In case
of the TPS652G1 any interrupt related setup is just skipped.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20250703113153.2447110-9-mwalle@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-10 12:10:04 +01:00
Michael Walle
e64ee27abf
regulator: tps6594-regulator: refactor variant descriptions
Instead of using conditionals or tri state operators throughout the
.probe() provide a description per variant. This will make it much
easier to add new variants later.

While at it, make the variable naming more consistent.

This patch is only compile-time tested.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20250703113153.2447110-8-mwalle@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-10 12:10:03 +01:00
Michael Walle
180a135eaf
regulator: tps6594-regulator: remove hardcoded buck config
Commit 00c826525fba ("regulator: tps6594-regulator: Add TI TPS65224 PMIC
regulators") added support for the TPS65224 and made the description of
the multi-phase buck converter variable depending on the variant of the
PMIC. But this was just done for MUTLI_BUCK12 and MULTI_BUCK12_34
configs probably because this variant only supports a multi-phase
configuration on buck 1 and 2. Remove the hardcoded value for the
remaining two configs, too as future PMIC variants might also support
these.

This is a preparation patch to refactor the regulator description and
is compile-time only tested.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20250703113153.2447110-7-mwalle@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-10 12:10:02 +01:00
Michael Walle
16d1a9bf36
regulator: tps6594-regulator: remove interrupt_count
In .probe() interrupt_count and nr_types is essentially the same. It
contains the number of different interrupt per LDO or buck converter.
Drop one. This is a preparation patch to further simplify the handling
of different variants of this PMIC.

This patch is only compile-time tested.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20250703113153.2447110-6-mwalle@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-10 12:10:01 +01:00
Jisheng Zhang
5054740e00
regulator: sy8827n: make enable gpio NONEXCLUSIVE
On some platforms, the sy8827n enable gpio may also be used for other
purpose, so make it NONEXCLUSIVE to support this case.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://patch.msgid.link/20250629095716.841-1-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-07 23:32:39 +01:00
Sebastian Reichel
61b8c39deb Runtime PM updates related to autosuspend for 6.17
Make several autosuspend functions mark last busy stamp and update
 the documentation accordingly (Sakari Ailus).
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmhjrvQSHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1aigIAKypscFSfd/WsAlP4orLtd4xiLi7KQHa
 NrOYv7sZBVHgx4S9BGqHavYM3qhOBH5qCg+yBtqb8v6vp/TIlJjF2v3+C8uAXAnl
 9GI5Gc6sZp/lMhf5Vb4Ibf58/P9lg4A7mIvM+LtfeEUMTlRrp47Q/RQ0ah7S4tDj
 rFyC92QmBnkDLoyQp5IbCWkdjlqGgyTZzz/+XnfV9fWwX1aiXqaB4EZ2nXSAlyBx
 awvA4/t662SWlHsdQqll9vS/+ZB39LEWwa1jJ7XGIK8t6GSH+TTys3S9/PHR/ua3
 Dlcd+14plDGlSOy97hY+z6NdSgxH/qcpRgFduu5KwVqEwo2fqNkeV9Q=
 =pFYw
 -----END PGP SIGNATURE-----

Merge tag 'pm-runtime-6.17-rc1'

Runtime PM updates related to autosuspend for 6.17

Make several autosuspend functions mark last busy stamp and update
the documentation accordingly (Sakari Ailus).

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-07-07 00:53:35 +02:00
Mark Brown
769fced943
treewide: Remove redundant
Merge series from Sakari Ailus <sakari.ailus@linux.intel.com>:

Late last year I posted a set to switch to __pm_runtime_mark_last_busy()
and gradually get rid of explicit pm_runtime_mark_last_busy() calls in
drivers, embedding them in the appropriate pm_runtime_*autosuspend*()
calls. The overall feedback I got at the time was that this is an
unnecessary intermediate step, and removing the
pm_runtime_mark_last_busy() calls can be done after adding them to the
relevant Runtime PM autosuspend related functions. The latter part has
been done and is present in Rafael's tree at the moment, also see
<URL:https://lore.kernel.org/linux-pm/CAJZ5v0g7-8UWp6ATOy+=oGdxDaCnfKHBG_+kbiTr+
+VeuXZsUFQ@mail.gmail.com/>:

        git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \
                pm-runtime-6.17-rc1
2025-07-04 16:55:48 +01:00
Sakari Ailus
c61e94e5e4
regulator: stm32-vrefbuf: Remove redundant pm_runtime_mark_last_busy() calls
pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(),
pm_runtime_autosuspend() and pm_request_autosuspend() now include a call
to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to
pm_runtime_mark_last_busy().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Link: https://patch.msgid.link/20250704075444.3221445-1-sakari.ailus@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-04 13:09:53 +01:00
Manivannan Sadhasivam
c9764fd88b
regulator: gpio: Fix the out-of-bounds access to drvdata::gpiods
drvdata::gpiods is supposed to hold an array of 'gpio_desc' pointers. But
the memory is allocated for only one pointer. This will lead to
out-of-bounds access later in the code if 'config::ngpios' is > 1. So
fix the code to allocate enough memory to hold 'config::ngpios' of GPIO
descriptors.

While at it, also move the check for memory allocation failure to be below
the allocation to make it more readable.

Cc: stable@vger.kernel.org # 5.0
Fixes: d6cd33ad7102 ("regulator: gpio: Convert to use descriptors")
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20250703103549.16558-1-mani@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-07-03 12:22:35 +01:00
Jisheng Zhang
6729c134cc
regulator: mp886x: Fix ID table driver_data
Currently, the driver_data of the i2c ID table is wrong, so it won't
work if any mp886x user makes use of the ID table. Fortunately, there's
no such user in upstream source code, we can fix the issue by using
different ID table entry for mp8867 and mp8869.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://patch.msgid.link/20250629095918.912-1-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-30 16:06:40 +01:00
Jisheng Zhang
f172ffde18
regulator: sy8824x: Fix ID table driver_data
Currently, the driver_data of the i2c ID table is wrong, so it won't
work if any sy8824x user makes use of the ID table. Fortunately, there's
no such user in upstream source code, we can fix the issue by using
different ID table entry for sy8824c, sy8824e, sy20276 and sy20278.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://patch.msgid.link/20250629095905.898-1-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-30 16:06:39 +01:00
Jisheng Zhang
427ceac823
regulator: tps6286x-regulator: Enable REGCACHE_MAPLE
Enable regmap cache to reduce i2c transactions and corresponding
interrupts if regulator is accessed frequently.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://patch.msgid.link/20250629095107.804-1-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-30 12:15:40 +01:00