How to limit battery charge voltage and current

Starting with kernel 6.2, you’re able to do all that without having to dangerously fiddle with i2c registers:

echo 500000 | sudo tee /sys/class/power_supply/bq25890-charger/constant_charge_current
echo 4000000 | sudo tee /sys/class/power_supply/bq25890-charger/constant_charge_voltage

The above will limit charging current to about 500mA and set the cutoff voltage to 4.0V. This way you don’t have to worry about setting too high values, as the kernel will automatically clamp it to the maximum specified in the device tree.

Input current limit (which is a different thing than charging current!) can be changed in the same way on older kernels already.

8 Likes