summaryrefslogtreecommitdiff
path: root/drivers/power
AgeCommit message (Collapse)Author
32 hoursMerge tag 'for-v7.4' of ↵Linus Torvalds
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 LOAD_SWITCH property - pack power_supply_desc to optimize memory - prevent power-supply device unregistration while callback runs - drop last CONFIG_OF build-time dependencies from the core - documentation fixes Power-supply drivers: - bq27xxx: add support for bq27z746, bq28z620 - ab8500: add AB8505 support - bq257xx: fix probe time configuration race condition - multiple: convert drivers with custom LOAD_SWITCH properties to the new standard one - cros_charge-control: restore EC state on resume - qcom_battmgr: fix USB type reporting, notify charger online state, report full batteries and correct capacity on X1E - gpio-charger: always report as discharging if input power is missing - bq24190_charger: don't reset registers across system suspend - qcom_smbx: a lot of independent fixes - lots of error and module removal path fixes - misc fixes Reset drivers - misc fixes" * tag 'for-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (77 commits) power: supply: gpio-charger: Report discharging without input power power: supply: qcom_battmgr: report full batteries power_supply: serialize property access with unregister power: supply: bq257xx: Describe the dev field in the driver data structure power: supply: qcom_battmgr: Notify charger supplies of online changes power: supply: generic-adc-battery: fix status with no supplier power: supply: qcom_battmgr: report the USB type from USB_ADAP_TYPE power: supply: sysfs: Ratelimit "unavailable enum value" warning power: supply: cros_charge-control: restore EC state on resume power: supply: qcom_smbx: set the charge enable after software control power: supply: generic-adc-battery: Propagate charged GPIO errors power: supply: sbs-battery: disable polling before supply teardown power: supply: pf1550: drain IRQ work before unregistering supplies power: supply: bq256xx: Expose VBUS state through extcon power: supply: ab8500_fg: Avoid reserved AB8505 CCConf bit power: supply: ab8500_fg: Finalize current measurements power: supply: ab8500_charger: Recover inactive AB8505 charger power: supply: ab8500_charger: Retry AB8505 USB detection power: supply: ab8500_charger: Skip absent AB8505 main charger power: supply: ab8500_charger: Handle detection errors ...
5 daysMerge tag 'char-misc-7.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull Char/Misc/IIO/others driver updates from Greg KH: "Here is the big set of char/misc/android/iio and other small driver subsystem patches for 7.4-rc1. Loads of stuff in here, larger than normal. Highlights include: - removal of the C binder code, the rust version is stable and will be used going forward in a few billion devices. Great job by those developers - loads and loads of IIO driver updates and feature additions - speakup driver fixes and updates - mhi driver updates - mei driver updates - xillybus driver fixes - comedi driver fixes - lots of coresight driver updates - Interconnect driver updates - nvmem driver updates and fixes - slimbus driver updates and fixes - spmi driver updates and fixes - lots of tiny misc and char driver fixes based on people scanning for things All of these have been in linux-next for a while with no reported issues, other than a merge conflict with one of the rust tree files, which should be simple to resolve" * tag 'char-misc-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (446 commits) rust_binder: wake epoll on self-work queued to poll thread rust_binder: avoid overflow in get_node_debug_info() MAINTAINERS: Add Abel as SPMI co-maintainer spmi: mtk-pmif: Fix clock reference leak in mtk_spmi_bus_probe() iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions iio: adc: qcom-spmi-iadc: Migrate to devm_spmi_subdevice_alloc_and_add() misc: qcom-coincell: Migrate to devm_spmi_subdevice_alloc_and_add() phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add() power: reset: qcom-pon: Migrate to devm_spmi_subdevice_alloc_and_add() nvmem: qcom-spmi-sdam: Migrate to devm_spmi_subdevice_alloc_and_add() spmi: Add helper to get a parent SPMI device spmi: Implement spmi_subdevice_alloc_and_add() and devm variant spmi: Remove unneeded goto in spmi_device_add() error path spmi: Print error status with %pe format spmi: Remove redundant dev_name() print in spmi_device_add() spmi: Fix potential use-after-free by grabbing of_node reference spmi: mtk-pmif: Add workaround for FSM lockup/error in read operation MAINTAINERS: Add Qualcomm SPMI controller entry spmi: pmic-arb: return 0 in spmi_pmic_arb_register_buses() on success comedi: addi_apci_3xxx: fix subdevice count underallocation ...
7 daysMerge tag 'pwrseq-updates-for-v7.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull power sequencing updates from Bartosz Golaszewski: "The bulk of added lines are kunit tests that comprehensively verify the core functionality of the power sequencing framework. Other than that, we have another pwrseq driver: Renesas RZ/G3L Power Ready and support for more models in pwrseq-pcie-m2. We also added a new consumer-facing API in the form of pwrseq_is_controllable() function which allows consumers to check if a given target resource is actually host-controllable. Summary: Power sequencing core: - add a suite of kunit test cases for the power sequencing core functionalities - provide a new consumer API: pwrseq_is_controllable() New Drivers: - add the Renesas RZ/G3L Power Ready driver which provides information on power readiness for various IPs on RZ/G3L Driver changes: - use pwrseq_is_controllable() to report controllability to consumers in pwrseq-qcom-wcn and pwrseq-pcie-m2 - add support for PCIe switch topologies to pwrseq-pcie-m2 - add the PCI ID for Foxconn WCN7850 to pwrseq-pcie-m2" * tag 'pwrseq-updates-for-v7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: power: sequencing: pcie-m2: Add Foxconn WCN7850 subsystem PCI ID power: sequencing: qcom-wcn: Report power controllability power: sequencing: pcie-m2: Report power controllability power: sequencing: Add pwrseq_is_controllable() API power: sequencing: add kunit test cases power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies power: sequencing: Add Renesas RZ/G3L Power Ready driver
12 dayspower: supply: gpio-charger: Report discharging without input powerIgor Velkov
The status property follows only the charge-status GPIO. Without input power a charger such as the BQ24133 releases its open-drain STAT pin, and depending on the board the GPIO then reads as charging. On Kobol Helios64 the board runs from its battery after a mains loss, and the charger reports online 0 with status "Charging". Report "Discharging" whenever the online GPIO is present and inactive. Fixes: df68c44c720a ("power: supply: gpio-charger: Add support for charger status.") Assisted-by: LLM Signed-off-by: Igor Velkov <iav@iav.lv> Link: https://patch.msgid.link/20261018-gpio-charger-offline-v2-1-482795f9e27c@iav.lv Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 daysMerge tag 'spmi-for-next' of ↵Greg Kroah-Hartman
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi into char-misc-next Stephen writes: More than a handful of changes for SPMI. I'm bringing on Abel Vesa to help maintain SPMI so the tree may change in the future but we'll probably continue to send patches when the pile is small. The big change here is that we gained a new function spmi_subdevice_alloc_and_add() to support complex PMICs that have different devices spread throughout the SPMI address. We've grown subdevice drivers that use OF APIs directly to figure out some base address to add to all their register read/write operations which is tightly coupling our parent/child drivers. This change allows us to clean all those drivers up to use standard device APIs and their own regmap instead of relying on a parent SPMI driver to do all the heavy lifting. The series also updated drivers that could use the new API and I picked those all up because they were acked by maintainers. Beyond that we have some minor fixes to the Qualcomm and Mediatek SPMI drivers for bugs in software and hardware and a couple maintainer updates as stated earlier. * tag 'spmi-for-next' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi: MAINTAINERS: Add Abel as SPMI co-maintainer spmi: mtk-pmif: Fix clock reference leak in mtk_spmi_bus_probe() iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions iio: adc: qcom-spmi-iadc: Migrate to devm_spmi_subdevice_alloc_and_add() misc: qcom-coincell: Migrate to devm_spmi_subdevice_alloc_and_add() phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add() power: reset: qcom-pon: Migrate to devm_spmi_subdevice_alloc_and_add() nvmem: qcom-spmi-sdam: Migrate to devm_spmi_subdevice_alloc_and_add() spmi: Add helper to get a parent SPMI device spmi: Implement spmi_subdevice_alloc_and_add() and devm variant spmi: Remove unneeded goto in spmi_device_add() error path spmi: Print error status with %pe format spmi: Remove redundant dev_name() print in spmi_device_add() spmi: Fix potential use-after-free by grabbing of_node reference spmi: mtk-pmif: Add workaround for FSM lockup/error in read operation MAINTAINERS: Add Qualcomm SPMI controller entry spmi: pmic-arb: return 0 in spmi_pmic_arb_register_buses() on success
12 dayspower: supply: qcom_battmgr: report full batteriesBjorn Andersson
The SC8280XP battery-status response has no explicit full state. When a battery reaches its full capacity on external power, neither the charging nor discharging bit is set. The driver consequently reports "Not charging", which can make userspace show the system as battery powered. Use the response's power-online bit and the reported capacity to identify a battery that is full while externally powered. Preserve "Not charging" for a battery whose charging is inhibited below its full capacity. Fixes: 29e8142b5623 ("power: supply: Introduce Qualcomm PMIC GLINK power supply") Assisted-by: LLM Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20261008-battmgr-full-v1-1-4f5485a9c421@oss.qualcomm.com [put variable definition in Reverse-Christmas-tree order] Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 dayspower_supply: serialize property access with unregisterHang Nan
Extend 5b4bd13e0552 ("power: supply: core: prevent unregistering a power supply while a callback runs") fix to also cover the get and set property hooks. This has been tested with a small out-of-tree module registering a supply whose get property function caches its drv_data pointer and then sleeps 300 ms, while the module's main thread calls power_supply_unregister() and then frees that drv_data: unpatched: unregister() returns after 78 us callback then reads drv_data 0x6b6b6b6b (slub poison) => the driver callback read freed memory patched: unregister() returns after 302549 us (the 300 ms callback) callback then reads drv_data 0x12345678 (intact) => power_supply_unregister() waits for the in-flight callback The lock is taken in the wrappers rather than in the helper so that the _direct() variants stay lockless: a caller that has to read its own supply from within a callback uses those, and rwsem read locking is not recursive once a writer is waiting. Fixes: bc1540561c9e ("power_supply: Add API for safe access of power supply function attrs") Fixes: 5b4bd13e0552 ("power: supply: core: prevent unregistering a power supply while a callback runs") Signed-off-by: Hang Nan <2122295973@qq.com> [massively trim down AI commit message and comments] Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 daysMerge power-supply fixes branchSebastian Reichel
Merge power-supply fixes branch to extend the epc_sem unregister fix contained in it from external_power_changed to also cover get/set property. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 dayspower: supply: bq257xx: Describe the dev field in the driver data structureAlexey Charkov
The commit moving the device initialization to the new .init callback missed the description of the newly introduced dev field in the driver data structure - add an entry to the kerneldoc. No code changes. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202610120726.XkN50Smh-lkp@intel.com/ Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20261015-bq257xx-dev-comment-v1-1-c87ee6a3b251@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 dayspower: supply: qcom_battmgr: Notify charger supplies of online changesBrandon Williams
On SC8280XP and X1E80100 the AC, USB and wireless supplies take their online state from the charging source in the battery status response. The firmware sends no notification for those supplies when the charging source changes, and the driver only announces the battery, so userspace never learns that the charger was plugged in or out. UPower keeps the state it read at startup: a laptop booted on the charger never goes on battery. Call power_supply_changed() for a supply whose online state changes when a status response is parsed. A supply that is not registered yet, when the battery is read during probe, reports its state when it registers. Tested on a Microsoft Surface Pro 11 (X1E80100): after restarting UPower on the charger, unplugging now sets OnBattery, and plugging in clears it. Fixes: 29e8142b5623 ("power: supply: Introduce Qualcomm PMIC GLINK power supply") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Brandon Williams <turbine.bmw@gmail.com> Link: https://patch.msgid.link/20261013-upstream-battmgr-charger-online-v1-1-731973e133a0@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 dayspower: supply: generic-adc-battery: fix status with no supplierTim Douglas
power_supply_am_i_supplied() returns -ENODEV when no registered power supply supplies the battery. generic-adc-battery's gab_work() tests this return value as a boolean, so -ENODEV takes the supplied branch and reports CHARGING, or NOT_CHARGING if the charge-finished GPIO is asserted, instead of DISCHARGING. This was noticed while bringing up an out-of-tree Linux port to the WikiReader: the driver reported CHARGING on a device powered by two AAA batteries with no charging hardware. Only a positive return value indicates an online supplier, so treat zero and negative returns as discharging. Fixes: 46cecd130d55 ("power: supply: Fix power_supply_am_i_supplied to return -ENODEV when apropriate") Cc: stable@vger.kernel.org Signed-off-by: Tim Douglas <me@timdoug.com> Link: https://patch.msgid.link/20261013022153.6707-1-me@timdoug.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 dayspower: supply: qcom_battmgr: report the USB type from USB_ADAP_TYPEJoonhoe Kim
On SM8350 and SM8550 class firmware the USB power supply reads its usb_type from the USB_TYPE property. On a Kaanapali (SM8850) tablet that property is 1 (SDP) whatever is plugged in, while USB_ADAP_TYPE reports the adapter, using the same numbering as POWER_SUPPLY_USB_TYPE_*: PC port USB_TYPE 1 USB_ADAP_TYPE 1 (SDP) USB-C dock, 5 V PD USB_TYPE 1 USB_ADAP_TYPE 6 (PD) 65 W PPS charger USB_TYPE 1 USB_ADAP_TYPE 8 (PD_PPS) Qualcomm's downstream qti_battery_charger driver also maps USB_ADAP_TYPE to POWER_SUPPLY_PROP_USB_TYPE. Request USB_ADAP_TYPE for POWER_SUPPLY_PROP_USB_TYPE instead. Tested on a Lenovo Legion Tab Y700 gen 5 (qcom,kaanapali-pmic-glink, which uses the SM8550 path). Only tested on this device; the SM8350 variant shares the property map and was not tested. Fixes: 29e8142b5623 ("power: supply: Introduce Qualcomm PMIC GLINK power supply") Reviewed-by: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com> Assisted-by: LLM Signed-off-by: Joonhoe Kim <26rote@gmail.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20261012130053.442-1-26rote@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 dayspower: supply: sysfs: Ratelimit "unavailable enum value" warningRobert Killick
power_supply_show_enum_with_available() warns every time a driver reports a value that is not in its declared set of available values. For usb_type this happens on every sysfs read and on every uevent, so a driver that reports such a value and calls power_supply_changed() frequently can flood the kernel log. This can happen with drivers that pass a firmware-provided value through unchanged, as qcom_battmgr does for usb_type. On a OnePlus 10 Pro (SM8450), whose firmware reports a vendor-specific usb_type, this produced ~128 warnings per second and kept systemd-journald at ~30% CPU. The bug that causes the bad value needs fixing in the driver itself, but one misbehaving driver should not be able to flood the kernel log. Use dev_warn_ratelimited(), as power_supply_show_property() already does for its own errors, so the problem is still reported, just not on every read. Signed-off-by: Robert Killick <robert@killick.dev> Link: https://patch.msgid.link/20261005-ratelimit-enum-warn-v1-1-b77b48de3c47@killick.dev Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 dayspower: supply: cros_charge-control: restore EC state on resumeAndrew Pam
The EC resets its charge control configuration when the AP powers off, so configured sustainer thresholds and charge behaviour are lost across hibernation. Nothing notices the reset. Commit 4fc88ba435da ("power: supply: cros_charge-control: adopt EC charge state on probe"), in the power-supply tree, made the driver adopt the EC's charge state, but only at probe, and a resume is not a probe. Sysfs therefore keeps reporting the configured values while the EC charges the battery to full. On a Framework Laptop 16 (Ryzen AI 300, charge control command version 3) with charge_control_end_threshold set to 80, a hibernate and resume cycle leaves the attribute still reading 80 while the battery charges past it to 100%. Add a system sleep resume hook that reprograms the EC from the cached state. The same EC behaviour and the same fix already exist for another driver, see commit 2643187ccb86 ("platform/x86: ayaneo-ec: Add suspend hook"). Reprogramming the EC is only strictly required after hibernation, but it is cheap and idempotent, so hook every resume path rather than rely on the EC preserving its state across each kind of sleep transition. Note that re-reading the state from the EC on resume, by reusing cros_chctl_init_state() or otherwise, would be wrong even on the command versions that support GET: the EC has been reset to its defaults by the time the hook runs, so adopting that state would silently discard the configuration the user asked for. The driver's cached state is the only remaining record of it, which is why it is pushed to the EC rather than refreshed from it. Fixes: c6ed48ef5259 ("power: supply: add ChromeOS EC based charge control driver") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Andrew Pam <andrew@fastmailteam.com> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Acked-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20261005043418.243937-1-andrew@fastmailteam.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
12 dayspower: supply: qcom_smbx: set the charge enable after software controlFabricio Akio
The init sequence sets CHARGING_ENABLE_CMD before CHGR_CFG2 selects software control of the charge enable. The Motorola Moto X4's bootloader leaves the charger watchdog armed to disable charging when it bites, which it does after a few minutes in fastboot. Charging then stays disabled in the next boot until the cable is replugged. Setting the command after CHGR_CFG2 re-enables it. Fixes: 8648aeb5d7b7 ("power: supply: add Qualcomm PMI8998 SMB2 Charger driver") Cc: stable@vger.kernel.org Signed-off-by: Fabricio Akio <fabricioakio@gmail.com> Link: https://patch.msgid.link/20261002-qcom-smbx-enable-order-v1-1-7df92bd809db@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
13 daysMerge tag 'pwrseq-fixes-for-v7.3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull power sequencing fix from Bartosz Golaszewski: - with the PCIe code reworked to power the endpoint via pwrctl before it starts the link training, we can now remove the workaround for WLAN power which instead started causing an issue with endpoint enumeration * tag 'pwrseq-fixes-for-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: power: sequencing: qcom-wcn: power off WLAN at probe
13 dayspower: sequencing: pcie-m2: Add Foxconn WCN7850 subsystem PCI IDVal Packett
Add a new device match for the PCI subdev id found on the Dell Latitude 7455 laptop. Fixes: a39ac4651e3b ("power: sequencing: pcie-m2: Match WCN6855 and WCN7851 UART BT variants by subdevice ID") Signed-off-by: Val Packett <val@packett.cool> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20261016051745.577777-1-val@packett.cool Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
13 daysMerge tag 'v7.3-rc7' of ↵Bartosz Golaszewski
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into pwrseq/for-next Linux 7.3-rc7
2026-10-14power: reset: qcom-pon: Migrate to devm_spmi_subdevice_alloc_and_add()AngeloGioacchino Del Regno
Some Qualcomm PMICs integrates a Power On device supporting pwrkey and resin along with the Android reboot reason action identifier. Instead of using the parent SPMI device (the main PMIC) as a kind of syscon in this driver, register a new SPMI sub-device for PON and initialize its own regmap with this sub-device's specific base address, retrieved from the devicetree. This allows to stop manually adding the register base address to every R/W call in this driver, as this can be, and is now, handled by the regmap API instead. Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
2026-10-13Merge tag 'for-v7.3-rc' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply fixes from Sebastian Reichel: "power-supply core: - prevent unregistering a power supply while a callback runs power-supply drivers: - generic-adc-battery: Fix temperature IIO channel conversion - ds2780: Fix ds2780_get_capacity() returning raw value - max17042_battery: Fix vmin assigned instead of vmax in DT parsing - Fix maintenance charge table kernel-doc" * tag 'for-v7.3-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: supply: core: prevent unregistering a power supply while a callback runs power: supply: generic-adc-battery: Fix temperature IIO channel conversion power: supply: ds2780: Fix ds2780_get_capacity() returning raw value power: supply: Fix maintenance charge table kernel-doc power: supply: max17042_battery: Fix vmin assigned instead of vmax in DT parsing
2026-10-12power: supply: generic-adc-battery: Propagate charged GPIO errorsbui duc phuc
devm_gpiod_get_optional() may return an error pointer such as -EPROBE_DEFER, but gab_probe() only checks for NULL. The error pointer is then passed to gpiod_to_irq() and the original error, including -EPROBE_DEFER, is lost. Check the return value and propagate errors from the charged GPIO lookup. Fixes: b0327ffb133f ("power: supply: generic-adc-battery: Use GPIO descriptors") Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20261009112429.33318-1-phucduc.bui@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-12power: sequencing: qcom-wcn: power off WLAN at probeFrançois Roux
The WLAN enable GPIO is requested with GPIOD_ASIS and then kept at its current level, so that a WLAN module left powered on by the firmware is not switched off. The FIXME explains why: toggling it would take the PCIe link down, and the controller driver could not recover from that. That reasoning held while the PCIe link was trained before the sequencer probed. Since commit b921aa3f8dec ("PCI/pwrctrl: Switch to pwrctrl create, power on/off, destroy APIs"), qcom_pcie_host_init() powers the endpoint through pwrctrl before it starts link training, and defers until the pwrctrl driver is bound. That driver cannot bind before this sequencer has probed. Power-on therefore always comes before link training, and keeping the firmware state is now harmful. On the Microsoft Surface Pro 11 (X1E80100), the WCN7850 sits on a PCIe port without a PERST# GPIO. While pci-pwrctrl-pwrseq is not yet bound, the host init is deferred about ten times, and each attempt powers the PHY and controller back down. The later power-on only sets a GPIO that is already high, so the chip is never reset and the link never comes up: qcom-pcie 1c08000.pcie: Device found, but not active The endpoint is not enumerated and ath12k never probes. Bluetooth on the same chip fails too ("QCA Failed to send TLV segment (-110)"). Request the GPIO as GPIOD_OUT_LOW. The chip is then off when the sequencer probes, and pwrctrl powers it up cleanly right before link training. Drop the FIXME and the code that preserved the firmware state. Tested on a Surface Pro 11: - b921aa3f8dec plus a one-line version of this change: endpoint enumerated at 2.4 s, ath12k and Bluetooth working. - next-20260929 plus this patch: "PCIe Gen.3 x2 link up" at 3.4 s, ath12k and Bluetooth working, Wi-Fi connected. Without the change, neither kernel enumerates the endpoint. The culprit was found by bisecting v6.17..v7.1, with the DTB and .config held constant. Fixes: b921aa3f8dec ("PCI/pwrctrl: Switch to pwrctrl create, power on/off, destroy APIs") Closes: https://lore.kernel.org/all/CAPjyS8dY0Q_o3XmFjuKZZsjhzhoSNL+ZGJtw5cQt8HiV3sUtxA@mail.gmail.com/ Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: François Roux <franzelfranzel@gmail.com> Tested-by: Dale Whinham <daleyo@gmail.com> Link: https://patch.msgid.link/20261004165124.4277-1-franzelfranzel@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-10-05power: supply: sbs-battery: disable polling before supply teardownMyeonghun Pak
The managed poll-work cancellation is registered before the power supply, so cleanup unregisters the supply before draining polling. A pending or running poller can then call power_supply_changed() on the released supply. Commit 8d59cf3887fb ("power: supply: sbs-battery: Fix use-after-free in power_supply_changed()") moved the IRQ request after supply registration, but did not change the poll-work cancellation order. Add a later managed action that disables and drains polling before supply teardown. Its retained disabled state prevents external-power callbacks from rearming the poll work after it has been drained. Keep the original autocancel to initialize work before supply callbacks can run and to cover failed supply registration. The teardown ordering issue was found by static analysis. Fixes: 6d0c5de2fd84 ("power: supply: Clean-up few drivers by using managed work init") Cc: stable@vger.kernel.org # 6.10+ Assisted-by: LLM Co-developed-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Link: https://patch.msgid.link/20261004041019.1123723-1-mhun512@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-05power: supply: pf1550: drain IRQ work before unregistering suppliesMyeonghun Pak
The VBUS work calls power_supply_changed(), but its managed cancellation is registered before the supplies. Cleanup can therefore unregister a supply while IRQ-triggered work is still pending. Commit 838767f50747 ("power: supply: pf1550: Fix use-after-free in power_supply_changed()") moved IRQ requests after supply registration, but left work cancellation before the supplies. That change protects the direct IRQ callbacks, while this fix drains the work they queue. Register the three work items after both supplies and before the IRQs. Cleanup then frees the IRQ producers, drains the work, and unregisters the supplies. The teardown ordering issue was found by static analysis. Fixes: 4b6b6433a97d ("power: supply: pf1550: add battery charger support") Cc: stable@vger.kernel.org Assisted-by: LLM Co-developed-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Link: https://patch.msgid.link/20261004043728.1140015-1-mhun512@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: bq256xx: Expose VBUS state through extconReza Kurniawan
Useful for USB controllers needing to sense VBUS state changes. This is needed for devices like Xiaomi Redmi 5A (riva) that doesn't have its VBUS session comparator wired directly to the USB connector pin to automatically enable certain USB functions upon the presence of a USB power input. Signed-off-by: Reza Kurniawan <imkyufie@gmail.com> Link: https://patch.msgid.link/20260912-riva-usb-v2-1-997fe0171ee5@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_fg: Avoid reserved AB8505 CCConf bitLinus Walleij
AB8500 defines CCConf bit 1 as CCDeepSleepEna, but AB8505 reserves bits 7:1 and only defines bit 0, CCPwrUpEna. The fuel-gauge driver currently writes both bits whenever it starts the coulomb counter. The Samsung-GT-S7710-Skomer and related Samsung product trees use the same unconditional value in their fuel-gauge drivers, so they provide no AB8505 workaround to carry over. Select the value from the detected PMIC variant instead, retaining the deep-sleep enable bit on all existing non-AB8505 paths and avoiding the reserved bit on AB8505. Fixes: a982362c1723 ("mfd: Support for the AB8500 AB8505 variant") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-15-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_fg: Finalize current measurementsLinus Walleij
ab8500_fg_inst_curr_start() returns with cc_lock held and the CCEOC IRQ enabled. The bounded sampling loop in the load-compensated voltage path returns without calling ab8500_fg_inst_curr_finalize() when it expires, leaving both resources active. The next fuel-gauge work item then blocks on cc_lock and all cached power-supply values stop updating. The Samsung-GT-I8530-Gavini, Samsung-GT-S7710-Skomer, Samsung-SGH-I407-Kyle and Samsung-SGH-T599-Codina-TMO product trees use a bounded sampling loop in drivers/battery/abb_fuelgauge.c but still call the finalizer. Follow that pattern so the normal completion timeout also performs the required cleanup. Check the start result as well and return an uncompensated voltage if the instantaneous current transaction cannot be started or completed. Fixes: edc400e1632f ("power: supply: ab8500_fg: Break loop for measurement") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-14-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_charger: Recover inactive AB8505 chargerLinus Walleij
UsbChCtrl1.UsbChEna can remain set while UsbChStatus1.UsbChOn is clear. The existing recovery only checks the control bit, so it considers the charger enabled and leaves charging stopped. The Samsung-GT-S7710-Skomer, Samsung-SGH-I407-Kyle, and Samsung-SGH-T599-Codina-TMO product trees are reference points for checking both bits and cycling the charger when they disagree. Extend the USB charger check to detect this AB8505 state and enable the check in the charging algorithm for AB8505. Only cycle the charger when VBUS is debounced and no charger-not-OK, thermal, overvoltage, or watchdog fault accounts for the inactive hardware. Fixes: 4dcdf57773fd ("ab8500-bm: Quick re-attach charging behaviour") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-13-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_charger: Retry AB8505 USB detectionLinus Walleij
AB8505 reports UsbLink1Status state 14 when the USB charger port is not OK. The manual says that software can return the port detector to the detection state by setting the self-clearing ChargerCtrl.DropCountReset bit. The Samsung-GT-S7710-Skomer, Samsung-SGH-I407-Kyle, and Samsung-SGH-T599-Codina-TMO product trees are reference points for a workaround that cycles the USB charger and retries detection three times before rejecting VBUS. Only the Kyle tree writes 1 to DropCountReset; the other two write 0 and therefore do not request the documented reset. Add the same bounded recovery for AB8505, preserving the configured USB charger control bits across each cycle. Keep the charger connected while recovering, then report the fault and disconnect it if all three attempts fail. Leave AB8500 behavior unchanged. Fixes: d4337660d069 ("ab8500-charger: Add AB8505_USB_LINK_STATUS") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-12-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_charger: Skip absent AB8505 main chargerLinus Walleij
AB8505 contains only the USB charger. It has no integrated main charger, main-charger status register, or main-charger interrupts. Avoid reading the missing status register, requesting the five missing interrupts, or disabling an AC charger which was never enabled. This lets the driver bind using only the AB8505 USB charger resources. Fixes: d4337660d069 ("ab8500-charger: Add AB8505_USB_LINK_STATUS") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-11-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_charger: Handle detection errorsLinus Walleij
ab8500_charger_detect_chargers() returns either a charger bitmask or a negative register-access error. The probe and component-bind paths use a negative return value as a bitmask, making failed reads appear as both AC and USB connections. Propagate detection errors and release the bind-time workqueue on failure. Fixes: 84edbeeab67c ("ab8500-charger: AB8500 charger driver") Fixes: 1c1f13a006ed ("power: supply: ab8500: Move to componentized binding") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-10-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_charger: Respect AB8505 register layoutLinus Walleij
Several AB8505 charger fields differ from AB8500. Its long VBUS falling debounce is 300 ms rather than 100 ms, and its VBUS overvoltage selector has a different encoding programmed through OTP. Writing the AB8500 6.3 V value selects 9 V on AB8505. AB8505 revision 3 also defines SwControlFallback as reserved, correcting older documentation which led the driver to support autopower there. Preserve the AB8505 overvoltage setting, wait for its documented debounce, and reject the unsupported autopower setting. Fixes: 0ed5107fa860 ("ab8500-charger: Do not touch VBUSOVV bits") Fixes: b016322293c7 ("ab8500-charger: Add support for autopower on AB8505 and AB9540") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-9-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_charger: Decode AB8505 USB statusLinus Walleij
AB8505 keeps USB link status in the same bit position as AB8500 but defines a different five-bit value table. Reusing the AB8500 enum treats several reserved AB8505 values as chargers and misidentifies the AB8505 charger-fault and DM-high states. Add an AB8505 decoder, reject reserved and non-charging states, and retain conservative current limits for supported charger types. Restrict the invalid-link workaround to AB8500 and stop processing when the status register cannot be read. Fixes: d4337660d069 ("ab8500-charger: Add AB8505_USB_LINK_STATUS") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-8-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_charger: Fix AC charger re-enableLinus Walleij
The AC check-enable callback passes the embedded USB charger object to ab8500_charger_ac_en(). That helper derives the parent with the AC charger offset, so the wrong object yields an invalid ab8500_charger pointer. Pass the AC charger object when re-enabling AC charging. Fixes: bc6e02871402 ("power: supply: ab8500: Standardize CV voltage") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-7-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500: Preserve battery termination currentLinus Walleij
The battery-info parser uses a negative value for an unspecified termination current. Testing the value as a boolean instead replaces every valid positive current from the battery description with 200 mA. Apply the default only when the property is unspecified so batteries retain their described charging termination current. Fixes: 9c20899da46b ("power: supply: ab8500: Standardize termination current") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-6-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_btemp: Fix event temperature reportingLinus Walleij
The event-aware path initializes its local temperature to zero and compares that zero against the thermal thresholds. Consequently some events report the measured temperature after it crosses the event threshold, while others always report the threshold. Start with the measured temperature, clamp it according to the active event, and convert to tenths of a degree only once. This path is used by AB8505 and later variants. Fixes: 1f855824757e ("ab8500-btemp: AB8500 battery temperature driver") Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-5-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_fg: Drop nonexistent AB8505 controlsLinus Walleij
The AB8505 RTC register map has no register at offset 0x15, but the fuel-gauge driver initializes and exposes that offset as a power-cut flag-time control. PcutCtlAndStatus bit 4, exposed as powercut_flag, is reserved as well. Remove both nonexistent controls and their internal configuration field so the driver no longer accesses reserved hardware locations. Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-4-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500: Correct register definitionsLinus Walleij
The charger LED PWM register encodes its duty cycle as (N + 1) / 256. The value for 252/256 is therefore 0xfb, not 0xbf. Both output-current codes 0xe and 0xf select 1.5 A, while 0x3f cannot fit in the four-bit field. Also correct the AB8505 BatCtrl bit 0 current source from 18 uA to 8 uA. Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-3-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_fg: Report sub-percent charge changesLinus Walleij
The fuel gauge updates bat_cap.mah from the coulomb counter but exposes bat_cap.prev_mah through CHARGE_NOW and ENERGY_NOW. It only refreshes prev_mah when the rounded integer capacity percentage changes, making the momentary properties appear frozen between percentage steps. Refresh prev_mah and notify userspace whenever the new charge remains within the currently accepted percentage. If a discharge estimate tries to cross upward into a higher percentage, the existing rejection still leaves both the reported percentage and charge unchanged. The AB8500 fuel-gauge implementations in the Samsung-GT-I8160-Codina, Samsung-GT-I8160_HD-Codina, Samsung-GT-I8530-Gavini, Samsung-GT-S7710-Skomer, Samsung-SGH-I407-Kyle and Samsung-SGH-T599-Codina-TMO product trees retain the same percentage-gated prev_mah update and contain no finer-grained reporting workaround. Fixes: 13151631b5bd ("ab8500-fg: A8500 fuel gauge driver") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-2-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ab8500_fg: Accept status from supplied powerLinus Walleij
Commit dc77721ea4aa ("power: supply: ab8500: Set typing and props") changed the charging algorithm power supply type from battery to unknown so userspace would not mistake it for a second battery. The fuel gauge, however, processes status changes only from battery-type supplies. It therefore never learns that charging started and keeps running its discharge state machine. The power supply relationship already limits the callback to supplies naming the fuel gauge in supplied_to. Accept status from any such supply while retaining the battery type checks for battery-specific properties. The Samsung-GT-I8160-Codina and Samsung-GT-I8160_HD-Codina product trees keep the charging algorithm typed as a battery. The Samsung-GT-I8530-Gavini, Samsung-GT-S7710-Skomer, Samsung-SGH-I407-Kyle and Samsung-SGH-T599-Codina-TMO alternative fuel-gauge drivers instead pass cable state directly. Both approaches preserve the charging state handoff that was lost in mainline. Fixes: dc77721ea4aa ("power: supply: ab8500: Set typing and props") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260916-ab8500-charging-v1-1-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: max17042_battery: Make the fractional macros safeBabanpreet Singh
The fractional LSB macros expand to a plain division, so they only work when multiplied first and evaluate to 0 anywhere else. Take the value as a macro argument and apply it with mult_frac(), which properly handles it. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202606062322.TyvCPB3l-lkp@intel.com/ Assisted-by: LLM Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com> Link: https://patch.msgid.link/20260915052529.7-1-bbnpreetsingh@gmail.com [fixed commit message, dropped useless AI comment] Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: Use %pe to print error pointers symbolicallySumeet Pawnikar
Replace PTR_ERR() and %ld/%li with %pe and pass the original pointer directly to dev_info(), dev_Warn and dev_dbg(). The %pe format specifier prints a symbolic error name (e.g. -ENOMEM) when CONFIG_SYMBOLIC_ERRNAME is enabled, otherwise it falls back gracefully and prints the raw integer value. This makes messages more readable without any functional change. Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com> Link: https://patch.msgid.link/20260912191156.185448-2-sumeet4linux@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: use tabs in power_supply_get_property_directIván Ezequiel Rodriguez
The return statement was indented with spaces; use tabs to match kernel coding style and silence checkpatch. Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com> Link: https://patch.msgid.link/20260831155339.181487-6-ivanrwcm25@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: restore hwmon if extension update failsIván Ezequiel Rodriguez
power_supply_update_sysfs_and_hwmon() removes the existing hwmon group before recreating it. If recreation fails, register_extension() rolled back the extension but left hwmon absent. After tearing down the failed extension, best-effort recreate hwmon so the supply keeps its previous monitoring attributes when possible. Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com> Link: https://patch.msgid.link/20260831155339.181487-3-ivanrwcm25@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: return -ENOMEM on OCV table alloc failureIván Ezequiel Rodriguez
power_supply_get_battery_info() maps a failed kcalloc() for the OCV capacity table to -EINVAL. Return -ENOMEM instead, matching the resistance-temp-table allocation path in the same function. Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com> Link: https://patch.msgid.link/20260831155339.181487-2-ivanrwcm25@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: bq257xx: Convert parameters setup to the new .init callbackAlexey Charkov
Switch the battery parsing and hardware initialization from happening inside the probe routine (after the power supply is registered) to the new .init callback which gets run during the registration, thus avoiding the exposure of a not-yet-fully-configured power supply to the rest of the system. Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260910-bq257xx-init-v3-3-4e219a1a04a5@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: bq257xx: Use psy directly instead of driver dataAlexey Charkov
bq257xx_external_power_changed() is handed the power supply it is called for, but passes pdata->charger to power_supply_am_i_supplied(). Those are not equivalent during probe or teardown, and a supplier's changed_work can reach power_supply_external_power_changed() when pdata->charger doesn't point anywhere meaningful (e.g. freed memory during teardown). Use the psy argument, which is valid whenever the callback runs. Fixes: 1cc017b7f9c7 ("power: supply: bq257xx: Add support for BQ257XX charger") Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260910-bq257xx-init-v3-2-4e219a1a04a5@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: core: prevent unregistering a power supply while a callback runsAlexey Charkov
Once a power supply is registered, its callbacks can immediately start firing from other contexts, such as external_power_changed() triggered by the TCPM stack. If a power supply is unregistered while the callback is still running, the driver data can already be freed when the callback tries to access it, leading to a use-after-free. This happens e.g. when the hardware bus carrying the power supply device malfunctions (e.g. I2C is hogged down by another malfunctioning device) immediately after the power supply is registered, and thus the core is still processing the callbacks which were queued up when the driver starts the removal, leading in some cases to a kernel crash, e.g.: [ 11.645942] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000005 [ 11.646751] Mem abort info: [ 11.647006] ESR = 0x0000000096000004 [ 11.647338] EC = 0x25: DABT (current EL), IL = 32 bits [ 11.647806] SET = 0, FnV = 0 [ 11.648077] EA = 0, S1PTW = 0 [ 11.648356] FSC = 0x04: level 0 translation fault [ 11.648785] Data abort info: [ 11.649041] ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 [ 11.649524] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 11.649981] GCS = 0, Overlay = 0, DirtyBit = 0 [ 11.650390] [0000000000000005] user address but active_mm is swapper [ 11.650955] Internal error: Oops: 0000000096000004 [#1] SMP [ 11.651460] Modules linked in: [ 11.651742] CPU: 1 UID: 0 PID: 144 Comm: kworker/1:2 Not tainted 7.2.0-rc6-g62a9297af2cd #1 PREEMPT [ 11.652553] Hardware name: Flipper One rev. F0B1C2 (DT) [ 11.653024] Workqueue: events power_supply_changed_work [ 11.653511] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 11.654135] pc : __power_supply_is_supplied_by+0x18/0x100 [ 11.654624] lr : __power_supply_am_i_supplied+0x40/0xb8 [ 11.655098] sp : ffff80008192bb30 [ 11.655399] x29: ffff80008192bb30 x28: 0000000000000000 x27: 0000000000000000 [ 11.656049] x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 [ 11.656695] x23: ffff0000c19f4200 x22: ffffdb2232ba4ea8 x21: ffff80008192bc28 [ 11.657344] x20: ffff0000c1eef000 x19: ffff80008192bc18 x18: 00000000a0886e62 [ 11.657991] x17: 000000040044ffff x16: 04500072b5503510 x15: 0000000000000000 [ 11.658639] x14: 0000000000000000 x13: 0000000000000220 x12: 0000000000000000 [ 11.659286] x11: 0000000000000000 x10: ffff0000c1fdb2b0 x9 : ffffdb2232ba5590 [ 11.659934] x8 : 00000000e5b906e6 x7 : ffff0000c2502778 x6 : ffffdb22339793d0 [ 11.660581] x5 : ffff80008192bc18 x4 : ffff0000c19cbca0 x3 : 0000000000000000 [ 11.661228] x2 : ffff0000c1fdaf40 x1 : ffffffffffffffed x0 : ffff0000c1eef000 [ 11.661878] Call trace: [ 11.662103] __power_supply_is_supplied_by+0x18/0x100 (P) [ 11.662596] __power_supply_am_i_supplied+0x40/0xb8 [ 11.663040] psy_for_each_psy_cb+0x20/0x40 [ 11.663416] class_for_each_device+0x110/0x150 [ 11.663825] power_supply_am_i_supplied+0x68/0x100 [ 11.664262] bq257xx_external_power_changed+0x58/0x140 [ 11.664733] __power_supply_changed_work+0x60/0x80 [ 11.665170] psy_for_each_psy_cb+0x20/0x40 [ 11.665545] class_for_each_device+0x110/0x150 [ 11.665953] power_supply_changed_work+0x98/0x1b8 [ 11.666382] process_one_work+0x164/0x4c0 [ 11.666758] worker_thread+0x19c/0x320 [ 11.667104] kthread+0x138/0x150 [ 11.667408] ret_from_fork+0x10/0x20 [ 11.667744] Code: d503233f a9bd7bfd 910003fd a90153f3 (f9400c34) [ 11.668294] ---[ end trace 0000000000000000 ]--- Add a read-write semaphore between external_power_changed() and power_supply_unregister() to prevent the latter from returning (and thus the driver from freeing its data) while the callback is still running. Fixes: bc1540561c9e ("power_supply: Add API for safe access of power supply function attrs") Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260910-bq257xx-init-v3-1-4e219a1a04a5@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: ltc2941: Fix of_node reference leak in ltc294x_i2c_probe()Wentao Liang
ltc294x_i2c_probe() takes a reference on the device node with of_node_get(), but never drops it, so the reference leaks on every return path, including the success path. The node is only used to read the battery properties and to set info->supply_desc.name, so release it after its last use and also on the lltc,resistor-sense error path. Fixes: 085bc24d1553 ("Add LTC2941/LTC2943 Battery Gauge Driver") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20260917142127.2156568-1-vulab@iscas.ac.cn Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-10-04power: supply: bq27xxx: add support for BQ28Z620Alexey Charkov
Match the BQ28Z620 under its own chip ID so that code touching its relocated data flash can tell it apart from the BQ28Z610. Reuse the BQ28Z610 register map and properties, as the standard commands the driver reads are unchanged. Keep the 10 mW scaling of AveragePower() even though the BQ28Z620 TRM lists it in mW: readings on hardware match V * I only in 10 mW units. Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20261002-bq28z620-v1-2-bdcc10d42519@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>