Commit Graph

5468 Commits

Author SHA1 Message Date
Donggeun Yoo
f3e6ef13e2
regulator: pf1550: fix which regulator is notified
The interrupt handler distinguishes the rail that reported the fault, but
the body ignores it. Every SW interrupt walks the regulator array looking
for the name "SW3" and every LDO interrupt looks for "LDO3", so an
over-current on SW1 is reported to the consumers of SW3 while the
consumers of SW1 hear nothing.

The lookup itself is unreliable as well. rdev_get_name() returns the
device tree regulator-name property whenever the board supplies one, and
only falls back to the name in the driver descriptor when it does not.
The binding example for this device sets regulator-name to "sw3" and
"ldo3", which strcmp() does not match against the upper case literals
used here, so a board that follows the documentation gets no over-current
notification at all. A board that names its rails after the schematic
does not match either. No other driver in the tree selects a notification
target this way.

Replace the name lookup with rdev_get_id(), which returns the descriptor
id set by the driver and cannot be overridden from the device tree, and
take both the id and the event from a table indexed by the interrupt.
The die temperature interrupts keep notifying every regulator since they
report a chip wide condition.

Fixes: 7320d41c29 ("regulator: pf1550: Add support for regulator")
Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
Link: https://patch.msgid.link/20260904105624.48577-1-donggeunyoo.kernel@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-09-07 18:08:38 +01:00
Linus Torvalds
6253a29206 regulator: Fix for v7.3
One fix here, for a race condition on startup in the tps65185 driver
 which is seen on actual boards - we need a delay after waking the chip
 before it is ready to talk to the host.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmqQOSwACgkQJNaLcl1U
 h9CrAAf9H7s1Nw5yB4SDI2TghqmY14G0Sr3EL4ajk0TnUEK6jGfsBVrjDeMMCCoI
 i/KIq2hSzCmguRJIeJbkAd1iOX3oLuQFZZelalDuMxe0jv96Nr4XjJegabqPpB2O
 iZzpR3mep3oST4SOj5BfjpifvgNdr1WkC1c/cR49+vd735UXUmw4YxNFA8iow5zL
 if77jZDvUOk9bOeGP4JXtV9WbGSjLeD5eTQopT0E7oiy5Fym+fc1alVht1nj0ylI
 YK/3DbVINxz3NoXV0VOYNIv92jAH8I7Pitw154D62tQLqvnD0Nzn8lMKj9lbTsz1
 TKHkh6nDyn96Oq3uauFb5JjTMHx1oQ==
 =k/VH
 -----END PGP SIGNATURE-----

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

Pull regulator fix from Mark Brown:
 "One fix here, for a race condition on startup in the tps65185 driver
  which is seen on actual boards - we need a delay after waking the chip
  before it is ready to talk to the host"

* tag 'regulator-fix-v7.3-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: tps65185: wait for the IC to wake before the first I2C access
2026-08-27 12:21:56 -07:00
Linus Torvalds
79b4f3baae MFD for v7.3
- New Support & Features
   - MediaTek MT6397: Add mt6323 AUXADC support.
   - MediaTek MT6397: Add mt6323 EFUSE support.
   - Spreadtrum SC27xx: Add SC2730 regulator cell.
 
 - Improvements & Fixes
   - Apple SMC: Fix key count endianness annotation.
   - Azoteq IQS62x: Reject zero-length firmware records.
   - ChromeOS EC: Introduce cros_ec_read_features helper and read features during
     probe to catch transfer errors.
   - Cirrus Logic CS42L43: Fix regmap defaults ordering.
   - Cirrus Logic CS42L43: Remove redundant NULL checks on SoundWire.
   - Congatec Board Controller: Fix teardown ordering in cgbc_remove().
   - HP iPAQ Micro: Fix out-of-bounds stack read in ipaq_micro_str.
   - Marvell 88PM886: Initialize the battery page.
   - QNAP MCU: Keep the reply buffer alive past a command timeout.
   - RAVE SP: Validate received frame payload lengths.
   - Silicon Labs Si476x: Drop duplicate NULL checks.
   - Silicon Labs Si476x: Modernize GPIO handling.
   - Silicon Motion SM501: Fix potential memory leaks during remove.
   - UCB1x00: Convert Assabet gpio-keys to use software nodes and register software
     node for GPIO controller.
   - Viperboard: Fix native fields type in structures as little-endian.
   - Viperboard: Remove redundant NULL check before kfree().
   - X-Powers AXP20x: Preserve other control bits when powering off.
 
 - Cleanups & Refactoring
   - Core: Drop unused assignment of spi_device_id driver data.
   - Core: Initialize spi_device_id arrays using member names.
   - Core: Unify style of spi_device_id arrays.
   - Maintainers: Add Intel LPSS section to follow the changes.
   - Maintainers: Add a mailing list entry to MFD.
   - Cirrus Logic CS42L43: Format sdw_device_id table.
   - Cirrus Logic CS42L43: Use new SoundWire enumeration helper.
   - ROHM PMIC: Factor out power button registration and convert gpio-keys to use
     software nodes.
   - ST-Ericsson DB8500: Fold dbx500 header into db8500.
 
 - Device Tree Binding Updates
   - Core: Add techvision vendor prefix.
   - Marvell 88PM886: Allow vbus regulator.
   - MediaTek MT8195 SCP: Add support for MT8189 SoC.
   - Qualcomm SPMI PMIC: Document PMG1110.
   - Qualcomm SPMI PMIC: Document haptics device.
   - Qualcomm TCSR: Add compatible for Hawi and Maili SoCs.
   - Qualcomm TCSR: Add compatible for Shikra.
   - Qualcomm TCSR: Document the IPQ9650 TCSR block.
   - STMicroelectronics STMPE: Fix typo st,stmpe601 (should be st,stmpe610).
   - Syscon: Add ESWIN EIC7700 compatible.
   - Syscon: Allow syscon compatible for Loongson-2K0300 chip id.
   - Syscon: Disallow simple-bus with syscon.
   - Syscon: Drop custom select for older dtschema.
   - TI OMAP USBHS TLL: Convert to DT schema.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmqPE0EACgkQUa+KL4f8
 d2EwsA/6Ah511L+E+sH3PMz9/9ZR7F6b4xXx+YI0WuiWANNNEdxkkIiq6smdCQI9
 oS//iJBdMigdKzjllIwnAHTcfatZE+3A6qCroM0pnxsQejDdAR0BP2VA4b7QMGg0
 ey44e5CYZgRorh9oOTtsjE/jL4sNZK6AgyZab0gZ3Q/A5qubLRiSaphHfpfCej+q
 RC3W2m3jbQSge5iNy8iIg41PH4fHcjpRNM/UxT6UVexxBWiJ6i9yiNYdfb4joCuG
 Oh4Rr4TfnoN8yIuoA8WRngYejpV5ZGGnwXwTDl47WPvoJiMeWSnpQU0u/fSJARqm
 YAMtZ+GLjSfj60SgCu6HR8AyH9q5U54pNdBiCSQ/7fGhYJwq9WS/XDjr+Xaj0+ku
 g4veatMTMaNdwJr0RAViw1RAOA97cAqfgOADnlAJM/tzvGw0VjIxdrbciywUXB2A
 At26ibT6WQX/I/fPSJqmwieEYiueikZfvuLFYAeSrLQ4GWGGgq3Aj4k1LtOVLEP3
 y3Pt4rkxJQxW3EDKseaZYsyR7EbU3PnJFTsAY0/p1XiDSeiM4d0IIi7dZQiQygg4
 3XwmqE8ODxetHna+dPXr0ooaU9UIaaT1X5AyOr6t6Tp/n0Yq50F1PpjBCS2nLAYk
 JdkgfFBMWlkOZcCTgLYMKNSnmWZihUxb0zfDaOMCe4HUoqc1WLA=
 =92XF
 -----END PGP SIGNATURE-----

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

Pull MFD updates from Lee Jones:
 "New Support & Features:
   - MediaTek MT6397: Add mt6323 AUXADC support
   - MediaTek MT6397: Add mt6323 EFUSE support
   - Spreadtrum SC27xx: Add SC2730 regulator cell

  Improvements & Fixes:
   - Apple SMC: Fix key count endianness annotation
   - Azoteq IQS62x: Reject zero-length firmware records
   - ChromeOS EC: Introduce cros_ec_read_features helper and read
     features during probe to catch transfer errors
   - Cirrus Logic CS42L43: Fix regmap defaults ordering
   - Cirrus Logic CS42L43: Remove redundant NULL checks on SoundWire
   - Congatec Board Controller: Fix teardown ordering in cgbc_remove()
   - HP iPAQ Micro: Fix out-of-bounds stack read in ipaq_micro_str
   - Marvell 88PM886: Initialize the battery page
   - QNAP MCU: Keep the reply buffer alive past a command timeout
   - RAVE SP: Validate received frame payload lengths
   - Silicon Labs Si476x: Drop duplicate NULL checks
   - Silicon Labs Si476x: Modernize GPIO handling
   - Silicon Motion SM501: Fix potential memory leaks during remove
   - UCB1x00: Convert Assabet gpio-keys to use software nodes and
     register software node for GPIO controller
   - Viperboard: Fix native fields type in structures as little-endian
   - Viperboard: Remove redundant NULL check before kfree()
   - X-Powers AXP20x: Preserve other control bits when powering off

  Cleanups & Refactoring:
   - Core: Drop unused assignment of spi_device_id driver data
   - Core: Initialize spi_device_id arrays using member names
   - Core: Unify style of spi_device_id arrays
   - Maintainers: Add Intel LPSS section to follow the changes
   - Maintainers: Add a mailing list entry to MFD
   - Cirrus Logic CS42L43: Format sdw_device_id table
   - Cirrus Logic CS42L43: Use new SoundWire enumeration helper
   - ROHM PMIC: Factor out power button registration and convert
     gpio-keys to use software nodes
   - ST-Ericsson DB8500: Fold dbx500 header into db8500

  Device Tree Binding Updates:
   - Core: Add techvision vendor prefix
   - Marvell 88PM886: Allow vbus regulator
   - MediaTek MT8195 SCP: Add support for MT8189 SoC
   - Qualcomm SPMI PMIC: Document PMG1110
   - Qualcomm SPMI PMIC: Document haptics device
   - Qualcomm TCSR: Add compatible for Hawi and Maili SoCs
   - Qualcomm TCSR: Add compatible for Shikra
   - Qualcomm TCSR: Document the IPQ9650 TCSR block
   - STMicroelectronics STMPE: Fix typo st,stmpe601 (should be
     st,stmpe610)
   - Syscon: Add ESWIN EIC7700 compatible
   - Syscon: Allow syscon compatible for Loongson-2K0300 chip id
   - Syscon: Disallow simple-bus with syscon
   - Syscon: Drop custom select for older dtschema
   - TI OMAP USBHS TLL: Convert to DT schema"

* tag 'mfd-next-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (45 commits)
  mfd: cs42l43: Fix regmap defaults ordering
  dt-bindings: mfd: syscon: Allow syscon compatible for Loongson-2K0300 chip id
  dt-bindings: mfd: syscon: Add ESWIN EIC7700 compatible
  mfd: qnap-mcu: keep the reply buffer alive past a command timeout
  dt-bindings: mfd: qcom,tcsr: Document the IPQ9650 TCSR block
  mfd: macsmc: Fix key count endianness annotation
  dt-bindings: mfd: qcom,spmi-pmic: Document haptics device
  mfd: iqs62x: Reject zero-length firmware records
  mfd: rave-sp: validate received frame payload lengths
  mfd: sm501: Fix potential memory leaks during remove
  mfd: viperboard: Fix native fields type in structures as little-endian
  mfd: si476x-i2c: Get rid of duplicate NULL checks
  dt-bindings: mfd: Convert OMAP USB TLL to DT schema
  mfd: cgbc: Fix teardown ordering in cgbc_remove()
  mfd: mt6397-core: Add mt6323 AUXADC support
  dt-bindings: mfd: qcom,tcsr: Add compatible for Hawi and Maili SoCs
  mfd: rohm: Factor out power button registration
  mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes
  mfd: ucb1x00: Register software node for GPIO controller
  mfd: cs42l43: Tidy up formatting on sdw_device_id table
  ...
2026-08-27 10:45:08 -07:00
Linus Torvalds
b3438e5ca7 regulator: Updates for v7.3
This is a relatively quiet release for the regulator API, we've had no
 major core work and not really that much driver work either.  There's a
 bunch of activity, including several new devices, but nothing hugely
 remarkable here.
 
  - Reworking of the mode handling in the max14577 driver to fix issues
    with collisions with enables.
  - Support for onsemi FAN53555BUC23X, Qualcomm IPQ9650, PM4125 VBUS and
    PM8150B and Unisoc SC2730.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmqDPDUACgkQJNaLcl1U
 h9CvoAf/Y8owPCZFX9vMl/HUGvw+Bvj/fNXDUAar0rLjseD5hq6LUQi8l7YZJy+3
 Voun5Ehakiti6VfJvA08+guG1orI/BqeT6W/lx6h1DXzvifoU8N3itKsyMk1lvug
 JtYi16gwbMa3RSdWI0W3ftAMIq6GeTNyLnPfqSM8XWJ2McZVABpg3ndOegaU922y
 aSBODYyI7weoWD+p+JI5P9O/vncGoO9tDRdwHBeZXi1HuR7HcOe9aGDSeQn/1dvC
 /dLDRNKpSPV/jscvxAa3MyCIAbubQipRcfEIGZTYXDabr8NE2odgKwWaZRkVyts2
 +mfkEBqz1z5Tsx+AfplwxnXk+3i3vw==
 =0fgh
 -----END PGP SIGNATURE-----

Merge tag 'regulator-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "This is a relatively quiet release for the regulator API, we've had no
  major core work and not really that much driver work either. There's a
  bunch of activity, including several new devices, but nothing hugely
  remarkable here.

   - Reworking of the mode handling in the max14577 driver to fix issues
     with collisions with enables

   - Support for onsemi FAN53555BUC23X, Qualcomm IPQ9650, PM4125 VBUS
     and PM8150B and Unisoc SC2730"

* tag 'regulator-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (36 commits)
  regulator: fan53555: Add support for FAN53555BUC23X type
  regulator: qcom-rpmh: Fix coding style issues
  regulator: qcom-rpmh: readback voltage/bypass/mode set during bootup
  regulator: qcom-rpmh: Fix PMIC5 BOB bypass mode handling
  soc: qcom: rpmh: Add support to read back resource settings
  regulator: dt-bindings: ti,pbias-omap: Convert to DT schema
  regulator: ab8500: Remove stale expand_register kernel-doc entry
  regulator: dt-bindings: Correct white-space style
  regulator: pfuze100: add set_suspend_disable for LDO ops
  regulator: core: use system_freezable_wq for init complete work
  regulator: rt6245: Restore state on enable failure
  regulator: tps65185: handle gpiod_get_value_cansleep() error returns
  regulator: fan53555: Add support for mode operations on Silergy devices
  regulator: dt-bindings: Add fan53555 allowed modes
  regulator: wm831x-isink: remove conditional return with no effect
  regulator: dt-bindings: Convert ltc3589.txt to yaml format
  regulator: dt-bindings: tps51632: Convert to DT schema
  regulator: mcp16502: Convert to dev_err_probe() in mcp16502_probe()
  regulator: adp5055: Fix error code in adp5055_of_parse_cb()
  regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg
  ...
2026-08-19 09:36:58 -07:00
Mario Rugiero
44f7b876b7
regulator: tps65185: wait for the IC to wake before the first I2C access
The probe drives WAKEUP high with GPIOD_OUT_HIGH, enables the input
supply, and then issues a regmap_update_bits() on INT_EN2 with no wait
anywhere in between. The TPS65185 data sheet (TI SLVSAQ8G, February
2011, revised September 2017), section 7.6 "Timing Requirements: Data
Transmission", Figure 2 "Power-Up and Power-Down Timing Diagram",
footnote 1, requires 1.8 ms minimum between the WAKEUP rising edge and
the IC being ready to accept an I2C transaction. The driver calls no
delay function anywhere, and nothing on that path is guaranteed to take
that long.

On an RK3026 board the first transfer was NAKed:

  tps65185 0-0068: error -ENXIO: failed to enable temp irq

-ENXIO here is rk3x_i2c reporting REG_INT_NAKRCV. Probe failed, so
vposneg never registered and its consumer deferred indefinitely.

Wait after the supply rather than at the gpiod_get(). Figure 2 times
that 1.8 ms from a WAKEUP edge with VIN already up, whereas this driver
asserts WAKEUP before enabling vin-supply; the data sheet does not
describe that order, so on a board whose vin-supply is a switched
regulator that was off, a wait placed at the gpiod_get() could elapse
before the part had power. Waiting from whichever of the two comes last
satisfies the specified case and is the conservative choice in the
other.

It also goes above the interrupt request rather than immediately before
the INT_EN2 write, because that write is not necessarily the first
transfer: tps65185_irq_thread() reads INT1 and INT2, and it is
requested with IRQF_TRIGGER_LOW, so it can run as soon as the handler
is installed.

Tested on an ONYX BOOX C67ML (RK3026): the chip now probes, all three
regulators register and the EPD controller comes up.

Fixes: b0fc1e7701 ("regulator: Add TPS65185 driver")
Signed-off-by: Mario Rugiero <mrugiero@gmail.com>
Link: https://patch.msgid.link/20260815232229.68474-1-mrugiero@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-17 17:58:29 +01:00
Arash Golgol
e739acbe05
regulator: fan53555: Add support for FAN53555BUC23X type
FAN53555BUC23X has the ID 0 and REV 0xc, starts at 600mV and
increments in 12.5mV steps.

Per the datasheet, the FAN53555BUC23X (23 option) is grouped with
the 00 and 13 options for soft-start timing (t_SS = 300us typ.),
so the existing enable_time = 400 is reused here as well.

This variant is found on the ASUS Tinker Edge R (RK3399Pro) as the
supply regulator for both vdd_gpu and vdd_cpu_b. Verified across
the full GPU OPP table with the userspace devfreq governor.

Signed-off-by: Arash Golgol <arash.golgol@gmail.com>
Link: https://patch.msgid.link/20260812125054.19111-1-arash.golgol@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-12 17:48:37 +01:00
Mark Brown
6ab838a01b
regulator: qcom-rpmh: Support RPMH address reads and use it for rpmh-regulators
Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com> says:

This patch series adds a new `rpmh_read()` API to allow reading RPMH
addresses. Using this API enhances the RPMH regulator driver by adding
readback of the voltage/bypass/mode settings as they have been applied by
APPS during the bootloader stage, so regulator framework can get them
via `get_mode`, `get_bypass` & `get_voltage_selector` callbacks during
regulator registration.

This is needed because currently regulator framework does a unnecessary
write with `min-microvolt` DT setting for all the RPMH regulators during
regulator registration, because the first time after boot the value is
seen as -ENOTRECOVERABLE, as there is no option to read these regulator
settings.

With this change this unnecessary write can be avoided and regulator
framework gets a sense of the initial state set during the bootloader
stage for all regulator settings.

NOTE - During discussion on the v2 series - PATCH 3/4, reviewer had
inquired about possible need for the use of the sync_state() to handle the
"multiple" client case - for maintaining the regulator settings till all
the clients are probed.

This case was not covered in my previous series and had originally planned
to do that series separately. But after the discussion decided to merge
the 2 series as it seemed this would be a better approach. But after
working on sync_state change. I realized a basic issue with using
sync_state() for regulators - that its per-driver and not per-regulator
resource. But we needed a sync_state callback for each regulator separately.

I had been experimenting with few ideas but seems its going to need more
time for me to close on the equivalent solution that has per-regulator
sync_state or something to that effect. So I thought to close on this
series and attend to that separately.

Link: https://patch.msgid.link/20260801-b4-read-rpmh-v5-v6-0-9fcb54928523@oss.qualcomm.com
2026-08-07 15:19:44 +01:00
Kamal Wadhwa
216e8873bc
regulator: qcom-rpmh: Fix coding style issues
Fix the code style/format issues reported by checkpatch.pl
script.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>
Link: https://patch.msgid.link/20260801-b4-read-rpmh-v5-v6-4-9fcb54928523@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-07 15:19:42 +01:00
Kamal Wadhwa
09d99ff7fc
regulator: qcom-rpmh: readback voltage/bypass/mode set during bootup
Currently, during regulator registration, regulator framework sends an
unnecessary `min-microvolts` request for the rpmh-regulator device. This
happens because in current design, we do not have a way to readback the
voltage settings that was set during the bootloader stage.

Fix this by using the rpmh_read() API to read the regulator voltage
settings done during boot and make it available to regulator framework
from the very first read after the bootup.

Also use this API to read the mode/bypass settings as well. This will
provide the regulator framework a sense of the initial settings done by
bootloader and thus preventing any redundant writes for any setting post
bootup incase the same setting was already applied during bootup.

Signed-off-by: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>
Link: https://patch.msgid.link/20260801-b4-read-rpmh-v5-v6-3-9fcb54928523@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-07 15:19:41 +01:00
Kamal Wadhwa
abd14bebb8
regulator: qcom-rpmh: Fix PMIC5 BOB bypass mode handling
Currently, when `rpmh_regulator_set_mode_bypass()` helper function
is called to set bypass mode, it sends PMIC4's BOB bypass mode
value for even if its a PMIC5 BOB.

To fix this, introduce new hw_data parameter`pmic_bypass_mode`
to store bypass mode value. Use it to send correct PMIC bypass
mode value that corresponds to PMIC4/5 BOB regulators from the
helper function.

Fixes: 610f29e5cc ("regulator: qcom-rpmh: Update PMIC modes for PMIC5")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>
Link: https://patch.msgid.link/20260801-b4-read-rpmh-v5-v6-2-9fcb54928523@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-07 15:19:40 +01:00
Babanpreet Singh
0991f3b462
regulator: ab8500: Remove stale expand_register kernel-doc entry
Commit aeee55b76b ("regulator: ab8500: Remove unused embedded struct
expand_register") deleted the expand_register member from struct
ab8500_regulator_info and, in the same hunk, added an empty
"@expand_register:" line to the kernel-doc block. That traded one W=1
warning for another:

  drivers/regulator/ab8500.c:196 Excess struct member 'expand_register'
  description in 'ab8500_regulator_info'

Drop the leftover line; the remaining @member entries all match the
struct.

No functional changes.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202605160857.ZIE3nO9J-lkp@intel.com/
Assisted-by: Claude:claude-opus-5 [kernel-doc]
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
Link: https://patch.msgid.link/20260802013304.7-1-bbnpreetsingh@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-03 16:39:01 +01:00
Robby Cai
66694b5f90
regulator: fp9931: Fix VPOS/VNEG voltage selector table
The VPOSNEG_table[] mapping does not match the FP9931 datasheet.

The datasheet defines the VPOS/VNEG voltage mapping as:

  00h-04h ->  7.04V (-7.04V)
  05h     ->  7.26V (-7.26V)
  06h     ->  7.49V (-7.49V)
  ...
  28h-3Fh -> 15.06V (-15.06V)

However, VPOSNEG_table[] has two issues:

1. Selector 0x00~0x04 should all map to 7.04V (5 entries), but the
   table has 6 entries of 7.04V, causing all subsequent entries to be
   shifted by one position.

2. Selectors 0x29~0x3F should all clamp to 15.06V (23 entries), but
   the table has only 41 entries. Any selector value above 0x28
   would result in an out-of-bounds table access.

Fix both issues by removing the duplicate 7.04V entry and appending
the missing 23 clamped 15.06V entries, bringing the table to the
correct size of 64 entries (0x00~0x3F).

Fixes: 12d821bd13 ("regulator: Add FP9931/JD9930 driver")
Signed-off-by: Robby Cai <robby.cai@nxp.com>
Link: https://patch.msgid.link/20260724103441.800522-2-robby.cai@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-31 18:40:28 +01:00
Mark Brown
688a70ddb2
regulator: handle regulator late cleanup race with PM suspend
Joy Zou <joy.zou@oss.nxp.com> says:

The regulator_init_complete_work fires ~30s after boot to disable
unused regulators via I2C. When this work races with PM suspend, the
I2C adapter may already be suspended, causing a -ESHUTDOWN warning
dump.

This series addresses the race and adds proper suspend power
management for unused LDO regulators.

Link: https://patch.msgid.link/20260731-b4-regulator-pf01-v2-0-a406c8737fdb@oss.nxp.com
2026-07-31 17:15:16 +01:00
Joy Zou
7595f50ff8
regulator: pfuze100: add set_suspend_disable for LDO ops
Add a set_suspend_disable callback to pfuze100_ldo_regulator_ops to
support the regulator-off-in-suspend DTS property for the VGEN LDO
regulators. This allows unused LDO regulators to be properly disabled
during system suspend, reducing power consumption.

The callback is only used by the LDO ops, so name it accordingly:
pfuze100_ldo_set_suspend_disable. It uses the per-regulator
stby_reg/stby_mask that already describe the standby control for
each LDO, so it works for every LDO covered by these ops.

Signed-off-by: Joy Zou <joy.zou@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260731-b4-regulator-pf01-v2-2-a406c8737fdb@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-31 17:15:15 +01:00
Joy Zou
03eab318ce
regulator: core: use system_freezable_wq for init complete work
schedule_delayed_work() uses system_wq, which is non-freezable, allowing
regulator_init_complete_work to run concurrently with system suspend. This
work fires ~30s after boot to disable unused regulators via I2C. When it
races with PM suspend, the I2C adapter may already be suspended, triggering
a -ESHUTDOWN warning in __i2c_transfer():

  WARNING: ... at __i2c_transfer+0x36c/0x3c8
  Call trace:
   __i2c_transfer
   i2c_transfer
   regmap_i2c_write
   _regmap_update_bits
   regulator_disable_regmap
   _regulator_do_disable
   regulator_late_cleanup
   regulator_init_complete_work_function
   process_one_work

Switch to system_freezable_wq so the work is frozen before any device
is suspended, eliminating the race.

Fixes: 55576cf185 ("regulator: Defer init completion for a while after late_initcall")
Signed-off-by: Joy Zou <joy.zou@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260731-b4-regulator-pf01-v2-1-a406c8737fdb@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-31 17:15:14 +01:00
bui duc phuc
e95a0a309c
regulator: rt6245: Restore state on enable failure
Currently, if regcache_sync() fails after the enable GPIO has been
asserted, the driver returns with enable_gpio still set high and
regcache_cache_only() left disabled. This leaves the device state
inconsistent with the disabled state, where the enable GPIO is low and
cache_only is enabled.
On failure, restore the original state by setting cache_only back to
true and driving the enable GPIO low before returning the error.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260729100018.66577-1-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-30 19:26:45 +01:00
Linus Walleij
b8bc38bcec mfd: db8500-prcmu: Fold dbx500 header into db8500
Move the DBx500 PRCMU definitions into the DB8500 PRCMU
header and delete the wrapper header.

Convert users of simple PRCMU wrappers to call the DB8500 helpers
directly.

The dbx500-prcmu.h header was the result of an earlier attempt to
abstract several DBx5x SoC PRCMU units to use the same abstract
header. They are deleted from the kernel and this is not just
causing maintenance burden and build errors.

The stub code is using -ENOSYS in a way checkpatch complains about
so replace these with -EINVAL while we're at it.

Assisted-by: Codex:gpt-5-5
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606180825.vUSQntkJ-lkp@intel.com/
Signed-off-by: Linus Walleij <linusw@kernel.org>
Acked-by: Brian Masney <bmasney@redhat.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/oe-kbuild-all/202606180825.vUSQntkJ-lkp@intel.com/
Link: https://patch.msgid.link/20260619-mfd-prcmu-merge-headers-v1-1-8ea0ee23b4d6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-07-30 14:32:45 +01:00
Surendra Singh Chouhan
623d9a5568
regulator: tps65185: handle gpiod_get_value_cansleep() error returns
tps65185_vposneg_enable() evaluated:
  if (gpiod_get_value_cansleep(data->pgood_gpio) != 1)
      return -ETIMEDOUT;

gpiod_get_value_cansleep() returns 1 if active, 0 if inactive, and a
negative error code (e.g. -EIO or -EINVAL) on failure. Evaluating != 1
treats a negative error code as non-equal, swallowing GPIO read errors and
masking them as -ETIMEDOUT.

Fix this by capturing the return value of gpiod_get_value_cansleep(). If
it returns a negative error code, propagate that error immediately; if
it returns 0 (inactive), return -ETIMEDOUT.

Fixes: b0fc1e7701 ("regulator: Add TPS65185 driver")
Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://patch.msgid.link/20260724125858.75635-1-kr494167@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-30 00:50:15 +01:00
Esteban Urrutia
6753251cfc
regulator: qcom-rpmh: Add support for PM8350B
The PM8350B has only one LDO, which gets its power from a dedicated input.
Add support for it.

Signed-off-by: Esteban Urrutia <esteuwu@proton.me>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260723-pm8350b-ldo-v1-2-42b5428a0d3f@proton.me
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-28 19:54:27 +01:00
Victor Krawiec
99bc5744e9
regulator: fan53555: Add support for mode operations on Silergy devices
Make the PWM mode configurable from devicetree. Some boards require forced
PWM mode to keep the supply ripple within acceptable limits under light
load conditions

Support is restricted to Silergy manufacturer as it is the only one
currently tested.

Signed-off-by: Victor Krawiec <victor.krawiec@arturia.com>
Link: https://patch.msgid.link/20260723094001.120264-5-victor.krawiec@arturia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-28 19:23:29 +01:00
Sang-Heon Jeon
9396a1d9e1
regulator: wm831x-isink: remove conditional return with no effect
Both branches of the check return the same value, so the check has
no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260723184538.3888637-29-ekffu200098@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-27 13:25:50 +01:00
Kamal Wadhwa
a45cc646a3
regulator: core: clamp voltage constraints before applying apply_uV
machine_constraints_voltage() currently applies apply_uV against the
machine-supplied [min_uV, max_uV] range, and only afterwards clamps
that range down to what the regulator can actually supply (via
ops->list_voltage()).

If the machine-supplied range is wider than the regulator's actual
range, apply_uV's rounding can pick a selector outside the (correct)
clamped range, so the regulator ends up programmed outside its clamped
min/max. At bring-up this shows up as a voltage read-back outside the
clamped range.

Fix this by moving the clamping block ahead of the apply_uV block, so
apply_uV always targets an already-clamped range. Whether apply_uV
should run is decided from the unclamped constraints beforehand and
stored in a local bool, since clamping must not itself change whether
apply_uV fires.

No functional change to the clamping logic itself, only its position
relative to apply_uV. Its early return 0 exits become fallthroughs
since the apply_uV logic now follows it.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>
Link: https://patch.msgid.link/20260720-b4-regulator-core-clamp-voltage-v1-1-8e5eec076a8e@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-21 22:35:08 +01:00
Daniel Golle
1d26f12550
regulator: mt6358: use regmap helper to read fixed LDO calibration
The "fixed" LDOs with output voltage calibration use
mt6358_get_buck_voltage_sel as their get_voltage_sel op, but the
MT6358_REG_FIXED and MT6366_REG_FIXED entries do not populate
da_vsel_reg/da_vsel_mask. The op therefore reads register 0x0 with a
zero mask and shifts the result by ffs(0) - 1 = -1, which is undefined
behaviour and gets flagged by UBSAN on every boot on MT6366 boards:

  UBSAN: shift-out-of-bounds in drivers/regulator/mt6358-regulator.c:384:38
  shift exponent -1 is negative
  Call trace:
   mt6358_get_buck_voltage_sel+0xc8/0x120
   regulator_get_voltage_rdev+0x70/0x170
   set_machine_constraints+0x504/0xc38
   regulator_register+0x324/0xc68

Besides the undefined shift, the returned selector is always 0, so the
actual calibration offset programmed in <reg>_ANA_CON0 is never
reported.

The descriptor already carries the correct vsel_reg/vsel_mask (the
ANA_CON0 calibration field), matching the regulator_set_voltage_sel_regmap
op already in use. Read the selector back through
regulator_get_voltage_sel_regmap instead.

Fixes: cf08fa74c7 ("regulator: mt6358: Add output voltage fine tuning to fixed regulators")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Chen-Yu Tsai <wens@kernel.org>
Tested-by: Chen-Yu Tsai <wens@kernel.org>
Link: https://patch.msgid.link/dcd98d81dede338c9bbb9700a9613c848b702e49.1784336005.git.daniel@makrotopia.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-20 17:32:39 +01:00
Abhishek Ojha
50dce2e2f8
regulator: ltc3676: Fix incorrect IRQSTAT bit offsets
The LTC3676_IRQSTAT_* bit definitions do not match the IRQSTAT
(Interrupt Request Status) register layout documented in Table 15
of the LTC3676/LTC3676-1 datasheet:

  bit 0 - Pushbutton Status Active
  bit 1 - Hard Reset Occurred
  bit 2 - PGOOD Timeout Occurred
  bit 3 - Undervoltage Warning
  bit 4 - Undervoltage Standby (Fault) Occurred
  bit 5 - Overtemperature Warning
  bit 6 - Overtemperature Standby (Fault) Occurred
  bit 7 - Reserved

The driver instead defines these starting at bit 3, one bit higher
than the datasheet specifies, which causes ltc3676_regulator_isr()
to check the wrong status bits and misreport (or miss) PGOOD
timeout, undervoltage and thermal warning/fault conditions.

Fix the bit offsets to match the datasheet.

Fixes: 37b918a034 ("regulator: Add LTC3676 support")
Cc: stable@vger.kernel.org
Signed-off-by: Abhishek Ojha <Abhishek.ojha@savoirfairelinux.com>
Link: https://patch.msgid.link/20260715170408.295552-1-Abhishek.ojha@savoirfairelinux.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-16 16:19:07 +01:00
Ninad Naik
25706f1ab9
regulator: mcp16502: Convert to dev_err_probe() in mcp16502_probe()
The mcp16502_probe() currently uses dev_err() for logging errors.
However, functions like devm_regmap_init_i2c, devm_gpiod_get_optional
and devm_regulator_register can return -EPROBE_DEFER. Using dev_err()
in these situations can cause unnecessary error spam in dmesg.
As a result, convert to dev_err_probe(). It also simplifies the print
and return operations into single statement. The 'ret' variable is no
longer required and has been removed.
Originally detected by Coccinelle with this warning "Consider using
%pe to print PTR_ERR()"
Compile-tested only.

Signed-off-by: Ninad Naik <ninadnaik07@gmail.com>
Link: https://patch.msgid.link/20260714192228.1639768-1-ninadnaik07@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-16 13:56:52 +01:00
Dan Carpenter
153bc959ce
regulator: adp5055: Fix error code in adp5055_of_parse_cb()
This code accidentally returned the wrong variable instead of a negative
error code.  Return -EINVAL.

Fixes: 147b2a96f2 ("regulator: adp5055: Add driver for adp5055")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://patch.msgid.link/alFJVBbiFNxhqa_1@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-14 22:21:59 +01:00
Timur Tabi
d38f8bd771
regulator: core: regulator_lock_two() should test for EDEADLK not EDEADLOCK
Compare against -EDEADLK, which is what ww_mutex_lock() actually
returns and what every other deadlock check in this file already uses.

Function regulator_lock_two() acquires two regulators via
regulator_lock_nested() -> ww_mutex_lock().  On contention,
ww_mutex_lock() returns -EDEADLK, which is the caller's signal to drop
the lock it holds and retry the acquisition in the canonical order.

However, regulator_lock_two() tests the return value against -EDEADLOCK
rather than -EDEADLK.  On most architectures, EDEADLK and EDEADLOCK are
the same value, so the comparison happens to be correct and the bug is
invisible.  But on MIPS, SPARC, and PowerPC, those two errors have
different values.  The test is wrong: a genuine -EDEADLK backoff no
longer matches -EDEADLOCK, so instead of unlocking and retrying, the
code falls into WARN_ON(ret) and returns with only one of the two
regulators locked.

In practice, this is a bug only on MIPS, because the regulator core is
not built or used on the other two platforms.

In general, EDEADLK is preferred over EDEADLOCK for new code.

Fixes: cba6cfdc7c ("regulator: core: Avoid lockdep reports when resolving supplies")
Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Link: https://patch.msgid.link/20260708235722.2953579-1-ttabi@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-09 01:41:17 +01:00
Pengpeng Hou
87063bab45
regulator: mt6363: add missing MODULE_DEVICE_TABLE()
The driver has an OF match table wired to .of_match_table, but does
not export the table with MODULE_DEVICE_TABLE().

Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias
information is generated for OF based module autoloading.

This is a source-level fix.  It does not claim dynamic hardware
reproduction; the evidence is the driver-owned match table, its use by
the platform driver, and the missing module alias publication.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260704124352.7981-1-pengpeng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-08 19:32:24 +01:00
Pengpeng Hou
91f0063ca9
regulator: mt6316: add missing MODULE_DEVICE_TABLE()
The driver has an OF match table wired to .of_match_table, but does
not export the table with MODULE_DEVICE_TABLE().

Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias
information is generated for OF based module autoloading.

This is a source-level fix.  It does not claim dynamic hardware
reproduction; the evidence is the driver-owned match table, its use by
the platform driver, and the missing module alias publication.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260704122926.21586-1-pengpeng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-08 19:31:41 +01:00
Mark Brown
bf2cecaae4
regulator: qcom_usb_vbus: add pm4125 VBUS regulator support
Rakesh Kota <rakesh.kota@oss.qualcomm.com> says:

Add support for PM4125 USB VBUS regulator. Unlike PM8150B which uses
a current-limit selector, PM4125 uses a 2-bit VBOOST voltage selector
supporting 4.25 V, 4.5 V, 4.75 V and 5.0 V output.

Link: https://patch.msgid.link/20260706-add_pm4125-vbus-reg-v3-0-999d78a87b81@oss.qualcomm.com
2026-07-06 23:34:15 +01:00
Rakesh Kota
d37664f99e
regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg
The PM4125 PMIC uses a different register layout for USB VBUS control
compared to PM8150B. On PM4125, CMD_OTG is at offset 0x50, OTG_CFG is
at 0x56, and offset 0x52 is a 2-bit VBOOST voltage selector rather than
a current-limit selector.

Add pm4125_data using the abstraction introduced for PM8150B, along with
dedicated voltage-selector ops and the pm4125_vboost_table covering the
four supported boost voltages: 4.25 V, 4.5 V, 4.75 V, and 5.0 V.

Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260706-add_pm4125-vbus-reg-v3-3-999d78a87b81@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-06 23:34:13 +01:00
Rakesh Kota
56cb4a0e8e
regulator: qcom_usb_vbus: add register abstraction and PM8150B support
Introduce per-compatible regulator descriptor data via struct
qcom_usb_vbus_reg_data to abstract register layout differences between
PMICs. This allows the probe function to dynamically populate the
regulator_desc fields rather than relying on compile-time constants.

Refactor the existing PM8150B support to use this abstraction, wiring in
its CMD_OTG, OTG_CFG, and current-limit registers through pm8150b_data.
No functional change is intended for PM8150B.

Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20260706-add_pm4125-vbus-reg-v3-2-999d78a87b81@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-06 23:34:09 +01:00
Otto Pflüger
4c40e28e83
regulator: Add regulator driver for Unisoc SC2730 PMIC
Add a regulator driver for the Spreadtrum/Unisoc SC2730 PMIC, used
e.g. with the UMS512 and UMS9230 SoCs. This version of the driver is
based on a downstream driver provided by Unisoc [1][2] and the existing
SC2731 driver.

[1]: 30be0ddfe6
[2]: https://github.com/MotorolaMobilityLLC/kernel-sprd/blob/android-13-release-tla33/drivers/regulator/sc2730-regulator.c

Signed-off-by: Zhongfa Wang <zhongfa.wang@unisoc.com>
[cleanup, adapt to new device tree requirements]
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
Link: https://patch.msgid.link/20260701-sc2730-regulators-v7-2-6e145ce83657@abscue.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-03 13:27:19 +01:00
Uwe Kleine-König (The Capable Hub)
995832b2ce Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files)
Replace the #include of <linux/mod_devicetable.h> by the more specific
<linux/device-id/*.h> where applicable. For most cases the include
can be dropped completely, only a few drivers need one or two headers
added.

Acked-by: Danilo Krummrich <dakr@kernel.org>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/1a3f2007c5c5dcf555c09a4035ce3ae8ef1b6c49.1782808461.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
2026-07-03 07:38:17 +02:00
WenTao Liang
7c8cc25d8d
regulator: max8998_pmic_dt_parse_pdata: of_node_put on reg_np after ownership transferred to rdata
In max8998_pmic_dt_parse_pdata(), of_get_child_by_name() acquires a
reference on reg_np which is then stored in rdata->reg_node, transferring
ownership to the regulator data array. The subsequent of_node_put(reg_np)
at the end of the function releases the last matched regulator node's
reference, leaving rdata->reg_node as a dangling pointer for the last
entry.

Remove the spurious of_node_put(reg_np) call.

Cc: stable@vger.kernel.org
Fixes: 156f252857 ("drivers: regulator: add Maxim 8998 driver")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20260626160326.54457-1-vulab@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-02 18:48:28 +01:00
WenTao Liang
f9324d670a
regulator: as3722_get_regulator_dt_data: fix premature of_node_put leaving dangling of_node pointer
In as3722_get_regulator_dt_data(), of_get_child_by_name() acquires a
reference on np, which is then assigned to pdev->dev.of_node. The
function immediately calls of_node_put(np), releasing the reference and
leaving pdev->dev.of_node as a dangling pointer.

Remove the of_node_put(np) call to let the device hold the reference.

Cc: stable@vger.kernel.org
Fixes: bc407334e9 ("regulator: as3722: add regulator driver for AMS AS3722")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20260626160150.54291-1-vulab@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-02 17:18:25 +01:00
Uday Khare
7fd28093b3
regulator: tps6594: Fix device node reference leaks in multiphase loop
In tps6594_regulator_probe(), the multi-phase configuration loop calls
of_find_node_by_name() to find buck nodes by name, and of_get_parent()
twice to navigate to the PMIC parent node. None of the acquired node
references (np, intermediate parent, np_pmic_parent) are ever released
via of_node_put(), causing a reference leak on every loop iteration.

Additionally, of_find_node_by_name() can return NULL, but the result was
immediately passed to of_node_full_name() and of_get_parent() without a
NULL check, which could lead to a NULL pointer dereference.

Fix this by:
- Adding a NULL check for np after of_find_node_by_name()
- Storing the intermediate parent node in a local variable np_parent
- Calling of_node_put() on np, np_parent and np_pmic_parent at the
  end of each loop iteration

Fixes: f17ccc5deb ("regulator: tps6594-regulator: Add driver for TI TPS6594 regulators")
Signed-off-by: Uday Khare <udaykhare77@gmail.com>
Link: https://patch.msgid.link/20260618132327.11529-1-udaykhare77@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-01 12:20:53 +01:00
Mark Brown
a36cc103a6
regulator: Rework i2c_device_id initialisation
Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> says:

[Nothing]

Link: https://patch.msgid.link/cover.1782827697.git.u.kleine-koenig@baylibre.com
2026-06-30 23:40:23 +01:00
Uwe Kleine-König (The Capable Hub)
2924fa8381
regulator: Improve style of i2c_device_id arrays
The two previous patches did some style improvements while adapting the
i2c_device_id arrays. Adapt all the remaining regulator drivers to use
the same style. That is:

 - Use a comma after a initialisation value unless the closing } is in
   the same line.
 - Don't use a comma after the list terminator.
 - Use a space after the opening { and one before the closing }; a
   single space for an empty pair.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/221a2e634f6bbf9638b906470ffb1b2b413e0a5a.1782827697.git.u.kleine-koenig@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-30 23:40:21 +01:00
Uwe Kleine-König (The Capable Hub)
8e74b2db58
regulator: Use named initializers for arrays of i2c_device_data
While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

The mentioned robustness is relevant for a planned change to struct
i2c_device_id that replaces .driver_data by an anonymous union.

While touching all these arrays, unify usage of whitespace and commas.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/2e83a9747ac2c92db8f91fd0e0eb311c4efe8e73.1782827697.git.u.kleine-koenig@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-30 23:40:20 +01:00
Uwe Kleine-König (The Capable Hub)
3ac69e3cb2
regulator: Drop unused i2c driver data
The two drivers explicitly set .driver_data to zero but don't use this
value. So drop the explicit assignment.

While touching these arrays, unify usage of whitespace and commas, and
use named initializers.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/ce4f4851f16d8eea9cca632017d8c64c39ab2bcb.1782827697.git.u.kleine-koenig@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-30 23:40:19 +01:00
Mark Brown
7f8e103f14
regulator: rtq2208: Remove the unnecessary MTP_SEL property
ChiYuan Huang <cy_huang@richtek.com> says:

This patch series remove the 'richtek,mtp-sel-high' property usage.

Link: https://patch.msgid.link/cover.1782444299.git.cy_huang@richtek.com
2026-06-30 12:41:54 +01:00
ChiYuan Huang
2f84cec84f
regualtor: rtq2208: Initiate the default MTP_SEL state by hardware register
Read the initial MTP_SEL state by hardware register to prevent the wrong
specified property value from the conflict of hardware pin assignment.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://patch.msgid.link/557e872a87c603a26cf91f0d4448e527afcbbae8.1782444299.git.cy_huang@richtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-30 12:41:52 +01:00
Mark Brown
57d1e9229e
Add support for the REFGEN in the IPQ9650 SoC
Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com> says:

IPQ9650 SoC has 2 REFGEN blocks providing the reference current to
the PCIe and USB, UNIPHY PHYs. For the other SoCs, clocks for this block
is enabled on power up but that's not the case for IPQ9650 and we have
to explicitly enable those clocks.

Document the same and add support for it.

Correct the regulator type to REGULATOR_CURRENT, as the REFGEN block
supplies the reference current to PHYs in the SoC, per the REFGEN IP
team, aligning it with the hardware behavior.

Link: https://patch.msgid.link/20260617-ipq9650_refgen-v4-0-c505ea6c6661@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29 19:04:33 +01:00
Kathiravan Thirumoorthy
ca5c1a0ca2
regulator: qcom-refgen: add support for the IPQ9650 SoC
IPQ9650 SoC has 2 REFGEN blocks providing the reference current to the
PCIe and USB, UNIPHY PHYs. For the other SoCs, clock for this block is
enabled on power up but that's not the case for IPQ9650 and we have to
enable those clocks explicitly to bring up the PHYs properly.

Also, add the get_status() callback to report the regulator status to
the userspace.

Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260617-ipq9650_refgen-v4-3-c505ea6c6661@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29 19:04:24 +01:00
Kathiravan Thirumoorthy
05dfeb2d0c
regulator: qcom-refgen: correct the regulator type to CURRENT
As per the REFGEN IP team, this block supplies the reference current to
the PHYs in the SoC. So, correct the regulator type to REGULATOR_CURRENT
to match with the HW behavior.

Fixes: 7cbfbe2379 ("regulator: Introduce Qualcomm REFGEN regulator driver")
Cc: stable@vger.kernel.org
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
Link: https://patch.msgid.link/20260617-ipq9650_refgen-v4-1-c505ea6c6661@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29 19:04:22 +01:00
Jad Keskes
19253cac2a
regulator: max14577: fix set_mode clobbering enable on MAX77836 LDOs
So the PWRMD field in CNFG1_LDO is both the enable bit and the mode.
You can't change one without stepping on the other.

The problem is that enable() from the regulator core just writes
enable_mask (which is PWRMD_NORMAL).  If you'd called set_mode(LPM)
then disabled and re-enabled, the mode gets reset to NORMAL.  And
set_mode updates the register through the same field, so it can
accidentally enable a disabled regulator.

Fix it by storing the mode in per-regulator data.  A custom enable
writes whatever mode was last set.  set_mode only touches hardware
if the regulator is already on; otherwise it just caches the value.

Add of_map_mode while here so the initial mode can be wired from DT.

Signed-off-by: Jad Keskes <inasj268@gmail.com>
Acked-by: Lee Jones <lee@kernel.org>
Link: https://patch.msgid.link/20260617094622.1846471-1-inasj268@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-29 18:59:47 +01:00
Linus Torvalds
76bf0658d6 regulator: Fixes for v7.2
A couple of unremarkable driver specific fixes that came in during the
 merge window.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmo+eU4ACgkQJNaLcl1U
 h9At2Af/esobd0NX/EF1D19GsDEQYytbDo6ZQ6Gu3mK+nJIGs9R5uwlHkN4otaSV
 P2FmaK1QjolNXLdHT0chO93SspouNlcAoWiGhjzxTJG1dqNGJJSIh5D+iJrivhIN
 hUbld2OxgGxVbcPhl7jDAZGnnoALIFtGe+vWsMw9/Y5GHXCJGcdyKYbvDm5+KqH1
 DUeufn2MmBayQzi48ZEr9+GNEd9tR7cxV8IWVSB40Gf6NPasneoNTXW86dwAkYz0
 sSyRGYJLrfYR/jpVGHRcuc1zX0kYedOdfdDuHcEc89nw/wzfgeN9dLw/z2DOwXnN
 hv3aea4vnhneHFLgg0D8RyDHpkM3Zw==
 =arcc
 -----END PGP SIGNATURE-----

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

Pull regulator fixes from Mark Brown:
 "A couple of unremarkable driver specific fixes that came in during the
  merge window"

* tag 'regulator-fix-v7.2-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: da9121: Use subvariant ids in the I2C table
  regulator: pca9450: Correct default t_off_deb for PCA9451A/PCA9452
2026-06-26 11:07:26 -07:00
Pengpeng Hou
7ddbf1cde4
regulator: da9121: Use subvariant ids in the I2C table
da9121_i2c_probe() stores i2c_get_match_data() in chip->subvariant_id
and da9121_assign_chip_model() switches on DA9121_SUBTYPE_* values.  The
OF table provides those subvariant values, but the I2C id table
currently provides DA9121_TYPE_* values.

Make the I2C id table use the same subvariant namespace as the OF table
so non-DT I2C matches feed the expected data type into the model
assignment code.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260624060024.61300-1-pengpeng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-24 12:56:37 +01:00
Joy Zou
fbef4191b4
regulator: pca9450: Correct default t_off_deb for PCA9451A/PCA9452
The PMIC PCA9451A and PCA9452 have a default power-off debounce time of
2ms according to their datasheet, while PCA9450A and PCA9450BC use 120us.

Add default_t_off_deb field to struct pca9450 to support per-variant
default configuration when the device tree property is not specified.

Datasheet reference links:
- PCA9451A Rev.2.1: https://www.nxp.com/docs/en/data-sheet/PCA9451A.pdf
- PCA9452 Rev.1.0: https://www.nxp.com/docs/en/data-sheet/PCA9452.pdf

Signed-off-by: Joy Zou <joy.zou@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260618-b4-regulator-opt-v1-1-c43b1f62aaf6@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-06-19 18:13:48 +01:00