5891 Commits

Author SHA1 Message Date
Linus Torvalds
32a92f8c89 Convert more 'alloc_obj' cases to default GFP_KERNEL arguments
This converts some of the visually simpler cases that have been split
over multiple lines.  I only did the ones that are easy to verify the
resulting diff by having just that final GFP_KERNEL argument on the next
line.

Somebody should probably do a proper coccinelle script for this, but for
me the trivial script actually resulted in an assertion failure in the
middle of the script.  I probably had made it a bit _too_ trivial.

So after fighting that far a while I decided to just do some of the
syntactically simpler cases with variations of the previous 'sed'
scripts.

The more syntactically complex multi-line cases would mostly really want
whitespace cleanup anyway.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21 20:03:00 -08:00
Linus Torvalds
bf4afc53b7 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
This was done entirely with mindless brute force, using

    git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21 17:09:51 -08:00
Kees Cook
69050f8d6d treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook <kees@kernel.org>
2026-02-21 01:02:28 -08:00
Linus Torvalds
4668c4831f Merge tag 'mfd-next-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones:
 "New Support & Features:
   - Add comprehensive support for the ROHM BD72720 PMIC, including core
     MFD, regulator, GPIO, clock gate, RTC, and power-supply drivers
   - Add support for the Rockchip RK801 PMIC, including core MFD and
     regulator drivers
   - Add support for the ROHM BD73900 PMIC by leveraging existing common
     drivers
   - Wire up RTC, hwmon, and input sub-devices for the Apple SMC
     (macsmc) driver
   - Add support for the Delta Networks TN48M switch CPLD via the
     simple-mfd-i2c driver
   - Add support for the TS133 variant to the QNAP MCU driver
   - Provide support for the sama7d65 XLCD controller in the Atmel HLCDC
     driver
   - Add backlight sub-device support to the Congatec Board Controller
     (cgbc)
   - Add Intel Nova Lake-S (NVL-S) PCI IDs to the Intel LPSS driver

  Improvements & Fixes:
   - Implement a "wrapper regmap" for the ROHM BD72720 to handle dual
     I2C slave addresses (0x4b and 0x4c) transparently for child devices
   - Introduce mutex locking around 'mfd_of_node_list' in the MFD core
     to ensure safe concurrent access
   - Fix a potential regulator resource leak in the Arizona core driver
     during boot sequence failures
   - Resolve child device duplication issues on driver rebind for
     Qualcomm PM8xxx and OMAP USB host drivers by using
     of_platform_depopulate()
   - Fix IRQ domain name duplication for the Samsung S2MPG10 by adding a
     unique domain suffix
   - Implement LOCK register handling for the TI TPS65214 variant to
     unlock registers at probe time
   - Fully convert the Loongson-2K BMC driver to use managed resources
     (pcim) and the standard PCI resource API
   - Ensure the Apple SMC mutex is correctly initialized during probe to
     prevent NULL pointer dereferences
   - Expand the ROHM BD71828 power-supply driver to support 9-bit
     register addresses
   - Simplify the Samsung S5M RTC driver by querying platform device IRQ
     resources directly
   - Revert an incorrect read-to-write mask change in the DA9052 SPI
     driver to restore default OTP behavior
   - Fix kernel-doc warnings in the TI TPS6105x driver

- Cleanups & Refactoring
   - Simplify the MFD core by utilizing the scoped
     for_each_child_of_node_scoped() macro and streamlining device_node
     storage
   - Rename ROHM BD71828 IC-specific entities to use consistent prefixes
     for better extensibility
   - Refactor ROHM BD71828 regmap definitions using the
     regmap_reg_range() macro
   - Update the ROHM BD71828 driver to use standard C-style comment
     headers
   - Remove the now unused 'irq_data' field from the Samsung SEC core
     structure
   - Drop unnecessary use of irqd_get_trigger_type() in the Maxim
     MAX77759 driver
   - Default MFD_SPACEMIT_P1 to 'm' if ARCH_SPACEMIT is selected
   - Add missing charger-related registers to the ROHM BD71828 core
     header and Type-C CC registers to the AXP717

  Device Tree Binding Updates:
   - Add new bindings for the ROHM BD72720 PMIC, Rockchip RK801 PMIC,
     Bitmain BM1880 System Controller, and NXP LPC32xx System Control
     Block
   - Clarify trickle-charge terminology and add properties for voltage
     drop (VDR) correction and upper charge limits to the generic
     battery binding
   - Document GPR syscon for NXP S32 SoCs and the smp-memram subnode for
     Aspeed SCU
   - Document numerous new Qualcomm SPMI PMIC compatibles (pmcx0102,
     pmh0101, pmk8850, etc)
   - Add compatibles for the sama7d65 XLCD (Atmel), LAN9691 Flexcom
     (Microchip), and various MediaTek SCPSYS and regulator components
   - Fix a dead link to the audio codec binding in the DA9055
     documentation"

* tag 'mfd-next-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (41 commits)
  dt-bindings: mfd: da9055: Fix dead link to codec binding
  mfd: cgbc: Add support for backlight
  dt-bindings: mfd: qcom,spmi-pmic: Document PMICs present on Glymur and Kaanapali
  dt-bindings: mfd: Document smp-memram subnode for aspeed,ast2x00-scu
  mfd: intel-lpss: Add Intel Nova Lake-S PCI IDs
  mfd: ls2kbmc: Use PCI API instead of direct accesses
  mfd: ls2kbmc: Fully convert to use managed resources
  dt-bindings: mfd: mediatek: mt6397: Add missing MT6331 regulator compat
  dt-bindings: mfd: mediatek,mt8195-scpsys: Add mediatek,mt6795-scpsys
  dt-bindings: mfd: atmel,sama5d2-flexcom: Add microchip,lan9691-flexcom
  mfd: omap-usb-host: Fix OF populate on driver rebind
  mfd: qcom-pm8xxx: Fix OF populate on driver rebind
  dt-bindings: mfd: syscon: Allow syscon compatible for mediatek,mt7981-topmisc
  mfd: qnap-mcu: Add driver data for TS133 variant
  dt-bindings: mfd: qnap,ts433-mcu: Add qnap,ts133-mcu compatible
  mfd: sec: Fix IRQ domain names duplication
  mfd: simple-mfd-i2c: Add Delta TN48M CPLD support
  mfd: macsmc: Initialize mutex
  dt-bindings: mfd: nxp: Add NXP LPC32xx System Control Block
  mfd: Kconfig: Default MFD_SPACEMIT_P1 to 'm' if ARCH_SPACEMIT
  ...
2026-02-16 11:05:44 -08:00
Linus Torvalds
d701782152 Merge tag 'gpio-updates-for-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski:
 "There are two new drivers and some changes to GPIO core but mostly
  just GPIO driver updates across a wide array of files, adding support
  for new models as well as various refactoring changes. Nothing
  controversial and everything has spent a good measure of time in
  linux-next.

  GPIOLIB core:
   - shrink the GPIO bus driver stub code
   - rework software node support for "undefined" software nodes
   - provide and use devm_fwnode_gpiod_get_optional()
   - only compile the OF quirk for MT2701 when needed

  New drivers:
   - add the GPIO driver for ROHM bd72720
   - add the gpio-line-mux driver providing 1-to-many mapping for a
     single real GPIO

  Driver changes:
   - refactor gpio-pca9570: use lock guard, add missing headers, use
     devres consistently
   - add support for a new model (G7 Aspeed sgpiom) to the aspeed-sgpio
     driver along with some prerequisite refactoring
   - use device_get_match_data() where applicable and save some lines
   - add support for more models to gpio-cadence
   - add the compatible property to reset-gpio and use it in shared GPIO
     management
   - drop unnecessary use of irqd_get_trigger_type() in gpio-max77759
   - add support for a new variant to gpio-pca953x
   - extend build coverage with COMPILE_TEST for more drivers
   - constify configfs structures in gpio-sim and gpio-virtuser
   - add support for the K3 SoC to gpio-spacemit
   - implement the missing .get_direction() callback in gpio-max77620
   - add support for Tegra264 to gpio-tegra186
   - drop unneeded MODULE_ALIAS() from gpio-menz127

  DT bindings:
   - document support for the opencores GPIO controller in gpio-mmio
   - document new variants for gpio-pca953x

  Documentation:
   - extensively describe interrupt source detection for gpio-pca953x
     and add more models to the list of supported variants"

* tag 'gpio-updates-for-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (59 commits)
  gpio: tegra186: Add support for Tegra264
  dt-bindings: gpio: Add Tegra264 support
  gpio: spacemit-k1: Use PDR for pin direction, not SDR/CDR
  gpio: max77620: Implement .get_direction() callback
  gpio: aspeed-sgpio: Support G7 Aspeed sgpiom controller
  dt-bindings: gpio: aspeed,sgpio: Support ast2700
  gpio: aspeed-sgpio: Convert IRQ functions to use llops callbacks
  gpio: aspeed-sgpio: Create llops to handle hardware access
  gpio: aspeed-sgpio: Remove unused bank name field
  gpio: aspeed-sgpio: Change the macro to support deferred probe
  regulator: bd71815: switch to devm_fwnode_gpiod_get_optional
  gpiolib: introduce devm_fwnode_gpiod_get_optional() wrapper
  gpio: mmio: Add compatible for opencores GPIO
  dt-bindings: gpio-mmio: Correct opencores GPIO
  gpio: pca9570: use lock guards
  gpio: pca9570: Don't use "proxy" headers
  gpio: pca9570: Use devm_mutex_init() for mutex initialization
  MAINTAINERS: Add ROHM BD72720 PMIC
  power: supply: bd71828-power: Support ROHM BD72720
  power: supply: bd71828: Support wider register addresses
  ...
2026-02-11 10:53:39 -08:00
Petri Karhula
702273a0ea mfd: cgbc: Add support for backlight
The Board Controller has control for display backlight.
Add backlight cell for the cgbc-backlight driver which
adds support for backlight brightness control.

Signed-off-by: Petri Karhula <petri.karhula@novatron.fi>
Reviewed-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://patch.msgid.link/20251205-cgbc-backlight-v6-2-e4175b0bf406@novatron.fi
Signed-off-by: Lee Jones <lee@kernel.org>
2026-02-04 11:07:20 +00:00
André Draszik
3a17ba6557 mfd: sec: Add support for S2MPG11 PMIC via ACPM
Add support for Samsung's S2MPG11 PMIC, which is a Power Management IC
for mobile applications with buck converters, various LDOs, power
meters, NTC thermistor inputs, and additional GPIO interfaces. It
typically complements an S2MPG10 PMIC in a main/sub configuration as
the sub-PMIC.

Like S2MPG10, communication is not via I2C, but via the Samsung ACPM
firmware.

While at it, we can also switch to asynchronous probe, which helps with
probe performance, as the drivers for s2mpg10 and s2mpg11 can probe in
parallel.

Note: The firmware uses the ACPM channel ID and the Speedy channel ID
to select the PMIC address. Since these are firmware properties, they
can not be retrieved from DT, but instead are deducted from the
compatible for now.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260122-s2mpg1x-regulators-v7-9-3b1f9831fffd@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-02-04 10:37:29 +00:00
Ilpo Järvinen
cefd793fa1 mfd: intel-lpss: Add Intel Nova Lake-S PCI IDs
Add Intel Nova Lake-S LPSS PCI IDs.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260113172151.48062-1-ilpo.jarvinen@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:56 +00:00
Andy Shevchenko
9e87c8bff5 mfd: ls2kbmc: Use PCI API instead of direct accesses
There is a PCI API to access device resources. Use it instead of
direct accesses.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://patch.msgid.link/20251030113735.3741913-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:53 +00:00
Andy Shevchenko
e11a9ad380 mfd: ls2kbmc: Fully convert to use managed resources
The mixing of managed and non-managed resources may lead to possible
use-after-free bugs. In this driver the problematic part is the device
functionality that may just have gone behind the functions back, e.g.,
when interrupt is being served. Fix this by switching to managed resources
for PCI.

Fixes: 91a3e1f5453a ("mfd: ls2kbmc: Check for devm_mfd_add_devices() failure")
Fixes: d952bba3fb ("mfd: ls2kbmc: Add Loongson-2K BMC reset function support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://patch.msgid.link/20251030113735.3741913-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:50 +00:00
Johan Hovold
24804ba508 mfd: omap-usb-host: Fix OF populate on driver rebind
Since commit c6e126de43 ("of: Keep track of populated platform
devices") child devices will not be created by of_platform_populate()
if the devices had previously been deregistered individually so that the
OF_POPULATED flag is still set in the corresponding OF nodes.

Switch to using of_platform_depopulate() instead of open coding so that
the child devices are created if the driver is rebound.

Fixes: c6e126de43 ("of: Keep track of populated platform devices")
Cc: stable@vger.kernel.org	# 3.16
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://patch.msgid.link/20251219110714.23919-1-johan@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:40 +00:00
Johan Hovold
27a8acea47 mfd: qcom-pm8xxx: Fix OF populate on driver rebind
Since commit c6e126de43 ("of: Keep track of populated platform
devices") child devices will not be created by of_platform_populate()
if the devices had previously been deregistered individually so that the
OF_POPULATED flag is still set in the corresponding OF nodes.

Switch to using of_platform_depopulate() instead of open coding so that
the child devices are created if the driver is rebound.

Fixes: c6e126de43 ("of: Keep track of populated platform devices")
Cc: stable@vger.kernel.org	# 3.16
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20251219110947.24101-1-johan@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:38 +00:00
Heiko Stuebner
a212772791 mfd: qnap-mcu: Add driver data for TS133 variant
Add the TS133 compatible and affiliated driver data to qnap-mcu.
The TS133 is mostly similar to the TS233/TS433, except only having
one drive and no USB-LED.

The fan pwm-limits from the vendor-configuration also are the same
as for the TS233/TS433 variants.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20260104173310.2685852-3-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:32 +00:00
André Draszik
b60c2dba6d mfd: sec: Fix IRQ domain names duplication
For the S2MPG10 IRQ and chained IRQ, regmap IRQ will try to create a
folder with the same name which is impossible and fails with:

  debugfs: ':firmware:power-management:pmic' already exists in 'domains'

Add domain_suffix to the chained IRQ chip driver to fix it.

Fixes: ee19b52c31 ("mfd: sec: Use chained IRQs for s2mpg10")
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260105-s2mpg10-chained-irq-domain-suffix-v1-1-01ab16204b97@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:26 +00:00
Robert Marko
8f34c1a64c mfd: simple-mfd-i2c: Add Delta TN48M CPLD support
Delta TN48M switches have a Lattice CPLD that serves
multiple purposes including being a GPIO expander.

So, lets use the simple I2C MFD driver to provide the MFD core.

Also add a virtual symbol which pulls in the simple-mfd-i2c driver and
provide a common symbol on which the subdevice drivers can depend on.

Fixes: b3dcb5de62 ("gpio: Add Delta TN48M CPLD GPIO driver")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Link: https://lore.kernel.org/20220131133049.77780-2-robert.marko@sartura.hr
Link: https://lore.kernel.org/linux-gpio/20260112064950.3837737-1-rdunlap@infradead.org/
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260112-mfd-tn48m-v11-1-00c798d8cd2a@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:23 +00:00
Janne Grunau
414f65d673 mfd: macsmc: Initialize mutex
Initialize struct apple_smc's mutex in apple_smc_probe(). Using the
mutex uninitialized surprisingly resulted only in occasional NULL
pointer dereferences in apple_smc_read() calls from the probe()
functions of sub devices.

Cc: stable@vger.kernel.org
Fixes: e038d985c9 ("mfd: Add Apple Silicon System Management Controller")
Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Sven Peter <sven@kernel.org>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Link: https://patch.msgid.link/20251231-macsmc-mutex_init-v2-1-5818c9dc9b29@jannau.net
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:20 +00:00
Troy Mitchell
9d1e2d5f2b mfd: Kconfig: Default MFD_SPACEMIT_P1 to 'm' if ARCH_SPACEMIT
The default value of the P1 sub-device depends on the value
of P1, so P1 should have a default value here.

Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Acked-by: Alex Elder <elder@riscstar.com>
Link: https://patch.msgid.link/20251225-p1-kconfig-fix-v4-2-44b6728117c1@linux.spacemit.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:13 +00:00
Chen-Yu Tsai
f78263a873 mfd: axp20x: AXP717: Add type-C CC registers
The AXP717 has some extra registers related to type-C CC pin
negotiation. They were missing from the original submission.

Add them for completeness.

Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://patch.msgid.link/20251225080241.3153453-1-wens@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:10 +00:00
Krzysztof Kozlowski
7d60a2b8c2 mfd: core: Simplify storing device_node in mfd_match_of_node_to_dev()
of_node_get() returns the same pointer it received and canonical form of
storing device_node is to use of_node_get() in the assignment.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20251224124456.208529-4-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:07 +00:00
Krzysztof Kozlowski
cd18e9af79 mfd: core: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20251224124456.208529-3-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:23:05 +00:00
Kory Maincent (TI.com)
d3fcf276b5 mfd: tps65219: Implement LOCK register handling for TPS65214
The TPS65214 PMIC variant has a LOCK_REG register that prevents writes to
nearly all registers when locked. Unlock the registers at probe time and
leave them unlocked permanently.

This approach is justified because:
- Register locking is very uncommon in typical system operation
- No code path is expected to lock the registers during runtime
- Adding a custom regmap write function would add overhead to every
  register write, including voltage changes triggered by CPU OPP
  transitions from the cpufreq governor which could happen quite
  frequently

Cc: stable@vger.kernel.org
Fixes: 7947219ab1 ("mfd: tps65219: Add support for TI TPS65214 PMIC")
Reviewed-by: Andrew Davis <afd@ti.com>
Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20251218-fix_tps65219-v5-1-8bb511417f3a@bootlin.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:54 +00:00
Ryan Wanner
05995af05b mfd: atmel-hlcdc: Add compatible for sama7d65 XLCD controller
Add compatible for sama7d65 XLCD controller.

Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://patch.msgid.link/20251218040521.463937-2-manikandan.m@microchip.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:51 +00:00
André Draszik
1c378a4c9b mfd: max77759: Drop use of irqd_get_trigger_type
irqd_get_trigger_type() is meant for cases where the driver needs to
know the configured IRQ trigger type and e.g. wants to change its
behaviour accordingly. Furthermore, platform support code, e.g. DT
handling, will configure the hardware based on that, and drivers don't
need to pass the trigger type into request_irq() and friends.

Drop the use from this driver, as it doesn't need to know the trigger
type.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20251217-max77759-mfd-irq-trigger-v1-1-e7d29f84d34f@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:38 +00:00
James Calligeros
0ec4122f00 mfd: macsmc: Wire up Apple SMC input subdevice
Add the new SMC input function to the mfd device

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Link: https://patch.msgid.link/20251215-macsmc-subdevs-v6-5-0518cb5f28ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:35 +00:00
James Calligeros
5dce1c0bff mfd: macsmc: Wire up Apple SMC hwmon subdevice
Add the SMC hwmon functionality to the mfd device

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Link: https://patch.msgid.link/20251215-macsmc-subdevs-v6-3-0518cb5f28ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:32 +00:00
James Calligeros
899c590a25 mfd: macsmc: Wire up Apple SMC RTC subdevice
Add the new SMC RTC function to the mfd device

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Link: https://patch.msgid.link/20251215-macsmc-subdevs-v6-2-0518cb5f28ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:29 +00:00
Haotian Zhang
4feb753ba6 mfd: arizona: Fix regulator resource leak on wm5102_clear_write_sequencer() failure
The wm5102_clear_write_sequencer() helper may return an error
and just return, bypassing the cleanup sequence and causing
regulators to remain enabled, leading to a resource leak.

Change the direct return to jump to the err_reset label to
properly free the resources.

Fixes: 1c1c6bba57 ("mfd: wm5102: Ensure we always boot the device fully")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20251214145804.2037-1-vulab@iscas.ac.cn
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:26 +00:00
Douglas Anderson
20117c92bc mfd: core: Add locking around 'mfd_of_node_list'
Manipulating a list in the kernel isn't safe without some sort of
mutual exclusion. Add a mutex any time we access / modify
'mfd_of_node_list' to prevent possible crashes.

Cc: stable@vger.kernel.org
Fixes: 466a62d764 ("mfd: core: Make a best effort attempt to match devices with the correct of_nodes")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patch.msgid.link/20251210113002.1.I6ceaca2cfb7eb25737012b166671f516696be4fd@changeid
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:22 +00:00
Geert Uytterhoeven
360bc3ae0d mfd: core: Improve compile coverage of mfd_match_of_node_to_dev()
As of commit c7fe3bbfd6 ('mfd: core: Use of_property_read_reg() to
parse "reg"'), all code in mfd_match_of_node_to_dev() compiles fine when
CONFIG_OF is disabled.  As the sole caller of this function is
protected by IS_ENABLED(CONFIG_OF), the #ifdef inside the function can
be removed to increase build coverage, without impacting code size.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/7b9a4a355c5da3fe812ead663285d05b64b84857.1764320964.git.geert+renesas@glider.be
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:17 +00:00
Marcus Folkesson
12daa9c195 Revert "mfd: da9052-spi: Change read-mask to write-mask"
This reverts commit 2e3378f6c7.

Almost every register in this chip can be customized via OTP
memory. Somehow the value for R19, which decide if the flag is set
on read or write operation, seems to have been overwritten for the chip
the original patch were written for.

Revert the change to follow the default behavior.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Link: https://patch.msgid.link/20251124-da9052-revert-v1-1-fbeb2c894002@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-22 14:22:11 +00:00
Lee Jones
70ef762fa8 Merge branches 'ib-mfd-clk-gpio-power-regulator-rtc-6.20', 'ib-mfd-regulator-6.20' and 'ib-mfd-rtc-6.20' into ibs-for-mfd-merged 2026-01-22 14:21:19 +00:00
André Draszik
b31583a1a9 mfd: sec: Drop now unused struct sec_pmic_dev::irq_data
This was used only to allow the s5m RTC driver to deal with the alarm
IRQ. That driver now uses a different approach to acquire that IRQ, and
::irq_data doesn't need to be kept around anymore.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260113-s5m-alarm-v3-3-855a19db1277@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-20 15:37:48 +00:00
André Draszik
153ae5c52b mfd: sec: Add rtc alarm IRQ as platform device resource
By adding the RTC alarm IRQ to the MFD cell as a resource, the child
driver (rtc) can simply query that IRQ, instead of having a lookup
table itself.

This change therefore allows the child driver to be simplified with
regards to determining the alarm IRQ.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260113-s5m-alarm-v3-1-855a19db1277@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-20 15:36:52 +00:00
Joseph Chen
156442eb6e mfd: rk8xx: Add RK801 support
The RK801 is a Power Management IC (PMIC) for multimedia
and handheld devices. It contains the following components:

- 4 BUCK
- 2 LDO
- 1 SWITCH

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Link: https://patch.msgid.link/20260112124351.17707-3-chenjh@rock-chips.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-20 14:57:41 +00:00
Matti Vaittinen
af25277b1d mfd: rohm-bd71828: Support ROHM BD72720
The ROHM BD72720 is a power management IC which continues the BD71828
family of PMICs. Similarly to the BD71815 and BD71828, the BD72720
integrates regulators, charger, RTC, clock gate and GPIOs.

The main difference to the earlier PMICs is that the BD72720 has two
different I2C slave addresses. In addition to the registers behind the
'main I2C address', most of the charger (and to some extent LED) control
is done via registers behind a 'secondary I2C slave address', 0x4c.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/c7b3f1b25616a0add21cea38019e50a89873b6ac.1765804226.git.mazziesaccount@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-13 12:47:28 +00:00
Matti Vaittinen
ea68063460 mfd: rohm-bd71828: Use standard file header format
The MFD subsystem uses C-style comments also in the 'file header'
section. Switch to this for the sake of the consistency. The header
content is not changed.

Suggested-by: Lee Jones <lee@kernel.org>
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/3cc6176eee16a7edc75c94d967a1de67be400e97.1765804226.git.mazziesaccount@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-13 12:46:54 +00:00
Matti Vaittinen
016e95b147 mfd: rohm-bd71828: Use regmap_reg_range()
The regmap range tables tend to be somewhat verbose. Using the
regmap_reg_range() can make the definitions slightly mode compact.

Tidy the regmap range tables by using the regmap_reg_range().

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/49607e65ca117b096a50c5784b760bf62553e29a.1765804226.git.mazziesaccount@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-13 12:45:25 +00:00
Linus Torvalds
980190a947 Merge tag 'mfd-next-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones:
 "Updates:
   - Add Core, Regulator, Onkey and Battery Charger support for the NXP
     PF1550 Power Management IC (PMIC)
   - Introduce __SMC_KEY macro to fix GCC 15.2.1 errors in macsmc
   - Add board definitions for TQMxCU1-HPCM and TQMxCU2-HPCM to the
     tqmx86 driver
   - Add support for Broadcom BCM2712 SoC to the bcm2835-pm driver
   - Hook up the qnap-mcu-eeprom sub-device to qnap-mcu

  Fixes:
   - Enable compile testing for the Altera SOCFPGA System Manager driver
   - Fix device reference leak in altr_sysmgr_regmap_lookup_by_phandle()
   - Reserve the unused second I2C address for DA9063 to prevent
     userspace interference
   - Fix resource leak in da9055_device_init() by calling
     regmap_del_irq_chip() in the error path
   - Fix potential IRQ chip conflict when probing multiple MAX77620
     devices by using devm_kmemdup for regmap_irq_chip
   - Return -EPROBE_DEFER when a syscon devuice is not found to allow
     deferred probing
   - Update email address for the PF1550 PMIC driver in MAINTAINERS
   - Correct file entry for PF1550 MFD driver in MAINTAINERS from
     pfd1550.h to pf1550.h
   - Calculate checksum on the actual number of received bytes in
     qnap-mcu for error messages
   - Use -EPROTO instead of -EIO for checksum errors in qnap-mcu
   - Add proper error handling for command errors (e.g., "@8", "@9") in
     qnap-mcu
   - Fix missing irq_domain_remove() in error path of
     mt63{58,97}_irq_init()

  Cleanups:
   - Mark SMC write buffer arguments as const in apple_smc_write(),
     apple_smc_rw(), and apple_smc_write_atomic()
   - Simplify the error handling path in da9055_device_init() by
     removing a redundant mfd_remove_devices() call
   - Use regmap_reg_range() and a real one-element array for
     pmic_status_range in rohm-bd718x7 for cleaner initialization
   - Remove select I2C_K1 from MFD_SPACEMIT_P1 to avoid build failures
     when I2C_K1's dependencies are disabled
   - Remove unneeded semicolon from ls2k_bmc_recover_pci_data()
   - Drop OF dependency for MFD_MAX5970 in Kconfig to allow wider
     compile testing and non-OF systems
   - Make OF ID table style consistent in simple-mfd-i2c driver
   - Update header inclusions in simple-mfd-i2c to follow IWYU (Include
     What You Use) principle
   - Move checksum verification logic to a separate function in qnap-mcu
   - Use chained IRQs for S2MPG10 in the Samsung SEC driver to simplify
     interrupt handling
   - Drop a stray semicolon from sec-irq.c

  Removals:
   - Remove the unused TI WL1273 FM radio core driver
   - Remove the unused wl1273-core.h header and tidy up its reference in
     documentation

  Device tree bindings:
   - Add Device Tree binding for the NXP PF1550 PMIC
   - Add missing GPIO pins and supply properties to the Silergy SY7636A
     PMIC binding
   - Add interrupt-controller property to the Maxim MAX77705 binding for
     sub-device interrupt source determination
   - Add Device Tree binding for the Renesas R2A11302FT PMIC
   - Allow the wakeup-source property in the Dialog DA9063 binding
   - Make interrupt-related properties optional in the TI TPS65910 PMIC
     binding
   - Document the Qualcomm PMIV0104 PMIC compatible string
   - Document the Qualcomm PM7550 PMIC compatible string
   - Enable power button subnode for TWL603x in the TI TWL binding
   - Convert the Dialog DA9052/53 I2C binding from .txt to .yaml format,
     including compatible string fallback and interrupt properties
   - Document control-scb and sysreg-scb syscons on pic64gx with
     fallback compatibles
   - Document sama7g5-sfrbu and sama7d65-sfrbu syscons with fallback to
     atmel,sama5d2-sfrbu
   - Fix LEDs node schema in fsl,mc13xxx binding by adding led@ child
     nodes and missing properties
   - Add mt7981-topmisc compatible string to the syscon binding"

* tag 'mfd-next-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (42 commits)
  mfd: sec: Drop a stray semicolon
  mfd: qnap-mcu: Hook up the EEPROM sub-device
  dt-bindings: mfd: syscon: Add mt7981-topmisc
  dt-bindings: mfd: fsl,mc13xxx: Fix LEDs node schema
  mfd: mt6358-irq: Fix missing irq_domain_remove() in error path
  mfd: mt6397-irq: Fix missing irq_domain_remove() in error path
  dt-bindings: mfd: Document syscons falling back to atmel,sama5d2-sfrbu
  dt-bindings: mfd: Document control-scb and sysreg-scb on pic64gx
  dt-bindings: mfd: Convert dlg,da9052-i2c.txt to yaml format
  mfd: sec: Use chained IRQs for s2mpg10
  mfd: qnap-mcu: Add proper error handling for command errors
  mfd: qnap-mcu: Move checksum verification to its own function
  mfd: qnap-mcu: Use EPROTO in stead of EIO on checksum errors
  mfd: qnap-mcu: Calculate the checksum on the actual number of bytes received
  mfd: simple-mfd-i2c: Don't use "proxy" headers
  mfd: simple-mfd-i2c: Make ID table style consistent
  mfd: Kconfig: Drop OF dependency on MFD_MAX5970
  mfd: ls2kbmc: Remove unneeded semicolon from ls2k_bmc_recover_pci_data()
  dt-bindings: mfd: twl: Enable power button also for TWL603X
  MAINTAINERS: Adjust file entry in NXP PF1550 PMIC MFD DRIVER
  ...
2025-12-04 15:18:33 -08:00
Mark Brown
c67bb84434 regulator: Use container_of_const() when all types are
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>:

Use container_of_const(), which is preferred over container_of(), when
the argument 'ptr' and returned pointer are already const, for better
code safety and readability.

Some drivers already have const everywhere, so container_of_const can be
directly used. In few other drivers, the final pointer can be constified
that way.
2025-11-26 21:21:57 +00:00
André Draszik
44c603f35c mfd: sec: Drop a stray semicolon
A stray and unneeded semicolon was added here by accident, just drop
it.

Fixes: ee19b52c31 ("mfd: sec: Use chained IRQs for s2mpg10")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202511230909.zk7EkTnb-lkp@intel.com/
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://patch.msgid.link/20251124-s2mpg10-chained-irq-semicolon-v1-1-578ba2d7adca@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-25 13:50:45 +00:00
Heiko Stuebner
0e056211b8 mfd: qnap-mcu: Hook up the EEPROM sub-device
Add the qnap-mcu-eeprom platform-driver as sub-device for the MCU.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20251103232942.410386-3-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-21 12:08:25 +00:00
Haotian Zhang
384bd58bf7 mfd: mt6358-irq: Fix missing irq_domain_remove() in error path
If devm_request_threaded_irq() fails after irq_domain_add_linear()
succeeds in mt6358_irq_init(), the function returns without removing
the created IRQ domain, leading to a resource leak.

Call irq_domain_remove() in the error path after a successful
irq_domain_add_linear() to properly release the IRQ domain.

Fixes: 2b91c28f2a ("mfd: Add support for the MediaTek MT6358 PMIC")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251118121427.583-1-vulab@iscas.ac.cn
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-20 14:24:03 +00:00
Haotian Zhang
b4b1bd1f33 mfd: mt6397-irq: Fix missing irq_domain_remove() in error path
If devm_request_threaded_irq() fails after irq_domain_create_linear()
succeeds in mt6397_irq_init(), the function returns without removing
the created IRQ domain, leading to a resource leak.

Call irq_domain_remove() in the error path after a successful
irq_domain_create_linear() to properly release the IRQ domain.

Fixes: a4872e80ce ("mfd: mt6397: Extract IRQ related code from core driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251118121500.605-1-vulab@iscas.ac.cn
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-20 14:22:36 +00:00
André Draszik
ee19b52c31 mfd: sec: Use chained IRQs for s2mpg10
On S2MPG10 (and similar like S2MPG11), top-level interrupt status and
mask registers exist which need to be unmasked to get the PMIC
interrupts. This additional status doesn't seem to exist on other PMICs
in the S2MP* family, and the S2MPG10 driver is manually dealing with
masking and unmasking currently.

The correct approach here is to register this hierarchy as chained
interrupts, though, without any additional manual steps. Doing so will
also simplify addition of other, similar, PMICs (like S2MPG11) in the
future.

Update the driver to do just that.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20251114-s2mpg10-chained-irq-v1-1-34ddfa49c4cd@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-20 10:29:20 +00:00
Heiko Stuebner
56c1245d51 mfd: qnap-mcu: Add proper error handling for command errors
Further investigation revealed that the MCU in QNAP devices may return
two error states. One "@8" for a checksum error in the submitted command
and one "@9" for any generic (and sadly unspecified) error.

These error codes with 2 data character can of course also be shorter
then the expected reply length for the submitted command, so we'll
need to check the received data for error codes and exit the receive
portion early in that case.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20251113165218.449616-5-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-20 10:14:07 +00:00
Heiko Stuebner
c3223f5625 mfd: qnap-mcu: Move checksum verification to its own function
We'll need the checksum check in a second place in the future, so
move the verification code to a separate function.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20251113165218.449616-4-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-20 10:14:07 +00:00
Heiko Stuebner
c94fce30e1 mfd: qnap-mcu: Use EPROTO in stead of EIO on checksum errors
EPROTO stands for protocol error and a lot of driver already use it
to designate errors in the sent or received data from a peripheral.

So use it in the qnap-mcu as well for checksum errors.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20251113165218.449616-3-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-20 10:14:06 +00:00
Heiko Stuebner
b4881070a0 mfd: qnap-mcu: Calculate the checksum on the actual number of bytes received
In the case of an error message, the number of received bytes can be
less than originally expected but still contain a valid message.

If the transfer itself ended in an error we would exit earlier already.

So calculate the checksum on the number of received bytes and not the
number of expected bytes.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20251113165218.449616-2-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-20 10:14:06 +00:00
Andy Shevchenko
46bddb5fbe mfd: simple-mfd-i2c: Don't use "proxy" headers
Update header inclusions to follow IWYU (Include What You Use) principle.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20251111111930.796837-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-19 16:05:16 +00:00
Andy Shevchenko
81d2cc9272 mfd: simple-mfd-i2c: Make ID table style consistent
The lines in the OF ID table are written in three different styles.
Choose the most common in the kernel and update accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20251111111930.796837-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-19 16:05:07 +00:00