Some devices does this, if you are on Linux and are using a Thinkpad, you can fetch tp-smapi-dkms or acpi-call-dkms, and run the following:
echo 40 | sudo tee /sys/devices/platform/smapi/BAT0/start_charge_thresh
echo 80 | sudo tee /sys/devices/platform/smapi/BAT0/stop_charge_thresh
Then it will stop charging once it reached 80% and only start charging when it drops below 40%.