android_kernel_motorola_sm6375/drivers/power
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mario Limonciello b31586747b power: supply: Fix logic checking if system is running from battery
[ Upstream commit 95339f40a8b652b5b1773def31e63fc53c26378a ]

The logic used for power_supply_is_system_supplied() counts all power
supplies and assumes that the system is running from AC if there is
either a non-battery power-supply reporting to be online or if no
power-supplies exist at all.

The second rule is for desktop systems, that don't have any
battery/charger devices. These systems will incorrectly report to be
powered from battery once a device scope power-supply is registered
(e.g. a HID device), since these power-supplies increase the counter.

Apart from HID devices, recent dGPUs provide UCSI power supplies on a
desktop systems. The dGPU by default doesn't have anything plugged in so
it's 'offline'. This makes power_supply_is_system_supplied() return 0
with a count of 1 meaning all drivers that use this get a wrong judgement.

To fix this case adjust the logic to also examine the scope of the power
supply. If the power supply is deemed a device power supply, then don't
count it.

Cc: Evan Quan <[email protected]>
Suggested-by: Lijo Lazar <[email protected]>
Signed-off-by: Mario Limonciello <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2023-06-21 15:44:09 +02:00
..
avs soc: ti: smartreflex: Fix PM disable depth imbalance in omap_sr_probe 2023-01-18 11:40:50 +01:00
reset power/reset: arm-versatile: Fix refcount leak in versatile_reboot_probe 2022-07-29 17:14:10 +02:00
supply power: supply: Fix logic checking if system is running from battery 2023-06-21 15:44:09 +02:00
Kconfig
Makefile