summaryrefslogtreecommitdiffstats
path: root/drivers/power
Commit message (Collapse)AuthorAgeFilesLines
...
| * power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART)Andrew Davis2024-02-131-15/+4
| | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-14-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: msm-poweroff: Use devm_register_sys_off_handler(POWER_OFF)Andrew Davis2024-02-131-2/+6
| | | | | | | | | | | | | | | | | | | | Use this helper to register sys_off handler. Drivers should move away from setting pm_power_off directly as it only allows for one handler. The new way allows for trying multiple if the first one doesn't work. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-13-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: mt6323-poweroff: Use devm_register_sys_off_handler(POWER_OFF)Andrew Davis2024-02-131-13/+13
| | | | | | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20240212162831.67838-12-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: rmobile-reset: Use devm_register_sys_off_handler(RESTART)Andrew Davis2024-02-131-16/+6
| | | | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-11-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: rmobile-reset: Use devm_platform_ioremap_resource() helperAndrew Davis2024-02-131-9/+4
| | | | | | | | | | | | | | | | | | Use device life-cycle managed ioremap function to simplify probe and exit paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-10-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: axxia-reset: Use devm_register_sys_off_handler(RESTART)Andrew Davis2024-02-131-10/+6
| | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-9-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: brcm-kona-reset: Use devm_register_sys_off_handler(RESTART)Andrew Davis2024-02-131-8/+3
| | | | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://lore.kernel.org/r/20240212162831.67838-8-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: tps65086-restart: Remove unneeded device data structAndrew Davis2024-02-131-27/+8
| | | | | | | | | | | | | | | | | | | | We only need one member of the struct tps65086_restart, pass that tps65086_restart_notify() directly. Remove that struct and its allocation. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-7-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: tps65086-restart: Use devm_register_sys_off_handler(RESTART)Andrew Davis2024-02-131-28/+7
| | | | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-6-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART)Andrew Davis2024-02-131-9/+4
| | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-5-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: xgene-reboot: Use devm_platform_ioremap_resource() helperAndrew Davis2024-02-131-5/+3
| | | | | | | | | | | | | | | | | | | | | | Use device life-cycle managed ioremap function to simplify probe and exit paths. While here add __iomem to the returned pointer to fix a sparse warning. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-4-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(POWER_OFF)Andrew Davis2024-02-131-24/+14
| | | | | | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://lore.kernel.org/r/20240212162831.67838-3-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(RESTART)Andrew Davis2024-02-131-10/+7
| | | | | | | | | | | | | | | | | | | | Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://lore.kernel.org/r/20240212162831.67838-2-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: axp20x_usb_power: enable usb_type reportingAren Moynihan2024-02-021-1/+72
| | | | | | | | | | | | | | | | | | The axp803 and axp813 chips can report the detected USB BC mode. SDP, CDP, and DCP are supported. Signed-off-by: Aren Moynihan <aren@peacevolution.org> Link: https://lore.kernel.org/r/20240130203714.3020464-5-aren@peacevolution.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: axp20x_usb_power: fix race condition with usb bcAren Moynihan2024-02-021-0/+23
| | | | | | | | | | | | | | | | | | When input_current_limit is set while USB BC is in progress, the BC module will overwrite the value that was set when it finishes detection. Signed-off-by: Aren Moynihan <aren@peacevolution.org> Link: https://lore.kernel.org/r/20240130203714.3020464-4-aren@peacevolution.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: axp20x_usb_power: use correct register for input current limitAren Moynihan2024-02-021-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | On the axp803 and axp813 chips register 0x30 bits 0-1 is the default current limit that gets applied after the pmic detects a CDP or DCP port. The correct field to set is 0x35 bits 4-7. This field only has nine values (out of the 16 possible if it used all the bits), so introduce a field size variable to take that into account. Signed-off-by: Aren Moynihan <aren@peacevolution.org> Link: https://lore.kernel.org/r/20240130203714.3020464-3-aren@peacevolution.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: axp20x_usb_power: replace current_max with input_current_limitAren Moynihan2024-02-021-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current_max property is supposed to be read-only, and represent the maximum current the supply can provide. input_current_limit is the limit that is currently set, which is what we have here. When determining what value to write to the register, we need to pick a reasonable value if the requested limit doesn't exactly match one supported by the hardware. If the requested limit is less than the lowest value we can set, round up to the lowest value. Otherwise round down to the nearest value supported by hardware. Also add a dev field to the axp20x_usb_power struct, so we can use dev_dbg and dev_err in more places. Signed-off-by: Aren Moynihan <aren@peacevolution.org> Link: https://lore.kernel.org/r/20240130203714.3020464-2-aren@peacevolution.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: wm8350: Use devm_power_supply_register() helperAndrew Davis2024-02-011-23/+7
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240129190246.73067-5-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max8925: Use devm_power_supply_register() helperAndrew Davis2024-02-011-27/+10
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240129190246.73067-4-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max77693: Use devm_power_supply_register() helperAndrew Davis2024-02-011-7/+3
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240129190246.73067-3-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max14577: Use devm_power_supply_register() helperAndrew Davis2024-02-011-5/+3
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240129190246.73067-2-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: twl4030_madc: Use devm_power_supply_register() helperAndrew Davis2024-01-271-12/+3
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-22-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: twl4030_madc: Use devm_iio_channel_get() helperAndrew Davis2024-01-271-33/+11
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed get function. This helps prevent mistakes like releasing out of order in cleanup functions and forgetting to release on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-21-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rx51: Use devm_power_supply_register() helperAndrew Davis2024-01-271-11/+1
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-20-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rx51: Use devm_iio_channel_get() helperAndrew Davis2024-01-271-34/+11
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed get function. This helps prevent mistakes like releasing out of order in cleanup functions and forgetting to release on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-19-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: da9150: Use devm_power_supply_register() helperAndrew Davis2024-01-271-11/+4
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-18-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: da9150: Use devm_iio_channel_get() helperAndrew Davis2024-01-271-43/+14
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed get function. This helps prevent mistakes like releasing out of order in cleanup functions and forgetting to release on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-17-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: wm831x: Use devm_power_supply_register() helperAndrew Davis2024-01-271-15/+9
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-15-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: wm831x: Use devm_power_supply_register() helperAndrew Davis2024-01-271-11/+2
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-14-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: tps65090: Use devm_power_supply_register() helperAndrew Davis2024-01-271-12/+6
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-13-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rt5033: Use devm_power_supply_register() helperAndrew Davis2024-01-271-11/+3
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-12-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: pcf50633: Use devm_power_supply_register() helperAndrew Davis2024-01-271-14/+9
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-11-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: lp8788: Use devm_power_supply_register() helperAndrew Davis2024-01-271-15/+6
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-7-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: lp8727: Use devm_power_supply_register() helperAndrew Davis2024-01-271-28/+7
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-6-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: goldfish: Use devm_power_supply_register() helperAndrew Davis2024-01-271-17/+7
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-5-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: ds2760: Use devm_power_supply_register() helperAndrew Davis2024-01-271-3/+1
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-4-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: da9052: Use devm_power_supply_register() helperAndrew Davis2024-01-271-3/+1
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-3-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: da9030: Use devm_power_supply_register() helperAndrew Davis2024-01-271-3/+3
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123163653.384385-2-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx: Move one time design full read out of pollAndrew Davis2024-01-271-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | This value only needs read once. Move that read into the function that returns the value to keep the logic all in one place. This also avoids doing this check every time we read in values in the device update poll worker. While here, correct this function's error message. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123150914.308510-5-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx: Use devm_power_supply_register() helperAndrew Davis2024-01-271-3/+1
| | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123150914.308510-4-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx: Use devm to free device mutexAndrew Davis2024-01-271-1/+12
| | | | | | | | | | | | | | | | | | | | Use a device lifecycle managed action to free the device mutex. This helps prevent mistakes like freeing out of order in cleanup functions and forgetting to free on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123150914.308510-3-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx: Add devm action to free IDAAndrew Davis2024-01-271-17/+18
| | | | | | | | | | | | | | | | | | | | Use a device lifecycle managed action to free the IDA. This helps prevent mistakes like freeing out of order in cleanup functions and forgetting to free on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123150914.308510-2-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx: Switch to a simpler IDA interfaceAndrew Davis2024-01-271-11/+4
| | | | | | | | | | | | | | | | | | We don't need to specify any ranges when allocating IDs so we can switch to ida_alloc() and ida_free() instead of the ida_simple_ counterparts. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123150914.308510-1-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: bq27xxx-i2c: Do not free non existing IRQHans de Goede2024-02-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bq27xxx i2c-client may not have an IRQ, in which case client->irq will be 0. bq27xxx_battery_i2c_probe() already has an if (client->irq) check wrapping the request_threaded_irq(). But bq27xxx_battery_i2c_remove() unconditionally calls free_irq(client->irq) leading to: [ 190.310742] ------------[ cut here ]------------ [ 190.310843] Trying to free already-free IRQ 0 [ 190.310861] WARNING: CPU: 2 PID: 1304 at kernel/irq/manage.c:1893 free_irq+0x1b8/0x310 Followed by a backtrace when unbinding the driver. Add an if (client->irq) to bq27xxx_battery_i2c_remove() mirroring probe() to fix this. Fixes: 444ff00734f3 ("power: supply: bq27xxx: Fix I2C IRQ race on remove") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240215155133.70537-1-hdegoede@redhat.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: mm8013: select REGMAP_I2CThomas Weißschuh2024-02-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | The driver uses regmap APIs so it should make sure they are available. Fixes: c75f4bf6800b ("power: supply: Introduce MM8013 fuel gauge driver") Cc: <stable@vger.kernel.org> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20240204-mm8013-regmap-v1-1-7cc6b619b7d3@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | Revert "power: supply: qcom_battmgr: Register the power supplies after PDR ↵Johan Hovold2024-01-261-60/+49
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is up" This reverts commit b43f7ddc2b7a5a90447d96cb4d3c6d142dd4a810. The offending commit deferred power-supply class device registration until the service-started notification is received. This triggers a NULL pointer dereference during boot of the Lenovo ThinkPad X13s and SC8280XP CRD as battery status notifications can be received before the service-start notification: Unable to handle kernel NULL pointer dereference at virtual address 00000000000005c0 ... Call trace: _acquire+0x338/0x2064 acquire+0x1e8/0x318 spin_lock_irqsave+0x60/0x88 _supply_changed+0x2c/0xa4 battmgr_callback+0x1d4/0x60c [qcom_battmgr] pmic_glink_rpmsg_callback+0x5c/0xa4 [pmic_glink] qcom_glink_native_rx+0x58c/0x7e8 qcom_glink_smem_intr+0x14/0x24 [qcom_glink_smem] __handle_irq_event_percpu+0xb0/0x2d4 handle_irq_event+0x4c/0xb8 As trying to serialise this is non-trivial and risks missing notifications, let's revert to registration during probe so that the driver data is all set up once the service goes live. The warning message during resume in case the aDSP firmware is not running that motivated the change can be considered a feature and should not be suppressed. Fixes: b43f7ddc2b7a ("power: supply: qcom_battmgr: Register the power supplies after PDR is up") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20240123160053.18331-1-johan+linaro@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* power: supply: bq24190_charger: Fix "initializer element is not constant" errorNathan Chancellor2024-01-191-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building with a version of GCC prior to 8.x, there is an error around non-constant initializer elements: drivers/power/supply/bq24190_charger.c:1978:16: error: initializer element is not constant .vbus_desc = bq24190_vbus_desc, ^~~~~~~~~~~~~~~~~ drivers/power/supply/bq24190_charger.c:1978:16: note: (near initialization for 'bq24190_chip_info_tbl[0].vbus_desc') drivers/power/supply/bq24190_charger.c:1989:16: error: initializer element is not constant .vbus_desc = bq24190_vbus_desc, ^~~~~~~~~~~~~~~~~ drivers/power/supply/bq24190_charger.c:1989:16: note: (near initialization for 'bq24190_chip_info_tbl[1].vbus_desc') drivers/power/supply/bq24190_charger.c:2000:16: error: initializer element is not constant .vbus_desc = bq24190_vbus_desc, ^~~~~~~~~~~~~~~~~ drivers/power/supply/bq24190_charger.c:2000:16: note: (near initialization for 'bq24190_chip_info_tbl[2].vbus_desc') drivers/power/supply/bq24190_charger.c:2011:16: error: initializer element is not constant .vbus_desc = bq24190_vbus_desc, ^~~~~~~~~~~~~~~~~ drivers/power/supply/bq24190_charger.c:2011:16: note: (near initialization for 'bq24190_chip_info_tbl[3].vbus_desc') drivers/power/supply/bq24190_charger.c:2022:16: error: initializer element is not constant .vbus_desc = bq24296_vbus_desc, ^~~~~~~~~~~~~~~~~ drivers/power/supply/bq24190_charger.c:2022:16: note: (near initialization for 'bq24190_chip_info_tbl[4].vbus_desc') Clang versions prior to 17.x show a similar error: drivers/power/supply/bq24190_charger.c:1978:16: error: initializer element is not a compile-time constant .vbus_desc = bq24190_vbus_desc, ^~~~~~~~~~~~~~~~~ 1 error generated. Newer compilers have decided to accept these structures as compile time constants as an extension. To resolve this issue for all supported compilers, change the vbus_desc member in 'struct bq24190_chip_info' to a pointer, as it is only ever passed by reference anyways, and adjust the assignments accordingly. Closes: https://github.com/ClangBuiltLinux/linux/issues/1973 Fixes: b150a703b56f ("power: supply: bq24190_charger: Add support for BQ24296") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Justin Stitt <justinstitt@google.com> Link: https://lore.kernel.org/r/20240103-fix-bq24190_charger-vbus_desc-non-const-v1-1-115ddf798c70@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* Merge power-supply fixes for 6.7 cycleSebastian Reichel2024-01-141-1/+1
|\ | | | | | | | | | | | | Merge power-supply fixes branch, which I never send for the v6.7 cycle. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: cw2015: correct time_to_empty units in sysfsJan Palus2023-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | RRT_ALRT register holds remaining battery time in minutes therefore it needs to be scaled accordingly when exposing TIME_TO_EMPTY via sysfs expressed in seconds Fixes: b4c7715c10c1 ("power: supply: add CellWise cw2015 fuel gauge driver") Signed-off-by: Jan Palus <jpalus@fastmail.com> Link: https://lore.kernel.org/r/20231111221704.5579-1-jpalus@fastmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: bq24190_charger: Add support for BQ24296Hermes Zhang2023-12-251-103/+354
| | | | | | | | | | | | | | | | | | | | | | The BQ24296 is most similar to the BQ24196, but the: 1. OTG config is split from CHG config (REG01) 2. ICHG (Fast Charge Current limit) range is smaller (<=3008mA) 3. NTC fault is simplified to 2 bits Signed-off-by: Hermes Zhang <chenhuiz@axis.com> Link: https://lore.kernel.org/r/20231208034708.1248389-3-Hermes.Zhang@axis.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>