Sure, here’s the datasheet of the charger: https://www.ti.com/lit/ds/symlink/bq25895.pdf
The most useful section is 8.4 Register Maps. You can talk to the chip with i2cset/i2cget. Be careful though, this is a low level tool so it will happily let you shoot yourself in a foot!
You can check the current value of a register with:
sudo i2cget -f -y 3 0x6a <REG>
and set a new value with:
sudo i2cset -f -y 3 0x6a <REG> <VALUE>
If you want to disable charging and let the phone operate out of USB power, you’re interested in register 0x03 (page 35) and its CHG_CONFIG bit.
purism@librem5:~$ sudo i2cget -f -y 3 0x6a 0x03
0x1e
purism@librem5:~$ sudo i2cset -f -y 3 0x6a 0x03 0x0e
purism@librem5:~$
This disables charging, but will discharge the battery in case USB doesn’t provide enough power. You can check USB input current limit with:
purism@librem5:~$ cat /sys/class/power_supply/bq25890-charger/input_current_limit
900000
This shows that the current limit is set to 900mA. You can set it in register 0x00 (IINLIM, page 32). For instance, this sets the input current limit to 2.5A:
purism@librem5:~$ sudo i2cset -f -y 3 0x6a 0x00 0x30
purism@librem5:~$ cat /sys/class/power_supply/bq25890-charger/input_current_limit
2500000
purism@librem5:~$
Make sure that your charger is able to provide the current you set there!
You can also completely cut the battery from the power path, so it doesn’t charge or discharge at all and the phone operates solely on USB power (in which case it turns off if it tries to use more power than provided via USB) - see the BATFET_DIS bit in register 0x09 (page 41).
No worries, not that long ago I also didn’t know how to do it ![]()