3483 Commits

Author SHA1 Message Date
Linus Torvalds
208eed95fc Merge tag 'soc-drivers-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
Pull SoC driver updates from Arnd Bergmann:
 "This is the first half of the driver changes:

   - A treewide interface change to the "syscore" operations for power
     management, as a preparation for future Tegra specific changes

   - Reset controller updates with added drivers for LAN969x, eic770 and
     RZ/G3S SoCs

   - Protection of system controller registers on Renesas and Google
     SoCs, to prevent trivially triggering a system crash from e.g.
     debugfs access

   - soc_device identification updates on Nvidia, Exynos and Mediatek

   - debugfs support in the ST STM32 firewall driver

   - Minor updates for SoC drivers on AMD/Xilinx, Renesas, Allwinner, TI

   - Cleanups for memory controller support on Nvidia and Renesas"

* tag 'soc-drivers-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (114 commits)
  memory: tegra186-emc: Fix missing put_bpmp
  Documentation: reset: Remove reset_controller_add_lookup()
  reset: fix BIT macro reference
  reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe
  reset: th1520: Support reset controllers in more subsystems
  reset: th1520: Prepare for supporting multiple controllers
  dt-bindings: reset: thead,th1520-reset: Add controllers for more subsys
  dt-bindings: reset: thead,th1520-reset: Remove non-VO-subsystem resets
  reset: remove legacy reset lookup code
  clk: davinci: psc: drop unused reset lookup
  reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S SoC
  reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY
  dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support
  reset: eswin: Add eic7700 reset driver
  dt-bindings: reset: eswin: Documentation for eic7700 SoC
  reset: sparx5: add LAN969x support
  dt-bindings: reset: microchip: Add LAN969x support
  soc: rockchip: grf: Add select correct PWM implementation on RK3368
  soc/tegra: pmc: Add USB wake events for Tegra234
  amba: tegra-ahb: Fix device leak on SMMU enable
  ...
2025-12-05 17:29:04 -08:00
Linus Torvalds
b0206c4eb6 Merge tag 'for-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel:
  "Power-supply core:
   - documentation fixes

  power-supply drivers:
   - add BD71828 charger driver
   - add Richtek RT9756 driver
   - max77705: add adaptive input current support
   - max77705: add support for multiple devices
   - misc small fixes

  reset drivers:
   - add spacemit-p1 poweroff/reboot driver"

* tag 'for-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  Revert "power: supply: qcom_battmgr: support disabling charge control"
  Documentation: power: rt9756: Document exported sysfs entries
  power: supply: rt9756: Add Richtek RT9756 smart cap divider charger
  dt-bindings: power: supply: Add Richtek RT9756 smart cap divider charger
  driver: reset: spacemit-p1: add driver for poweroff/reboot
  power: supply: apm_power: only unset own apm_get_power_status
  power: supply: use ktime_divns() to avoid 64-bit division
  docs: power: clean up power_supply_class.rst
  power: supply: qcom_battmgr: support disabling charge control
  power: supply: qcom_battmgr: clamp charge control thresholds
  power: supply: wm831x: Check wm831x_set_bits() return value
  power: supply: rt9467: Prevent using uninitialized local variable in rt9467_set_value_from_ranges()
  power: supply: rt9467: Return error on failure in rt9467_set_value_from_ranges()
  power: supply: max17040: Check iio_read_channel_processed() return code
  power: supply: cw2015: Check devm_delayed_work_autocancel() return code
  power: supply: rt5033_charger: Fix device node reference leaks
  power: supply: max77705: Fix potential IRQ chip conflict when probing two devices
  power: supply: max77705_charger: implement aicl feature
  MAINTAINERS: Add entry for BD71828 charger
  power: supply: Add bd718(15/28/78) charger driver
2025-12-04 16:12:03 -08:00
Linus Torvalds
0a9431fa74 Merge tag 'regulator-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown:
 "This is a relatively busy release for the regulator API, as well as a
  good collection of new drivers we've got a little bit of core work and
  a bunch of cleanup throughout the subsystem:

   - Support for propagating undervoltage events to child regulators

   - Undo enables done on supplies when setting enabling regulators via
     constraints fails

   - Pull in some gpiolib changes adding support for shared GPIOs to the
     gpiolib core, using them to replace the open coded variant of this
     that we've had in the regulator API for a long time

   - Support for Fitipower FP9931 and JD9330, Mediatek MT6316, MT6363
     and MT6373, NXP PF1550 and Qualcomm PMH01XX and PMCX0102

  The PF1550 support was originally going to go via the MFD tree but
  Krzysztof's cleanup work overlapped with it so I pulled in Lee's
  signed tag with support for the device"

* tag 'regulator-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (50 commits)
  regulator: fp9931: Fix spelling mistake "failid" -> "failed"
  regulator: core: Protect regulator_supply_alias_list with regulator_list_mutex
  regulator: pf9453: Constify pointers to 'regulator_desc' wrap struct
  regulator: pca9450: Constify pointers to 'regulator_desc' wrap struct
  regulator: mt6358: Constify pointers to 'regulator_desc' wrap struct
  regulator: bd96801: Constify pointers to 'regulator_desc' wrap struct
  regulator: bd718x7: Constify pointers to 'regulator_desc' wrap struct
  regulator: bd71828: Constify pointers to 'regulator_desc' wrap struct
  regulator: bd71815: Constify pointers to 'regulator_desc' wrap struct
  regulator: Use container_of_const() when all types are const
  regulator: pca9450: Fix error code in probe()
  regulator: qcomm-labibb: replace use of system_wq with system_dfl_wq
  regulator: Add FP9931/JD9930 driver
  dt-bindings: regulator: Add Fitipower FP9931/JD9930
  dt-bindings: vendor-prefixes: Add Fitipower
  regulator: make the subsystem aware of shared GPIOs
  regulator: renesas-usb-vbus-regulator: Remove unused headers
  regulator: pca9450: Add support for setting debounce settings
  regulator: dt-bindings: pca9540: add debounce timer configuration
  regulator: core: disable supply if enabling main regulator fails
  ...
2025-12-04 11:20:29 -08:00
Linus Torvalds
ad8cccc248 Fix Intel Dollar Cove TI battery driver 32-bit build error
The driver is doing a 64-bit divide, rather than using the proper
helpers, causing link errors on i386 allyesconfig builds:

  x86_64-linux-ld: drivers/power/supply/intel_dc_ti_battery.o: in function `dc_ti_battery_get_voltage_and_current_now':
  intel_dc_ti_battery.c:(.text+0x5c): undefined reference to `__udivdi3'
  x86_64-linux-ld: intel_dc_ti_battery.c:(.text+0x96): undefined reference to `__udivdi3'

and while fixing that, fix the double rounding: keep the timing
difference in nanoseconds ('ktime'), and then just convert to usecs at
the end.

Not because the timing precision is likely to matter, but because doing
it right also makes the code simpler.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Hans de Goede <hansg@kernel.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2025-11-26 12:31:48 -08:00
Thierry Reding
a97fbc3ee3 syscore: Pass context data to callbacks
Several drivers can benefit from registering per-instance data along
with the syscore operations. To achieve this, move the modifiable fields
out of the syscore_ops structure and into a separate struct syscore that
can be registered with the framework. Add a void * driver data field for
drivers to store contextual data that will be passed to the syscore ops.

Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2025-11-14 10:01:52 +01:00
Sebastian Reichel
8e8856396b Revert "power: supply: qcom_battmgr: support disabling charge control"
The charge control disabling does not work as expected and needs
more time to be figured out correctly. Drop this feature for now.

Reported-by: Val Packett <val@packett.cool>
Closes: https://lore.kernel.org/all/8f003bfb-8279-4c65-a271-c1e4a029043d@packett.cool/
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 15:32:47 +01:00
ChiYuan Huang
b6f0796d43 power: supply: rt9756: Add Richtek RT9756 smart cap divider charger
Add support for RT9756 smart cap divider charger.

The RT9759 is a high efficiency and high charge current charger. The
maximum charge current is up to 8A. It integrates a dual-phase charge
pump core with ADC monitoring.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://patch.msgid.link/f682812069b6be2138bfdae2ff9a9c84994d5b64.1761894605.git.cy_huang@richtek.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:44:20 +01:00
Aurelien Jarno
28124cc0fb driver: reset: spacemit-p1: add driver for poweroff/reboot
This driver implements poweroff/reboot support for the SpacemiT P1 PMIC
chip, which is commonly paired with the SpacemiT K1 SoC.

The SpacemiT P1 support is implemented as a MFD driver, so the access is
done directly through the regmap interface. Reboot or poweroff is
triggered by setting a specific bit in a control register, which is
automatically cleared by the hardware afterwards.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Link: https://patch.msgid.link/20251102230352.914421-2-aurelien@aurel32.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:02:10 +01:00
Ahelenia Ziemiańska
bd44ea1291 power: supply: apm_power: only unset own apm_get_power_status
Mirroring drivers/macintosh/apm_emu.c, this means that
  modprobe apm_power && modprobe $anotherdriver && modprobe -r apm_power
leaves $anotherdriver's apm_get_power_status instead of deleting it.

Fixes: 3788ec932b ("[BATTERY] APM emulation driver for class batteries")
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Link: https://patch.msgid.link/xczpgox57hxbunkcbdl5fxhc4gnsajsipldfidi7355afezk64@tarta.nabijaczleweli.xyz
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Michal Kubecek
3fd1695f5d power: supply: use ktime_divns() to avoid 64-bit division
The build of intel_dc_ti_battery module on i386 (32-bit) fails with

ERROR: modpost: "__udivdi3" [drivers/power/supply/intel_dc_ti_battery.ko]

This is caused by 64-bit division of ktime values by NSEC_PER_USEC. Use
ktime_divns() helper which handles the division correctly on 32-bit
architectures.

Fixes: 8c5795fe55 ("power: supply: Add new Intel Dollar Cove TI battery driver")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Hans de Goede <hansg@kernel.org>
Link: https://patch.msgid.link/20251015075957.8F40620057@lion.mk-sys.cz
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Val Packett
446fcf4946 power: supply: qcom_battmgr: support disabling charge control
Existing userspace (in particular, upower) disables charge control by
setting the start threshold to 0 and the stop threshold to 100.

Handle that by actually setting the enable bit to 0 when a start
threshold of 0 was requested.

Fixes: cc3e883a06 ("power: supply: qcom_battmgr: Add charge control support")
Signed-off-by: Val Packett <val@packett.cool>
Link: https://patch.msgid.link/20251012233333.19144-4-val@packett.cool
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Val Packett
8809980fdc power: supply: qcom_battmgr: clamp charge control thresholds
The sysfs API documentation says that drivers "round written values to
the nearest supported value" for charge_control_end_threshold.

Let's do this for both thresholds, as userspace (e.g. upower) generally
does not expect these writes to fail at all.

Fixes: cc3e883a06 ("power: supply: qcom_battmgr: Add charge control support")
Signed-off-by: Val Packett <val@packett.cool>
Link: https://patch.msgid.link/20251012233333.19144-3-val@packett.cool
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Ivan Abramov
ea14bae6df power: supply: wm831x: Check wm831x_set_bits() return value
Since wm831x_set_bits() may return error, log failure and exit from
wm831x_usb_limit_change() in such case.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 626b6cd5f5 ("power: wm831x_power: Support USB charger current limit management")
Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
Link: https://patch.msgid.link/20251009170553.566561-1-i.abramov@mt-integration.ru
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Murad Masimov
15aca30cc6 power: supply: rt9467: Prevent using uninitialized local variable in rt9467_set_value_from_ranges()
There is a typo in rt9467_set_value_from_ranges() that can cause leaving local
variable sel with an undefined value which is then used in regmap_field_write().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 6f7f70e3a8 ("power: supply: rt9467: Add Richtek RT9467 charger driver")
Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
Link: https://patch.msgid.link/20251009145308.1830893-1-m.masimov@mt-integration.ru
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Ivan Abramov
8b27fe2d8d power: supply: rt9467: Return error on failure in rt9467_set_value_from_ranges()
The return value of rt9467_set_value_from_ranges() when setting AICL VTH is
not checked, even though it may fail.

Log error and return from rt9467_run_aicl() on fail.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 6f7f70e3a8 ("power: supply: rt9467: Add Richtek RT9467 charger driver")
Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
Link: https://patch.msgid.link/20251009144725.562278-1-i.abramov@mt-integration.ru
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Ivan Abramov
2c68ac48c5 power: supply: max17040: Check iio_read_channel_processed() return code
Since iio_read_channel_processed() may fail, return its exit code on error.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 814755c48f ("power: max17040: get thermal data from adc if available")
Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
Link: https://patch.msgid.link/20251008133648.559286-1-i.abramov@mt-integration.ru
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Ivan Abramov
92ec7e7b86 power: supply: cw2015: Check devm_delayed_work_autocancel() return code
Since devm_delayed_work_autocancel() may fail, add return code check and
exit cw_bat_probe() on error.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 0cb172a491 ("power: supply: cw2015: Use device managed API to simplify the code")
Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
Link: https://patch.msgid.link/20251008120711.556021-1-i.abramov@mt-integration.ru
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:57 +01:00
Haotian Zhang
6cdc4d488c power: supply: rt5033_charger: Fix device node reference leaks
The device node pointers `np_conn` and `np_edev`, obtained from
of_parse_phandle() and of_get_parent() respectively, are not released.
This results in a reference count leak.

Add of_node_put() calls after the last use of these device nodes to
properly release their references and fix the leaks.

Fixes: 8242336dc8 ("power: supply: rt5033_charger: Add cable detection and USB OTG supply")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20250929113234.1726-1-vulab@iscas.ac.cn
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 01:01:56 +01:00
Krzysztof Kozlowski
1cb053ea2e power: supply: max77705: Fix potential IRQ chip conflict when probing two devices
MAX77705 charger is most likely always a single device on the board,
however nothing stops board designers to have two of them, thus same
device driver could probe twice. Or user could manually try to probing
second time.

Device driver is not ready for that case, because it allocates
statically 'struct regmap_irq_chip' as non-const and stores during
probe in 'irq_drv_data' member a pointer to per-probe state
container ('struct max77705_charger_data').  devm_regmap_add_irq_chip()
does not make a copy of 'struct regmap_irq_chip' but stores the pointer.

Second probe - either successful or failure - would overwrite the
'irq_drv_data' from previous device probe, so interrupts would be
executed in a wrong context.

Fixes: a6a494c8e3 ("power: supply: max77705: Add charger driver for Maxim 77705")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20251023102905.71535-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 00:02:32 +01:00
Dzmitry Sankouski
8ed6b8842c power: supply: max77705_charger: implement aicl feature
Adaptive input current allows charger to reduce it's current
consumption, when source is not able to provide enough power.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Link: https://patch.msgid.link/20250925-max77705_77976_charger_improvement-v6-1-972c716c17d1@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 00:02:30 +01:00
Andreas Kemnade
5bff79dad2 power: supply: Add bd718(15/28/78) charger driver
Add charger driver for ROHM BD718(15/28/78) PMIC charger block.
It is a stripped down version of the driver here:
https://lore.kernel.org/lkml/dbd97c1b0d715aa35a8b4d79741e433d97c562aa.1637061794.git.matti.vaittinen@fi.rohmeurope.com/

For the ease of review and to do a step-by-step approach remove all the
coloumb counter related stuff and do not sneak in BD71827 support. That
also avoids non-trivial rebasing of the above series.

Changes besides that:
Replace the custom property by a standard one and do not use megaohms
for the current sense resistor.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://patch.msgid.link/20250918-bd71828-charger-v5-2-851164839c28@kemnade.info
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-11-03 00:02:04 +01:00
Samuel Kayode
4b6b6433a9 power: supply: pf1550: add battery charger support
Add support for the battery charger for pf1550 PMIC.

Signed-off-by: Samuel Kayode <samuel.kayode@savoirfairelinux.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Link: https://patch.msgid.link/20251001-pf1550-v12-5-a3302aa41687@savoirfairelinux.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-10-21 16:58:55 +01:00
Linus Torvalds
3ee22ad492 Merge tag 'for-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel:
 "Power-supply core:
   - introduce adc-battery-helper for capacity estimation based on
     simple ADC readings of battery voltage and current
   - add new properties for battery internal resistance and state of
     health

  Power-supply drivers:
   - ug3105_battery: convert to adc-battery-helper
   - intel_dc_ti_battery: New driver for Intel Dollar Cove TI batteries
   - rt9467-charger: add voltage and current ADC support
   - sbs-charger: support multiple instances
   - qcom_battmgr:
       - add charge control support
       - add support for state of health and internal resistance
   - max77705_charger:
       - big driver cleanup
       - add support for setting charge current
   - misc minor fixes and cleanups"

* tag 'for-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (38 commits)
  power: supply: qcom_battmgr: handle charging state change notifications
  power: supply: max77705_charger: use REGMAP_IRQ_REG_LINE macro
  power: supply: max77705_charger: rework interrupts
  power: supply: max77705_charger: add writable properties
  power: supply: max77705_charger: return error when config fails
  power: supply: max77705_charger: use regfields for config registers
  power: supply: max77705_charger: refactoring: rename charger to chg
  mfd: max77705: max77705_charger: move active discharge setting to mfd parent
  power: supply: max77976_charger: fix constant current reporting
  power: supply: qcom_battmgr: Add charge control support
  dt-bindings: soc: qcom,pmic-glink: Add charge limit nvmem properties
  power: supply: qcom_battmgr: update compats for SM8550 and X1E80100
  power: supply: qcom_battmgr: Add state_of_health property
  power: supply: qcom_battmgr: Add resistance power supply property
  power: supply: core: Add state_of_health power supply property
  power: supply: core: Add resistance power supply property
  power: supply: rx51: remove redundant condition checks
  dt-bindings: power: supply: bq24190: document charge enable pin
  dt-bindings: power: supply: bq27xxx: document optional interrupt
  power: supply: intel_dc_ti_battery: Drop no longer relevant comment
  ...
2025-10-01 13:02:59 -07:00
Linus Torvalds
b4918003cf Merge tag 'mfd-next-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones:
 "This round of updates contains a fair amount of new device support, a
  couple of fixes and some refactoring. The most notable additions
  include new drivers for Loongson's Security Engine, RNG and TPM, new
  drivers for TI's TPS6594 Power Button and BQ257xx Charger ICs.

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

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

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

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

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

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

* tag 'mfd-next-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (69 commits)
  mfd: simple-mfd-i2c: Add compatible string for LX2160ARDB
  mfd: simple-mfd-i2c: Keep compatible strings in alphabetical order
  dt-bindings: mfd: twl: Add missing sub-nodes for TWL4030 & TWL603x
  dt-bindings: watchdog: Add SMARC-sAM67 support
  dt-bindings: mfd: tps6594: Allow gpio-line-names
  mfd: intel-lpss: Add Intel Wildcat Lake LPSS PCI IDs
  mfd: 88pm886: Add GPADC cell
  mfd: vexpress-sysreg: Use more common syntax for compound literals
  mfd: rz-mtu3: Fix MTU5 NFCR register offset
  mfd: max77705: Setup the core driver as an interrupt controller
  mfd: cs42l43: Remove IRQ masking in suspend
  mfd: cs42l43: Move IRQ enable/disable to encompass force suspend
  mfd: ls2kbmc: Add Loongson-2K BMC reset function support
  mfd: ls2kbmc: Introduce Loongson-2K BMC core driver
  mfd: bd71828, bd71815: Prepare for power-supply support
  dt-bindings: mfd: aspeed: Add AST2700 SCU compatibles
  dt-bindings: mfd: Convert aspeed,ast2400-p2a-ctrl to DT schema
  dt-bindings: mfd: fsl,mc13xxx: Add buttons node
  dt-bindings: mfd: fsl,mc13xxx: Convert txt to DT schema
  mfd: macsmc: Add "apple,t8103-smc" compatible
  ...
2025-10-01 12:04:12 -07:00
Linus Torvalds
e93bcbaa71 Merge tag 'pmdomain-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm
Pull pmdomain updates from Ulf Hansson:

 - amlogic: Add support for S6/S7/S7D power-domains controller

 - imx: Add support for i.MX91 power-domains

 - marvell: Add support for PXA1908 power-domains

 - mediatek:
    - Add support for modem power sequence
    - Add support for RTFF Hardware in MT8196/MT6991

 - qcom: Align power-domain definitions for rpmpd

 - rockchip: Default to use power-domain support

 - thead: Create auxiliary device along with a corresponding reset
   driver

 - ti: Synchronize on/off state with HW-state for ti-sci power-domains

* tag 'pmdomain-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm: (25 commits)
  pmdomain: thead: Fix error pointer vs NULL bug in th1520_pd_reboot_init()
  pmdomain: thead: create auxiliary device for rebooting
  driver: reset: th1520-aon: add driver for poweroff/reboot via AON FW
  pmdomain: mediatek: airoha: convert from round_rate() to determine_rate()
  pmdomain: rockchip: enable ROCKCHIP_PM_DOMAINS with ARCH_ROCKCHIP
  pmdomain: marvell: Add PXA1908 power domains
  dt-bindings: clock: marvell,pxa1908: Add syscon compatible to apmu
  pmdomain: ti-sci: Set PD on/off state according to the HW state
  pmdomain: amlogic: Add support for S6 S7 S7D power domains controller
  dt-bindings: power: add Amlogic S6 S7 S7D power domains
  pmdomain: mediatek: Convert all SoCs to new style regmap retrieval
  pmdomain: mediatek: Add support for RTFF Hardware in MT8196/MT6991
  pmdomain: mediatek: Add support for modem power sequences
  pmdomain: mediatek: Move ctl sequences out of power_on/off functions
  pmdomain: mediatek: Handle SoCs with inverted SRAM power-down bits
  pmdomain: mediatek: Refactor bus protection regmaps retrieval
  dt-bindings: power: mediatek: Document access-controllers property
  pmdomain: remove unneeded 'fast_io' parameter in regmap_config
  pmdomain: imx93-blk-ctrl: mask DSI and PXP PD domain register on i.MX91
  pmdomain: imx93-blk-ctrl: use ARRAY_SIZE() instead of hardcode number
  ...
2025-10-01 11:51:53 -07:00
Icenowy Zheng
2d81a24a74 driver: reset: th1520-aon: add driver for poweroff/reboot via AON FW
This driver implements poweroff/reboot support for T-Head TH1520 SoCs
running the AON firmware by sending a message to the AON firmware's WDG
part.

This is a auxiliary device driver, and expects the AON channel to be
passed via the platform_data of the auxiliary device.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-09-19 12:55:20 +02:00
Fenglin Wu
41307ec7df power: supply: qcom_battmgr: handle charging state change notifications
The X1E80100 battery management firmware sends a notification with
code 0x83 when the battery charging state changes, such as switching
between fast charge, taper charge, end of charge, or any other error
charging states.

The same notification code is used with bit[8] set when charging stops
because the charge control end threshold is reached. Additionally,
a 2-bit value is included in bit[10:9] with the same code to indicate
the charging source capability, which is determined by the calculated
power from voltage and current readings from PDOs: 2 means a strong
charger over 60W, 1 indicates a weak charger, and 0 means there is no
charging source.

These 3-MSB [10:8] in the notification code is not much useful for now,
hence just ignore them and trigger a power supply change event whenever
0x83 notification code is received. This helps to eliminate the unknown
notification error messages.

Reported-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Closes: https://lore.kernel.org/all/r65idyc4of5obo6untebw4iqfj2zteiggnnzabrqtlcinvtddx@xc4aig5abesu/
Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-19 12:35:57 +02:00
Dzmitry Sankouski
bc7d3a0f92 power: supply: max77705_charger: use REGMAP_IRQ_REG_LINE macro
Refactor regmap_irq declarations with REGMAP_IRQ_REG_LINE saves a few
lines on definitions.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-19 00:40:03 +02:00
Dzmitry Sankouski
12a1185a06 power: supply: max77705_charger: rework interrupts
Current implementation uses handle_post_irq to actually handle chgin
irq. This is not how things are meant to work in regmap-irq.

Remove handle_post_irq, and request a threaded interrupt for chgin.

Fixes: a6a494c8e3 ("power: supply: max77705: Add charger driver for Maxim 77705")
Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-19 00:40:03 +02:00
Dzmitry Sankouski
baedd8be70 power: supply: max77705_charger: add writable properties
Add INPUT_CURRENT_LIMIT, CONSTANT_CHARGE_CURRENT properties as writeable
to be able to control input power consumption and charging speed.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-19 00:38:31 +02:00
Dzmitry Sankouski
55af7b9bb6 power: supply: max77705_charger: return error when config fails
Handle error, returned from register writes in init function.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-19 00:37:45 +02:00
Dzmitry Sankouski
ef1e734dbe power: supply: max77705_charger: use regfields for config registers
Using regfields allows to cleanup masks and register offset definition,
allowing to access register info by it's functional name.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-19 00:37:45 +02:00
Dzmitry Sankouski
d84510db8c power: supply: max77705_charger: refactoring: rename charger to chg
Rename struct max77705_charger_data variable to chg for consistency.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-19 00:37:45 +02:00
Sebastian Reichel
a96d68ea0a Merge tag 'ib-max77705-for-v6.17-signed'
Merge immutable branch between power-supply and MFD subsystem to
move the regmap register update from the max77976 charger
sub-device to the main MFD device.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 23:33:28 +02:00
Dzmitry Sankouski
c24928ac69 mfd: max77705: max77705_charger: move active discharge setting to mfd parent
Active discharge setting is a part of MFD top level i2c device, hence
cannot be controlled by charger. Writing to MAX77705_PMIC_REG_MAINCTRL1
register from charger driver is a mistake.

Move active discharge setting to MFD parent driver.

Fixes: a6a494c8e3 ("power: supply: max77705: Add charger driver for Maxim 77705")
Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Acked-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 23:28:12 +02:00
Dzmitry Sankouski
ee6cd8f3e2 power: supply: max77976_charger: fix constant current reporting
CHARGE_CONTROL_LIMIT is a wrong property to report charge current limit,
because `CHARGE_*` attributes represents capacity, not current. The
correct attribute to report and set charge current limit is
CONSTANT_CHARGE_CURRENT.

Rename CHARGE_CONTROL_LIMIT to CONSTANT_CHARGE_CURRENT.

Cc: stable@vger.kernel.org
Fixes: 715ecbc10d ("power: supply: max77976: add Maxim MAX77976 charger driver")
Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 23:26:27 +02:00
Fenglin Wu
cc3e883a06 power: supply: qcom_battmgr: Add charge control support
Add charge control support for SM8550 and X1E80100. It's supported
with below two power supply properties:

charge_control_end_threshold: The battery SoC (State of Charge)
threshold at which the charging should be terminated.

charge_control_start_threshold: The battery SoC threshold at
which the charging should be resumed.

Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on Thinkpad T14S OLED
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 01:01:03 +02:00
Fenglin Wu
b3c0f651b3 power: supply: qcom_battmgr: update compats for SM8550 and X1E80100
The SM8550 and X1E80100 platforms now include charge control
functionality in battery management firmware, allowing charging
to stop when the battery reaches a set level and resume when it
drops below another level. To support this in the qcom_battmgr
driver, CHARGE_CONTROL_START/END_THRESHOLD power supply properties
can be added to manage these levels. This results in the battery
power supply properties for SM8550 and X1E80100 differing from
those for SM8350 and SC8280XP. Therefore, separate compatible
entries for SM8550 and X1E80100 are introduced, each with
their own variant definitions as match data.

Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 01:01:03 +02:00
Fenglin Wu
b8e5030e09 power: supply: qcom_battmgr: Add state_of_health property
Add state_of_health property to read battery health percentage from
battery management firmware.

Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 01:01:03 +02:00
Fenglin Wu
45e57e6a21 power: supply: qcom_battmgr: Add resistance power supply property
Add power supply property to get battery internal resistance from
the battery management firmware.

Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 01:01:03 +02:00
Fenglin Wu
cd93fbdce5 power: supply: core: Add state_of_health power supply property
Add state_of_health power supply property to represent battery
health percentage.

Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 01:01:03 +02:00
Fenglin Wu
d69ae81efb power: supply: core: Add resistance power supply property
Some battery drivers provide the ability to export internal resistance
as a parameter. Add internal_resistance power supply property for that
purpose.

Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 01:01:03 +02:00
Xichao Zhao
1bafaa156e power: supply: rx51: remove redundant condition checks
Remove redundant condition checks and replace else if with else.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-18 01:01:03 +02:00
Hans de Goede
b8cac8c98e power: supply: intel_dc_ti_battery: Drop no longer relevant comment
Drop the comment about not being able to use devm_iio_channel_get().
The code has actually already successfully been switched over to
devm_iio_channel_get(). This is just a no longer applicable left-over
comment, drop it.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-15 17:06:55 +02:00
Chris Morgan
1cc017b7f9 power: supply: bq257xx: Add support for BQ257XX charger
Add support for the charger function of the BQ257XX. The device is
capable of charging batteries with a layout of 1 to 4 cells in
series.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20250904160530.66178-4-macroalpha82@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-11 15:55:17 +01:00
Marco Crivellari
cc2ec444e4 power: supply: WQ_PERCPU added to alloc_workqueue users
Currently if a user enqueue a work item using schedule_delayed_work() the
used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
schedule_work() that is using system_wq and queue_work(), that makes use
again of WORK_CPU_UNBOUND.
This lack of consistentcy cannot be addressed without refactoring the API.

alloc_workqueue() treats all queues as per-CPU by default, while unbound
workqueues must opt-in via WQ_UNBOUND.

This default is suboptimal: most workloads benefit from unbound queues,
allowing the scheduler to place worker threads where they’re needed and
reducing noise when CPUs are isolated.

This default is suboptimal: most workloads benefit from unbound queues,
allowing the scheduler to place worker threads where they’re needed and
reducing noise when CPUs are isolated.

This patch adds a new WQ_PERCPU flag to explicitly request the use of
the per-CPU behavior. Both flags coexist for one release cycle to allow
callers to transition their calls.

Once migration is complete, WQ_UNBOUND can be removed and unbound will
become the implicit default.

With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND),
any alloc_workqueue() caller that doesn’t explicitly specify WQ_UNBOUND
must now use WQ_PERCPU.

All existing users have been updated accordingly.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Link: https://lore.kernel.org/r/20250905090641.106297-3-marco.crivellari@suse.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-09 00:53:46 +02:00
Marco Crivellari
c4a7748b55 power: supply: replace use of system_wq with system_percpu_wq
Currently if a user enqueue a work item using schedule_delayed_work() the
used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
schedule_work() that is using system_wq and queue_work(), that makes use
again of WORK_CPU_UNBOUND.

This lack of consistentcy cannot be addressed without refactoring the API.

system_unbound_wq should be the default workqueue so as not to enforce
locality constraints for random work whenever it's not required.

Adding system_dfl_wq to encourage its use when unbound work should be used.

queue_work() / queue_delayed_work() / mod_delayed_work() will now use the
new unbound wq: whether the user still use the old wq a warn will be
printed along with a wq redirect to the new one.

The old system_unbound_wq will be kept for a few release cycles.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Link: https://lore.kernel.org/r/20250905090641.106297-2-marco.crivellari@suse.com
[rebased patch to cover recent changes]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-09 00:53:12 +02:00
Christophe JAILLET
7d715345a8 power: supply: Use devm_mutex_init()
Use devm_mutex_init() instead of hand-writing it.

This saves some LoC, improves readability and saves some space in the
generated .o file.

As an example:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  35803	   9352	    384	  45539	   b1e3	drivers/power/supply/rt9467-charger.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  34792	   9008	    384	  44184	   ac98	drivers/power/supply/rt9467-charger.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-09 00:36:23 +02:00
Fabien Proriol
3ec6002108 power: supply: sbs-charger: Support multiple devices
If we have 2 instances of sbs-charger in the DTS, the driver probe for the second instance will fail:

[    8.012874] sbs-battery 18-000b: sbs-battery: battery gas gauge device registered
[    8.039094] sbs-charger 18-0009: ltc4100: smart charger device registered
[    8.112911] sbs-battery 20-000b: sbs-battery: battery gas gauge device registered
[    8.134533] sysfs: cannot create duplicate filename '/class/power_supply/sbs-charger'
[    8.143871] CPU: 3 PID: 295 Comm: systemd-udevd Tainted: G           O      5.10.147 #22
[    8.151974] Hardware name: ALE AMB (DT)
[    8.155828] Call trace:
[    8.158292]  dump_backtrace+0x0/0x1d4
[    8.161960]  show_stack+0x18/0x6c
[    8.165280]  dump_stack+0xcc/0x128
[    8.168687]  sysfs_warn_dup+0x60/0x7c
[    8.172353]  sysfs_do_create_link_sd+0xf0/0x100
[    8.176886]  sysfs_create_link+0x20/0x40
[    8.180816]  device_add+0x270/0x7a4
[    8.184311]  __power_supply_register+0x304/0x560
[    8.188930]  devm_power_supply_register+0x54/0xa0
[    8.193644]  sbs_probe+0xc0/0x214 [sbs_charger]
[    8.198183]  i2c_device_probe+0x2dc/0x2f4
[    8.202196]  really_probe+0xf0/0x510
[    8.205774]  driver_probe_device+0xfc/0x160
[    8.209960]  device_driver_attach+0xc0/0xcc
[    8.214146]  __driver_attach+0xc0/0x170
[    8.218002]  bus_for_each_dev+0x74/0xd4
[    8.221862]  driver_attach+0x24/0x30
[    8.225444]  bus_add_driver+0x148/0x250
[    8.229283]  driver_register+0x78/0x130
[    8.233140]  i2c_register_driver+0x4c/0xe0
[    8.237250]  sbs_driver_init+0x20/0x1000 [sbs_charger]
[    8.242424]  do_one_initcall+0x50/0x1b0
[    8.242434]  do_init_module+0x44/0x230
[    8.242438]  load_module+0x2200/0x27c0
[    8.242442]  __do_sys_finit_module+0xa8/0x11c
[    8.242447]  __arm64_sys_finit_module+0x20/0x30
[    8.242457]  el0_svc_common.constprop.0+0x64/0x154
[    8.242464]  do_el0_svc+0x24/0x8c
[    8.242474]  el0_svc+0x10/0x20
[    8.242481]  el0_sync_handler+0x108/0x114
[    8.242485]  el0_sync+0x180/0x1c0
[    8.243847] sbs-charger 20-0009: Failed to register power supply
[    8.287934] sbs-charger: probe of 20-0009 failed with error -17

This is mainly because the "name" field of power_supply_desc is a constant.
This patch fixes the issue by reusing the same approach as sbs-battery.
With this patch, the result is:
[    7.819532] sbs-charger 18-0009: ltc4100: smart charger device registered
[    7.825305] sbs-battery 18-000b: sbs-battery: battery gas gauge device registered
[    7.887423] sbs-battery 20-000b: sbs-battery: battery gas gauge device registered
[    7.893501] sbs-charger 20-0009: ltc4100: smart charger device registered

Signed-off-by: Fabien Proriol <fabien.proriol@viavisolutions.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-08 15:05:33 +02:00
Andy Yan
def5612170 power: supply: cw2015: Fix a alignment coding style issue
Fix the checkpatch warning:
CHECK: Alignment should match open parenthesis

Fixes: 0cb172a491 ("power: supply: cw2015: Use device managed API to simplify the code")
Signed-off-by: Andy Yan <andyshrk@163.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-09-06 23:50:19 +02:00