Two power_supply devices, only one of them has its online property updated when cable is (un)plugged
Background: The charge indicator is not working properly on byzantium, which seems to be because it gets its information from upower and upower is confused because there are two power supply devices one of which seems to give wrong information.
Looking at the devices listed by upower
there are two line_power devices:
purism@pureos:~$ upower -e
/org/freedesktop/UPower/devices/line_power_tps6598x_source_psy_0_003f
/org/freedesktop/UPower/devices/battery_max170xx_battery
/org/freedesktop/UPower/devices/line_power_bq25890_charger
/org/freedesktop/UPower/devices/DisplayDevice
which seem to correspond to the following two paths under /sys/
:
/sys/devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-006a/power_supply/bq25890-charger
/sys/devices/platform/soc@0/30800000.bus/30a20000.i2c/i2c-0/0-003f/power_supply/tps6598x-source-psy-0-003f
Each of them has an "online" property which as I understand it is intended to show if the cable is currently plugged in or not, but those values are not always in sync, for example it can look like this:
purism@pureos:~$ cat /sys/devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-006a/power_supply/bq25890-charger/online
0
purism@pureos:~$ cat /sys/devices/platform/soc@0/30800000.bus/30a20000.i2c/i2c-0/0-003f/power_supply/tps6598x-source-psy-0-003f/online
1
The behavior seems to be that the "online" property for both of them gets set correctly at boot time, then both are 0 or both are 1, depending on if the cable was connected or not at boot time. However, if the cable gets plugged or unplugged later while the device is up and running, only the bq25890-charger gets its online property updated, while tps6598x-source-psy-0-003f keeps showing the old "online" value from boot time.
Is it correct to have two separate power_supply devices on the Librem 5? It seems strange because there is only one cable. Why two devices?
If it is correct to have two separate power_supply devices, should the "online" property always be the same for those two? If so, the kernel is doing something wrong?
I am testing this on a Librem 5 Birch, currently with the 5.11.0-1-librem5 kernel but it seems to behave the same way for other kernel versions.