summaryrefslogtreecommitdiff
path: root/drivers/power
AgeCommit message (Collapse)Author
5 daysMerge tag 'pwrseq-fixes-for-v7.2-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull power sequencing fixes from Bartosz Golaszewski: - fix an ABBA deadlock in pwrseq unregister path - fix a use-after-free bug in pwrseq core - sort PCI device IDs in ascending order in pwrseq-pcie-m2 * tag 'pwrseq-fixes-for-v7.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: power: sequencing: fix ABBA deadlock in pwrseq_device_unregister() power: sequencing: pcie-m2: Sort PCI device IDs in ascending order pwrseq: core: fix use-after-free in pwrseq_debugfs_seq_next()
9 dayspower: sequencing: fix ABBA deadlock in pwrseq_device_unregister()Bartosz Golaszewski
The pwrseq core takes three locks in consistent order everywhere: pwrseq_sem -> pwrseq->rw_lock -> pwrseq->state_lock pwrseq_get() -> pwrseq_match_device() takes pwrseq_sem for reading, then rw_lock for reading. pwrseq_power_on()/pwrseq_power_off() take rw_lock for reading and then state_lock. pwrseq_device_unregister() is the only exception, it takes: state_lock, then rw_lock for writing and finally pwrseq_sem for writing. This created two potential ABBA deadlock situations that sashiko pointed out. - pwrseq_power_on/off() take rw_lock for reading then state_lock, while pwrseq_unregister() takes state_lock then rw_lock for writing - pwrseq_get() takes pwrseq_sem for reading then rw_lock for reading, while pwrseq_unregister() takes rw_lock for writing then pwrseq_sem for writing Reorder the unregister path to taking pwrseq_sem for writing -> rw_lock for writing and drop the state_lock entirely. This is safe as enable_count is only ever written under rw_lock held for read (via pwrseq_unit_enable()/disable(), reached only from pwrseq_power_on/off()), so holding rw_lock for writing already excludes every other writer and reader and the active-users WARN() stays race-free without state_lock. Fixes: 249ebf3f65f8 ("power: sequencing: implement the pwrseq core") Closes: https://sashiko.dev/#/patchset/20260616151049.1705503-1-vulab%40iscas.ac.cn Link: https://patch.msgid.link/20260618-pwrseq-abba-deadlock-v1-1-943a3fd81c06@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
9 dayspower: sequencing: pcie-m2: Sort PCI device IDs in ascending orderWei Deng
Sort the entries in pwrseq_m2_pci_ids[] by device ID in ascending order: 0x1103 (WCN6855) before 0x1107 (WCN7850). Fixes: 2abcfdd91e6a ("power: sequencing: pcie-m2: Add PCI ID 0x1103 for WCN6855 Bluetooth") Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Wei Deng <wei.deng@oss.qualcomm.com> Link: https://patch.msgid.link/20260617143055.820096-1-wei.deng@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
9 dayspwrseq: core: fix use-after-free in pwrseq_debugfs_seq_next()Wentao Liang
pwrseq_debugfs_seq_next() declares 'next' with __free(put_device), which causes put_device() to be called on the returned pointer when the variable goes out of scope. This results in a use-after-free since the seq_file framework receives a pointer whose reference has already been dropped. Simply removing __free(put_device) would fix the UAF but would leak the reference acquired by bus_find_next_device(), as stop() only calls up_read(&pwrseq_sem) and never releases the device reference. Fix this by making the reference counting consistent across all seq_file callbacks, matching the standard pattern used by PCI and SCSI: - start(): use get_device() so it returns a referenced pointer. - next(): explicitly put_device(curr) to release the previous device's reference (no NULL check needed - the seq_file framework only calls next() while the previous return was non-NULL). - stop(): put_device(data) to release the last iterated device's reference, with a NULL guard since stop() may be called with NULL when start() returned NULL or next() reached end-of-sequence. Cc: stable@vger.kernel.org Fixes: 249ebf3f65f8 ("power: sequencing: implement the pwrseq core") Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20260616151049.1705503-1-vulab@iscas.ac.cn Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
11 daysMerge tag 'for-v7.2' 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 drivers: - New EC driver providing battery info for Microsoft Surface RT - New driver for battery charger in Samsung S2M PMICs - Rework max17042 driver - sysfs control for bd71828 auto input current limitation All over: - Use named fields for struct platform_device_id and of_device_id entries - Misc small cleanups and fixes" * tag 'for-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (33 commits) Documentation: ABI: sysfs-class-reboot-mode-reboot_modes: fix doc warnings power: supply: charger-manager: fix refcount leak in is_full_charged() power: supply: core: fix supplied_from allocations power: supply: max17042_battery: Use modern PM ops to clear up warning power: supply: add support for Samsung S2M series PMIC charger device power: supply: Add support for Surface RT battery and charger dt-bindings: embedded-controller: Document Surface RT EC power: supply: bd71828: sysfs for auto input current limitation power: supply: cpcap-charger: include missing <linux/property.h> power: supply: cros_charge-control: Move MODULE_DEVICE_TABLE next to the table itself power: supply: ab8500_fg: Fix typos in comments power: supply: Use named initializers for arrays of i2c_device_data power: supply: Remove unused jz4740-battery.h power: reset: st-poweroff: Use of_device_get_match_data() power: supply: bq257xx: Add fields for 'charging' and 'overvoltage' states power: supply: bq257xx: Consistently use indirect get/set helpers power: supply: bq257xx: Make the default current limit a per-chip attribute power: supply: bq257xx: Fix VSYSMIN clamping logic power: supply: cpcap-battery: Fix missing nvmem_device_put() causing reference leak power: supply: max17042: fix OF node reference imbalance ...
2026-06-16Merge tag 'pwrseq-updates-for-v7.2-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull power sequencing updates from Bartosz Golaszewski: "A set of extensions to the M.2 pwrseq driver allowing it to work with more cards than just the one from Qualcomm we supported initially. There's also a tweak to debugfs output and a new function that will be used by a bluetooth driver in the next cycle. Power Sequencing core: - Add a helper allowing consumers to access the struct device object associated with a pwrseq provider - Print the power sequencing device's parent in debugfs to add more debugging information Driver updates: - Extend/rework the M.2 power sequencing driver in order to allow it to support more M.2 cards, not just WCN7850" * tag 'pwrseq-updates-for-v7.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: power: sequencing: pcie-m2: Add PCI ID 0x1103 for WCN6855 Bluetooth power: sequencing: Add an API to return the pwrseq device's 'dev' pointer power: sequencing: pcie-m2: Create BT node based on the pci_device_id[] table power: sequencing: pcie-m2: Create serdev for PCI devices present before probe power: sequencing: pcie-m2: Improve PCI device ID check power: sequencing: pcie-m2: Allow creating serdev for multiple PCI devices power: sequencing: pcie-m2: Fix inconsistent function prefixes power: sequencing: print power sequencing device parent in debugfs
2026-06-13power: supply: charger-manager: fix refcount leak in is_full_charged()WenTao Liang
In is_full_charged(), power_supply_get_by_name() is called to obtain a reference to the fuel_gauge power supply. If the voltage check (uV >= desc->fullbatt_uV) succeeds, the function returns true directly without releasing the reference, leaking the refcount. Fix this by setting a flag and jumping to the out label where power_supply_put() properly drops the reference. Cc: stable@vger.kernel.org Fixes: e132fc6bb89b ("power: supply: charger-manager: Make decisions focussed on battery status") Signed-off-by: WenTao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20260611005322.53096-1-vulab@iscas.ac.cn Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-12power: supply: core: fix supplied_from allocationsLucas Tsai
If dts property power-supplies has multiple values, then accessing to psy->supplied_from[i-1] in __power_supply_populate_supplied_from will overrun supplied_from array. Fixes: f6e0b081fb30 ("power_supply: Populate supplied_from hierarchy from the device tree") Signed-off-by: Lucas Tsai <lucas_tsai@richtek.com> Link: https://patch.msgid.link/20260609114403.3896073-1-lucas_tsai@richtek.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-08power: sequencing: pcie-m2: Add PCI ID 0x1103 for WCN6855 BluetoothWei Deng
WCN6855 is a Qualcomm Wi-Fi/BT combo chip that uses PCI device ID 0x1103. Add it to pwrseq_m2_pci_ids[] alongside the existing 0x1107 (WCN7850) entry, so that the pwrseq-pcie-m2 driver creates a Bluetooth serdev device for WCN6855 cards inserted into PCIe M.2 Key E connectors. Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Wei Deng <wei.deng@oss.qualcomm.com> Link: https://patch.msgid.link/20260608091702.3797437-2-wei.deng@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-06-08power: sequencing: Add an API to return the pwrseq device's 'dev' pointerManivannan Sadhasivam
The consumer drivers can make use of the pwrseq device's 'dev' pointer to query the pwrseq provider's DT node to check for existence of specific properties. Hence, add an API to return the pwrseq device's 'dev' pointer to consumers. Note that since pwrseq_get() would've increased the pwrseq refcount, there is no need to increase the refcount in this API again. Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260519-pwrseq-m2-bt-v3-6-b39dc2ae3966@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-06-08power: sequencing: pcie-m2: Create BT node based on the pci_device_id[] tableManivannan Sadhasivam
Currently, pwrseq_pcie_m2_create_bt_node() hardcodes the BT compatible for creating the devicetree node. But to allow adding support for more devices in the future, create the BT node based on the pci_device_id[] table. The BT compatible is passed using 'driver_data'. Co-developed-by: Wei Deng <wei.deng@oss.qualcomm.com> Signed-off-by: Wei Deng <wei.deng@oss.qualcomm.com> Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260519-pwrseq-m2-bt-v3-5-b39dc2ae3966@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-06-08power: sequencing: pcie-m2: Create serdev for PCI devices present before probeManivannan Sadhasivam
So far, the driver is registering a notifier to create serdev for the PCI devices that are going to be attached after probe. But it doesn't handle the devices present before probe. Due to this, serdev is not getting created for those existing devices. Hence, create serdev for PCI devices available before probe as well. Note that the serdev for available devices are created before registering the notifier. There is a small window where a device could appear after pwrseq_pcie_m2_create_serdev(), before notifier registration. But since M.2 cards are fixed to a slot, they are mostly added either before booting the host or after using hotplug. So this window is mostly theoretical. Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260519-pwrseq-m2-bt-v3-4-b39dc2ae3966@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-06-08power: sequencing: pcie-m2: Improve PCI device ID checkManivannan Sadhasivam
Instead of hardcoding the PCI device check, use pci_match_id() to check for the known IDs using the pwrseq_m2_pci_ids[] array. This makes adding support for new devices easier. Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260519-pwrseq-m2-bt-v3-3-b39dc2ae3966@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-06-08power: sequencing: pcie-m2: Allow creating serdev for multiple PCI devicesManivannan Sadhasivam
Current code makes it possible to create serdev for only one PCI device. But for scaling this driver, it is necessary to allow creating serdev for multiple PCI devices. Hence, add provision for it by creating 'struct pwrseq_pci_dev' for each PCI device that requires serdev and add them to 'pwrseq_pcie_m2_ctx::pci_devices' list. Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260519-pwrseq-m2-bt-v3-2-b39dc2ae3966@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-06-08power: sequencing: pcie-m2: Fix inconsistent function prefixesManivannan Sadhasivam
All functions in this driver follow 'pwrseq_pcie_m2' prefix except a few. Fix them to avoid inconsistency. Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260519-pwrseq-m2-bt-v3-1-b39dc2ae3966@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-06-05power: supply: max17042_battery: Use modern PM ops to clear up warningNathan Chancellor
When building for a platform that does not have power management, such as s390, there is an unused function warning, as max17042_suspend_soc_alerts() is only used in max17042_suspend(), which is under a CONFIG_PM_SLEEP #ifdef. drivers/power/supply/max17042_battery.c:957:13: error: 'max17042_suspend_soc_alerts' defined but not used [-Werror=unused-function] 957 | static void max17042_suspend_soc_alerts(struct max17042_chip *chip) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ Use the modern DEFINE_SIMPLE_DEV_PM_OPS(), which allows the compiler to see the functions as used while allowing it to eliminate them as unused during the optimization phase. Use pm_ptr() to allow the compiler to drop max17042_pm_ops when there is no PM support. Fixes: 601885ffb5e9 ("power: supply: max17042_battery: Keep only critical alerts during suspend") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20260604-max17042_battery-fix-unused-suspend_soc_alerts-v1-1-3562a68e6f36@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-04power: supply: add support for Samsung S2M series PMIC charger deviceKaustabh Chakraborty
Add a driver for charger controllers found in certain Samsung S2M series PMICs. The driver has very basic support for the device, with only charger online reporting working, and USB 2.0 device negotiations working. The driver includes initial support for the S2MU005 PMIC charger. Co-developed-by: Łukasz Lebiedziński <kernel@lvkasz.us> Signed-off-by: Łukasz Lebiedziński <kernel@lvkasz.us> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org> Link: https://patch.msgid.link/20260516-s2mu005-pmic-v7-10-73f9702fb461@disroot.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-04power: supply: Add support for Surface RT battery and chargerJonas Schwöbel
Add support for Embedded Controller found in the Microsoft Surface RT and used to monitor battery cell and charger input status and properties. Controller works both for UEFI and APX booting. [wmjb: added POWER_SUPPLY_PROP_CHARGE_NOW support] Signed-off-by: Jethro Bull <jethrob@hotmail.com> Signed-off-by: Jonas Schwöbel <jonasschwoebel@yahoo.de> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Link: https://patch.msgid.link/20260507134608.76222-3-clamor95@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: bd71828: sysfs for auto input current limitationAndreas Kemnade
Add the possibility to disable the auto adjustment for input current limitation via sysfs because it gives strange results under certain circumstances e.g. when powering the device with solar panels resulting in no input power usage at all. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/20260504164017.467679-1-andreas@kemnade.info Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: cpcap-charger: include missing <linux/property.h>Vladimir Oltean
This file uses dev_fwnode() without including the proper header for it, relying on transitive header inclusion from: drivers/power/supply/cpcap-charger.c - include/linux/phy/omap_usb.h - include/linux/usb/phy_companion.h - include/linux/usb/otg.h - include/linux/phy/phy.h - drivers/phy/phy-provider.h - include/linux/of.h - include/linux/property.h With the future removal of drivers/phy/phy-provider.h from include/linux/phy/phy.h, this transitive inclusion would break. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://patch.msgid.link/20260505100523.1922388-27-vladimir.oltean@nxp.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: cros_charge-control: Move MODULE_DEVICE_TABLE next to the ↵Krzysztof Kozlowski
table itself By convention MODULE_DEVICE_TABLE() immediately follows the ID table it exports, because this is easier to read and verify. It also makes more sense since #ifdef for ACPI or OF could hide both of them. Most of the privers already have this correctly placed, so adjust the missing ones. No functional impact. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Acked-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260505102752.182089-2-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: ab8500_fg: Fix typos in commentsMd Shofiqul Islam
Fix spelling mistake in comments: - occured -> occurred (twice) Acked-by: Linus Walleij <linusw@kernel.org> Signed-off-by: Md Shofiqul Islam <shofiqtest@gmail.com> Link: https://patch.msgid.link/20260507191840.25941-1-shofiqtest@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: Use named initializers for arrays of i2c_device_dataUwe Kleine-König (The Capable Hub)
While being less compact, using named initializers allows to more easily see which members of the structs are assigned which value without having to lookup the declaration of the struct. And it's also more robust against changes to the struct definition. The mentioned robustness is relevant for a planned change to struct i2c_device_id that replaces .driver_data by an anonymous union. While touching all these arrays, unify usage of whitespace and commas. This patch doesn't modify the compiled arrays, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # max77976_charger.c Link: https://patch.msgid.link/20260515101629.4132270-2-u.kleine-koenig@baylibre.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: reset: st-poweroff: Use of_device_get_match_data()Rosen Penev
Use of_device_get_match_data() to fetch the reset syscfg data directly instead of open-coding an of_match_device() lookup. This also lets the driver drop the of_device.h include. Assisted-by: Codex:GPT-5.5 Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20260519004144.626969-1-rosenp@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: bq257xx: Add fields for 'charging' and 'overvoltage' statesAlexey Charkov
The driver currently reports the 'charging' and 'overvoltage' states based on a logical expression in the get_charger_property() wrapper function. This doesn't scale well to other chip variants, which may have a different number and type of hardware reported conditions which fall into these broad power supply states. Move the logic for determining 'charging' and 'overvoltage' states into chip-specific accessors, which can be overridden by each variant as needed. This helps keep the get_charger_property() wrapper function chip-agnostic while allowing for new chip variants to be added bringing their own logic. Tested-by: Chris Morgan <macromorgan@hotmail.com> Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260603-bq25792-v7-5-d487bed276d0@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: bq257xx: Consistently use indirect get/set helpersAlexey Charkov
Move the remaining get/set helper functions to indirect calls via the per-chip bq257xx_chip_info struct. This improves the consistency of the code and prepares the driver to support multiple chip variants with different register layouts and bit definitions. Tested-by: Chris Morgan <macromorgan@hotmail.com> Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260603-bq25792-v7-4-d487bed276d0@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: bq257xx: Make the default current limit a per-chip attributeAlexey Charkov
Add a field for the default current limit to the bq257xx_info structure and use it instead of the hardcoded value in the probe function. This prepares the driver for allowing different electrical constraints for different chip variants. Tested-by: Chris Morgan <macromorgan@hotmail.com> Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260603-bq25792-v7-3-d487bed276d0@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: bq257xx: Fix VSYSMIN clamping logicAlexey Charkov
The minimal system voltage (VSYSMIN) is meant to protect the battery from dangerous over-discharge. When the device tree provides a value for the minimum design voltage of the battery, the user should not be allowed to set a lower VSYSMIN, as that would defeat the purpose of this protection. Flip the clamping logic when setting VSYSMIN to ensure that battery design voltage is respected. Cc: stable@vger.kernel.org Fixes: 1cc017b7f9c7 ("power: supply: bq257xx: Add support for BQ257XX charger") Tested-by: Chris Morgan <macromorgan@hotmail.com> Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260603-bq25792-v7-2-d487bed276d0@flipper.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: cpcap-battery: Fix missing nvmem_device_put() causing ↵Ma Ke
reference leak In cpcap_battery_detect_battery_type(), the reference to an nvmem device obtained via nvmem_device_find() is not released with nvmem_device_put() on the success or read-failure paths, causing a permanent reference leak. The driver’s retry logic on subsequent battery property reads can compound this leak, preventing the nvmem device from ever being freed. Found by code review. Signed-off-by: Ma Ke <make24@iscas.ac.cn> Cc: stable@vger.kernel.org Fixes: fd46821e85de ("power: supply: cpcap-battery: Add battery type auto detection for mapphone devices") Link: https://patch.msgid.link/20260424011013.879639-1-make24@iscas.ac.cn Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: max17042: fix OF node reference imbalanceJohan Hovold
The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices. Fix this by using the intended helper for reusing OF nodes. Fixes: 0cd4f1f77ad4 ("power: supply: max17042: add platform driver variant") Cc: stable@vger.kernel.org # 6.14 Cc: Dzmitry Sankouski <dsankouski@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260407123338.2677375-1-johan@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: reset: linkstation-poweroff: fix use-after-free in the ↵Wentao Liang
linkstation_poweroff_init() Move of_node_put(dn) after the of_match_node() call, which still needs the node pointer. The node reference is correctly released after use. Fixes: e2f471efe1d6 ("power: reset: linkstation-poweroff: prepare for new devices") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20260407073025.271865-1-vulab@iscas.ac.cn Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: max17042_battery: use ModelCfg refresh on max17055Sebastian Krzyszkowiak
Unlike other models, max17055 doesn't require cell characterization data and operates on a smaller set of input variables (`DesignCap`, `VEmpty`, `IChgTerm`, and `ModelCfg`). Those values can be filled in through `max17042_override_por_values()`, but the refresh bit has to be set afterward in order to make them apply. Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm> Signed-off-by: Vincent Cloutier <vincent@cloutier.co> Link: https://patch.msgid.link/20260406205759.493288-8-vincent.cloutier@icloud.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: max17042_battery: Remove unused platform-data plumbingVincent Cloutier
No in-tree user still provides `max17042_platform_data` or `max17042_reg_data`. Move the simple runtime fields into `struct max17042_chip`, populate them directly from DT or the default hardware state, and drop the unused public platform-data interface. While here, write the MAX17047/MAX17050 default `FullSOCThr` value directly in probe instead of carrying it through an `init_data` table. Signed-off-by: Vincent Cloutier <vincent@cloutier.co> Link: https://patch.msgid.link/20260406205759.493288-7-vincent.cloutier@icloud.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: max17042_battery: Keep only critical alerts during suspendVincent Cloutier
Disable MAX17055 dSOCi while the system is suspended so state-of-charge changes do not wake the system repeatedly. Leave SALRT armed for the critical low-battery threshold and restore runtime alert handling on resume. Signed-off-by: Vincent Cloutier <vincent@cloutier.co> Link: https://patch.msgid.link/20260406205759.493288-6-vincent.cloutier@icloud.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: max17042_battery: Route MAX17055 SOC alerts through dSOCiVincent Cloutier
Use MAX17055 dSOCi for ordinary 1% state-of-charge notifications and leave SALRT configured for the critical low-battery threshold instead of reprogramming the SALRT window on every alert. Signed-off-by: Vincent Cloutier <vincent@cloutier.co> Link: https://patch.msgid.link/20260406205759.493288-5-vincent.cloutier@icloud.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: max17042_battery: Use Current register in get_statusSebastian Krzyszkowiak
It can take a while for AvgCurrent to adjust after (un)plugging the charger. Use the instantaneous value in order to not confuse the userspace. While at that, don't do unit conversion of the read value. The current code was prone to overflows and we only care about the sign anyway. Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm> Link: https://patch.msgid.link/20260406205759.493288-3-vincent.cloutier@icloud.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-03power: supply: max17042_battery: Put LSB units into definesSebastian Krzyszkowiak
Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm> Link: https://patch.msgid.link/20260406205759.493288-2-vincent.cloutier@icloud.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-02power: reset: sc27xx: Add platform_device_id tableOtto Pflüger
Make the poweroff driver for SC27xx-series PMICs probe automatically. Since the device representing the poweroff functionality of the SC27xx PMIC is not supposed to have a dedicated device tree node without any corresponding DT resources [1], an of_device_id table cannot be used here. Instead, use a platform_device_id table to match the poweroff sub-device instantiated by the parent MFD driver. [1]: https://lore.kernel.org/all/20251002025344.GA2958334-robh@kernel.org/ Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de> Link: https://patch.msgid.link/20260528-sc27xx-mfd-cells-v3-2-25cd685d2743@abscue.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-02power: Unify code style for platform_device_id arraysUwe Kleine-König (The Capable Hub)
Use a single space in the list terminator and remove the trailing comma. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Acked-by: Chen-Yu Tsai <wens@kernel.org> Link: https://patch.msgid.link/d840a6f83e3736510d7d859bf48c9bce04876b0c.1780048925.git.u.kleine-koenig@baylibre.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-02power: supply: mt6360_charger: Use of match table unconditionallyUwe Kleine-König (The Capable Hub)
mt6360_charger_of_id is defined unconditionally, so it doesn't make sense to not use it for the driver's .of_match_table member. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/ff94de5fb3ee6aeb1c0256e1a00c1c5ac350b430.1780048925.git.u.kleine-koenig@baylibre.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-02power: Use named initializers for platform_device_id arraysUwe Kleine-König (The Capable Hub)
Named initializers are better readable and more robust to changes of the struct definition. This robustness is relevant for a planned change to struct platform_device_id replacing .driver_data by an anonymous union. While touching these arrays unify spacing and usage of commas. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Joshua Peisach <jpeisach@ubuntu.com> Link: https://patch.msgid.link/1ceacf4f9c3f827bcad85b378aa04cdca1c04635.1780048925.git.u.kleine-koenig@baylibre.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-02power: supply: max14577: Drop driver data in of and platform device id arraysUwe Kleine-König (The Capable Hub)
These values are not used, the relevant distinction happens in the mfd parent driver. So they can be dropped. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/62e1b01a6591dd59406a78f2bbca619d734a9150.1780048925.git.u.kleine-koenig@baylibre.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-06-02power: Drop unused assignment of platform_device_id driver dataUwe Kleine-König (The Capable Hub)
The driver explicitly set the .driver_data member of struct platform_device_id to zero without relying on that value. Drop this unused assignments. While touching this array unify spacing, use a named initializer for .name and drop trailing commas after the list terminators. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/ba3589f74a12d86fb02ecb9fa2e89532188c22a0.1780048925.git.u.kleine-koenig@baylibre.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2026-05-11power: sequencing: print power sequencing device parent in debugfsChen-Yu Tsai
The debugfs summary currently shows the power sequencing device's name. This is not really helpful since the device name is always "pwrseq.N". Also print the parent device's name. This would likely be the device node name from the device tree, something like "nvme-connector". This would make it much easier for the developer to associate the summary with a certain device. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://patch.msgid.link/20260507052943.3133349-1-wenst@chromium.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-01power: supply: charger-manager: Switch to alarm_start_timer()Thomas Gleixner
The existing alarm_start() interface is replaced with the new alarm_start_timer() mechanism, which does not longer queue an already expired timer and returns the state. Adjust the code to utilize this. No functional change intended. Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://patch.msgid.link/20260408114952.536945376@kernel.org
2026-04-19Merge tag 'usb-7.1-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB / Thunderbolt updates from Greg KH: "Here is the big set of USB and Thunderbolt changes for 7.1-rc1. Lots of little things in here, nothing major, just constant improvements, updates, and new features. Highlights are: - new USB power supply driver support. These changes did touch outside of drivers/usb/ but got acks from the relevant mantainers for them. - dts file updates and conversions - string function conversions into "safer" ones - new device quirks - xhci driver updates - usb gadget driver minor fixes - typec driver additions and updates - small number of thunderbolt driver changes - dwc3 driver updates and additions of new hardware support - other minor driver updates All of these have been in the linux-next tree for a while with no reported issues" * tag 'usb-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (176 commits) usb: dwc3: starfive: Add JHB100 USB 2.0 DRD controller dt-bindings: usb: dwc3: add support for StarFive JHB100 dt-bindings: usb: atmel,at91sam9rl-udc: convert to DT schema dt-bindings: usb: atmel,at91rm9200-udc: convert to DT schema dt-bindings: usb: generic-ehci: fix schema structure and add at91sam9g45 constraints dt-bindings: usb: generic-ohci: add AT91RM9200 OHCI binding support arm: dts: at91: remove unused #address-cells/#size-cells from sam9x60 udc node drivers/usb/host: Fix spelling error 'seperate' -> 'separate' usbip: tools: add hint when no exported devices are found USB: serial: iuu_phoenix: fix iuutool author name usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb() usb: gadget: f_phonet: fix skb frags[] overflow in pn_rx_complete() usb: gadget: f_hid: Add missing error code usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding USB: of: Simplify with scoped for each OF child loop usbip: validate number_of_packets in usbip_pack_ret_submit() usb: gadget: renesas_usb3: validate endpoint index in standard request handlers usb: core: config: reverse the size check of the SSP isoc endpoint descriptor usb: typec: ucsi: Set usb mode on partner change ...
2026-04-17Merge tag 'for-v7.1' 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 drivers: - S2MU005: new battery fuel gauge driver - macsmc-power: new driver for Apple Silicon - qcom_battmgr: Add support for Glymur and Kaanapali - max17042: add support for max77759 - qcom_smbx: allow disabling charging - bd71828: add input current limit support - multiple drivers: use new device managed workqueue allocation function - misc small cleanups and fixes Reset core: - Expose sysfs for registered reboot_modes Reset drivers - misc small cleanups and fixes" * tag 'for-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (36 commits) power: supply: qcom_smbx: allow disabling charging power: reset: drop unneeded dependencies on OF_GPIO power: supply: bd71828: add input current limit property dt-bindings: power: reset: cortina,gemini-power-controller: convert to DT schema power: supply: add support for S2MU005 battery fuel gauge device dt-bindings: power: supply: document Samsung S2MU005 battery fuel gauge power: reset: reboot-mode: fix -Wformat-security warning power: supply: ipaq_micro: Simplify with devm power: supply: mt6370: Simplify with devm_alloc_ordered_workqueue() power: supply: max77705: Free allocated workqueue and fix removal order power: supply: max77705: Drop duplicated IRQ error message power: supply: cw2015: Free allocated workqueue power: reset: keystone: Use register_sys_off_handler(SYS_OFF_MODE_RESTART) power: supply: twl4030_madc: Drop unused header includes power: supply: bq24190: Avoid rescheduling after cancelling work power: supply: axp288_charger: Simplify returns of dev_err_probe() power: supply: axp288_charger: Do not cancel work before initializing it power: supply: cpcap-battery: pass static battery cell data from device tree dt-bindings: power: supply: cpcap-battery: document monitored-battery property power: supply: qcom_battmgr: Add support for Glymur and Kaanapali ...
2026-04-16Merge tag 'm68k-for-v7.1-tag1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k Pull m68k updates from Geert Uytterhoeven: - Add support for QEMU virt-ctrl, and use it for system reset and power off on the virt platform - defconfig updates - Miscellaneous fixes and improvements * tag 'm68k-for-v7.1-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: virt: Switch to qemu-virt-ctrl driver power: reset: Add QEMU virt-ctrl driver m68k: defconfig: Update defconfigs for v7.0-rc1 m68k: emu: Replace unbounded sprintf() in nfhd_init_one() m68k: uapi: Add ucontext.h m68k: defconfig: hp300: Enable monochrome and 16-color linux logos m68k: q40: Remove commented out code
2026-04-13Merge tag 'pwrseq-updates-for-v7.1-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull power sequencing updates from Bartosz Golaszewski: "For this release we have an extension of the pwrseq-pcie-m2 driver with support for PCIe M.2 Key E connectors. The rest of the commits fulfill a supporting role: document the hardware in DT bindings, provide required serdev helpers (this has been provided in an immutable branch to Rob Herring so you may see it in his PR as well) and is followed up by some Kconfig fixes from Arnd. Summary: - add support for the PCIe M.2 Key E connectors in pwrseq-pcie-m2 - describe PCIe M.2 Mechanical Key E connectors in DT bindings - add serdev helpers for looking up devices by OF nodes - minor serdev core rework to enable support for PCIe M.2 Key E connectors" * tag 'pwrseq-updates-for-v7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: power: sequencing: pcie-m2: add SERIAL_DEV_BUS dependency power: sequencing: pcie-m2: enforce PCI and OF dependencies power: sequencing: pcie-m2: Create serdev device for WCN7850 bluetooth power: sequencing: pcie-m2: Add support for PCIe M.2 Key E connectors dt-bindings: connector: Add PCIe M.2 Mechanical Key E connector dt-bindings: serial: Document the graph port serdev: Do not return -ENODEV from of_serdev_register_devices() if external connector is used serdev: Add an API to find the serdev controller associated with the devicetree node serdev: Convert to_serdev_*() helpers to macros and use container_of_const()
2026-04-13power: reset: Add QEMU virt-ctrl driverKuan-Wei Chiu
Add a new driver for the 'virt-ctrl' device found on QEMU virt machines (e.g. m68k). This device provides a simple interface for system reset and power off [1]. This driver utilizes the modern system-off API to register callbacks for both system restart and power off. It also registers a reboot notifier to catch SYS_HALT events, ensuring that LINUX_REBOOT_CMD_HALT is properly handled. It is designed to be generic and can be reused by other architectures utilizing this QEMU device. Link: https://gitlab.com/qemu-project/qemu/-/blob/v10.2.0/hw/misc/virt_ctrl.c [1] Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://patch.msgid.link/20260412211952.3564033-2-visitorckw@gmail.com Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>