You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Charge sustainer charges to the upper threshold at every AC connection, so the lower threshold applies only while AC stays connected #102
Framework Laptop 13 (AMD Ryzen AI 300 Series), Ryzen AI 9 HX 370
BIOS 04.02, EC lilac-4.0.2-fdbf549
BIOS battery charge limit at 99%, Battery Extender disabled. At 100% the firmware clears the sustainer every second, which wipes thresholds set from the OS (see SoftwareFirmwareIssueTracker#85).
Ubuntu 26.04, Linux 7.0, cros_charge_control loaded with probe_with_fwk_charge_control=1. GNOME's Preserve Battery Health (UPower) sets charge_control_start_threshold to 40 and charge_control_end_threshold to 60, which the driver passes to the EC as the sustainer's lower and upper limits.
Issue Description
The sustainer follows the lower threshold only while AC power stays connected. Whenever AC power is connected again, the EC charges the battery up to the upper threshold, whatever the charge, so the lower threshold has no effect on a laptop which is unplugged and plugged in again during the day, for example when it is carried between desks or to a meeting.
UPower's charge history from one week shows it at every connection above the lower threshold:
Connected (CET)
Charge
Result
2026-11-07 21:46
42%
charging, up to 60%
2026-11-08 00:20
45%
charging, up to 60%
2026-11-08 12:16
48%
charging, 60% reached at 12:26
2026-11-10 21:02
59%
charging, up to 60%
2026-11-12 14:44
58%
charging, until unplugged at 59%
2026-11-12 14:48
58%
charging, until unplugged at 59%
While AC power stays connected, the sustainer holds as expected. On 2026-11-08 at 04:09 the battery stayed at 58% without charging, and on 2026-10-22 at 09:09 at 59%.
The same applies to the firmware's own charge limit, which becomes the sustainer window from 5% below the limit up to the limit (as described in #84): every connection tops the battery up to the limit.
Suggested fix
When AC power is connected with the sustainer enabled and the charge between the lower and the upper limit, start the sustainer in CHARGE_CONTROL_IDLE (or CHARGE_CONTROL_DISCHARGE with EC_CHARGE_CONTROL_FLAG_NO_IDLE) instead of CHARGE_CONTROL_NORMAL. Below the lower limit it would charge up to the upper limit, as now. This could be done in process_ac_change() when AC power appears, or as a first evaluation in sustain_battery_soc() after an AC connection.
charge_state: keep a charge above the sustainer's upper limit: a charge above the upper limit, as when the thresholds are set after a full charge, is kept in IDLE and comes down as the battery discharges without AC, instead of the laptop running from its battery on AC down to the upper limit. A host which asks for EC_CHARGE_CONTROL_FLAG_NO_IDLE keeps the sustainer discharging.
make run-sbs_charging has new tests for all three, which fail without the changes. On the laptop, with the thresholds at 40% and 60%: reconnecting AC at 58% kept the charge, rewriting a threshold and returning from force-discharge to auto kept it as well, and setting the thresholds with the charge at 62% kept 62% instead of discharging the battery on AC, which Framework's firmware does.
I can open a pull request against fwk-lilac-27116 if this is wanted.
Activity
charge_state: keep the charge when AC is connected in the sustain range
charge_state: keep the charge when the host sets the sustainer in range
charge_state: keep the charge when AC is connected in the sustain range
charge_state: keep the charge when the host sets the sustainer in range
mitar commentedon Nov 22, 2026
I fixed this on my branch, together with a related problem, and the result has been running on my laptop since:
charge_behaviourreturns toauto.EC_CHARGE_CONTROL_FLAG_NO_IDLEkeeps the sustainer discharging.make run-sbs_charginghas new tests for all three, which fail without the changes. On the laptop, with the thresholds at 40% and 60%: reconnecting AC at 58% kept the charge, rewriting a threshold and returning fromforce-dischargetoautokept it as well, and setting the thresholds with the charge at 62% kept 62% instead of discharging the battery on AC, which Framework's firmware does.I can open a pull request against
fwk-lilac-27116if this is wanted.