Battery Charging Hysteresis Support

It would be great if one could configure a hysteresis function for the battery charging subsystem. For example to let the firmware charge the battery to 80% (upper hysteresis threshold), but, after that event, only re-charge it if the capacity drops down below - say - 70% (lower hysteresis threshold).

This should increase the battery live very much for devices connected to a charger for extended periods.

Ideally the upper and lower thresholds would be configurable via the BIOS and the operating system (i.e. e.g. sysfs on Linux).

This is an improvement over the status quo, where one can only specify on upper ‘Battery Charge limit’ in the BIOS. Thus, trickle charges in tiny charge cycles still happen. For example, when you set that limit to 80%, after a small self-discharge amount of - say - 1% - the firmware immediately re-charges again up to 80%. Which is not good for battery life!


This feature is available in other mobile devices. Best example are perhaps Thinkpads where the firmware exposes /sys/devices/platform/smapi/BAT0/{start_charge_thresh,stop_charge_thresh}.


Related discussion: Battery Management with min/max limits possible?

5 Likes

Related discussion here: Battery charge control thresholds in sysfs.

tl;dr: three months ago @DHowett had functioning code to support this in sysfs…

2 Likes

Awesome. AFAICS, that discussion is about exposing the existing upper limit via sysfs - and not about adding hysteresis functionality (and adding both thresholds then).

However, using that single knob would make it possible to implement hysteresis in user space, as a first approximation. For example like this: A custom small daemon monitors battery charging and sets the sysfs limit to - say - 80%. After the limit is reached it changes the limit down to - say 70%, if it goes below 70%, it increases it again to 80% etc. Sure, this would be a suboptimal solution with some edge-cases not covered, e.g. when you power-down/suspend the laptop before the daemon has switched to the lower threshold.

Of course, this would be just a workaround solution until the EC directly implements hysteresis charging. An EC solution would be the preferable and better way to manage this, because the EC can keep track of everything and adjust settings even when no operating system is running.

1 Like