I’ve been using the following to limit the charge voltage on the battery by reprogramming the charge controller chip:
i2cset -f -y 3 0x6a 0x06 0x46
In this case, it sets the stop charging threshold to 4.112 V, which is somewhere around 90%-ish. After it stops charging, the voltage settles to around 4.06V.
If you want to do it precisely by percentage, I believe there is also a register that will allow you to simply enable/disable the charge circuit as you please, but I can’t recall for certain what it is at the moment.
Important notes: messing about with the charge controller is potentially quite dangerous, as it will allow you to do things like set the charge voltage as high as 4.608V which would likely cause the battery to “vent with flames”, i.e. explode. There are also other gotchas like using the upper 6 bits of this register to set the voltage while the lower ones control other things. So, to modify it to use the voltage you want isn’t as simple as just decreasing the value one at a time.
Other notes: This settings is temporary until the next reboot. I believe uboot resets this and some other settings on each boot.
I think I’ll write up post describing more detail and how to set other values, and confirm or deny the enable/disable charge switch some time soon.
EDIT: Link: How to limit battery charge voltage and current