With kernel 4.17 above, we can set the threshold directly

1
2
$ echo 85 > /sys/class/power_supply/BAT0/charge_start_threshold
$ echo 95 > /sys/class/power_supply/BAT0/charge_stop_threshold

When the battery down to 85%, the charging will start
When it’s over 95%, will stop

References:

Archlinux Wiki - tp_smapi