Skip to content

cros_charge-control unsupported #85

Open

Description

@tlvince

Device Information

System Model or SKU

Please select one of the following

  • Framework Laptop 13 (11th Gen Intel® Core™)
  • Framework Laptop 13 (12th Gen Intel® Core™)
  • Framework Laptop 13 (13th Gen Intel® Core™)
  • Framework Laptop 13 (AMD Ryzen™ 7040 Series)
  • Framework Laptop 13 (Intel® Core™ Ultra Series 1)
  • Framework Laptop 13 (AMD Ryzen™ AI 300 Series)
  • Framework Laptop 16 (AMD Ryzen™ 7040 Series)

BIOS VERSION

3.04

DIY Edition information

Port/Peripheral information

  1. USB-C expansion card: Framework 60W charger
  2. USB-C expansion card (no peripheral)
  3. USB-C expansion card (no peripheral)
  4. USB-C expansion card (no peripheral)

Standalone Operation

  • Yes
  • No

Describe the bug

Loading cros_charge-control with probe_with_fwk_charge_control=1 should provide /sys/class/power_supply/BAT1/charge_control_{start,end}_threshold for userspace charge control e.g. GNOME 48's Preserve Battery Health feature.

This used to work on BIOS 3.03, but regressed in 3.04.

With the BIOS limiter set to 100% and extender disabled and cros_charge-control enabled, in the EC logs, I see:

[238553.413200 Sustainer enabled: 75 ~ 100%]
[238553.423500 Sustainer updated: 75 ~ 80% (from 75 ~ 100%)]
[238553.552500 Sustainer disabled]

... which suggests the limits are being passed through correctly, but then being reset.

This looks like the culprit: FrameworkComputer/EmbeddedController@d2a654b#diff-c97fadb96709544efeb068ef6acb07cc573d36d2b4498033b7d5f84b8a24ae41L85-L141

Connects #70.

Operating System (please complete the following information):

  • OS/Distribution: NixOS
  • Version: 25
  • Linux Kernel Version: 6.14.6

Activity

  1. X-m7 commented on Aug 11, 2025

    @X-m7

    I'm also seeing this issue on my Framework 13 with an Intel Core Ultra 5 125H, BIOS 3.05, Arch Linux, kernel 6.15.9 with the mfd: cros_ec: Separate charge-control probing from USB-PD patch applied, I see the following in the EC logs when I change the charge limit via the KDE GUI:

    [1051.484400 Sustainer enabled: 75 ~ 79%]
    +[1051.489200 Sustainer updated: 75 ~ 80% (from 75 ~ 79%)]
    [1052.472600 Sustainer disabled]
    
  2. X-m7 commented on Sep 5, 2025

    @X-m7

    Still not fixed with BIOS 3.06 (released a few days ago for the Core Ultra FW13) and kernel 6.16.4 (which now includes the aforementioned patch at least), the EC logs still show the same behavior as my previous comment.

  3. PHLAK commented on Nov 12, 2025

    @PHLAK

    I recently ran into this as well and like to see it resolved as my Framework 13 battery has started to bulge after a year of use. I've already ordered a replacement battery and enabled the charge limit via the BIOS but I'd prefer to allow the OS (Arch + GNOME) to control this so I can temporarily disable it when I would actually like the battery to charge to 100% (e.g. when I know I'm going to be using the laptop on battery for an extended period of time). Having to reboot to the BIOS to adjust the charge limit is annoying.

  4. tlvince commented on Nov 12, 2025

    @tlvince
    Author

    This can be achieved without a reboot via framework_tool (or ectool):

    ❯ sudo framework_tool --charge-limit 100

    ... although I agree; control via the OS/desktop environment is more convenient.

  5. PHLAK commented on Nov 12, 2025

    @PHLAK

    This can be achieved without a reboot via framework_tool (or ectool)

    Ahh, I forgot about that. Thank you!

  6. JohnAZoidberg commented on Jan 25, 2026

    @JohnAZoidberg
    Member

    This should work again now with torvalds/linux@e40fc11 ?

  7. t-8ch commented on Jan 25, 2026

    @t-8ch

    @JohnAZoidberg It got broken by a newer firmware version again.

  8. JohnAZoidberg commented on Jan 25, 2026

    @JohnAZoidberg
    Member

    Ok, thanks, I will investigate

  9. senz commented on Mar 6, 2026

    @senz

    I might have a related issue: I can set and see /sys/class/power_supply/BAT1/charge_control_{start,end}_threshold but after reboot, it resets back to 100. I was working on BIOS 3.03 and now I'm on 0.0.3.5

    System info:

    Operating System: Aurora 43
    KDE Plasma Version: 6.6.1
    KDE Frameworks Version: 6.23.0
    Kernel Version: 6.18.10-200.fc43.x86_64 (64-bit)
    Manufacturer: Framework
    Product Name: Laptop 13 (AMD Ryzen AI 300 Series)
    System Version: A9
    
  10. technobirb commented on Mar 14, 2026

    @technobirb

    Charge limit set by the framework_tool also resets to 100% after a reboot.
    Framework 13, Firmware 3.18, Arch Linux.

  11. mvysny commented on May 8, 2026

    @mvysny

    Seeing this on Framework Laptop 13 (AMD Ryzen™ AI 300 Series), BIOS 03.05, Ubuntu 26.04, kernel 7.0.0-15-generic.
    With probe_with_fwk_charge_control=Y set, charge_control_end_threshold correctly reads back as 80, and GNOME 48's "Preserve Battery Health" appears in Settings → Power. However the EC ignores the threshold and the battery charges past 80%.
    Notably, 03.05 is the current latest firmware for the AI 300 board per fwupdmgr, so this regression from 3.03 is still present in the newest release.
    The BIOS charge limit (set directly in firmware) does work correctly as a workaround, but it means losing the GNOME UI integration.

  12. jm355 commented on Jun 22, 2026

    @jm355

    I'm also not seeing the gnome battery saver in settings on Secureblue linux.

  13. gclawes commented on Aug 4, 2026

    @gclawes

    Same dual-path mismatch as others (sysfs 75/80 via 0x96, framework_tool still 0–100). I didn’t capture EC logs here, but this matches the sustainer reset pattern in this issue.

    • HW: FRANVZCP07 / A7, EC sakura-3.0.2, FW 03.02
    • OS: Aurora (Fedora 44), kernel 7.0.x, cros_charge_control with probe_with_fwk_charge_control=Y, KDE Plasma 6.7

    KDE charge limit sets sysfs to 75/80 (EC_CMD_CHARGE_CONTROL / 0x96), but:

    sudo framework_tool --charge-limit
    → Minimum 0%, Maximum 100%
    

    So the Framework path (0x3E03 / BBRAM) never gets updated. Same pattern as others: sustainer briefly applies, then gets cleared while Framework’s limit stays unlimited.

    Workaround that actually programs Framework’s limit: sudo framework_tool --charge-limit 80

    Would be good if DE/sysfs charge control either stopped getting reset, or also updated the Framework charge-limit so it matches framework_tool.

  14. aguano commented on Oct 5, 2026

    @aguano

    Same issue on a Framework Laptop 13 Pro (Intel Core Ultra Series 3, Core Ultra X7 358H), BIOS 03.02.

    OS: Fedora Workstation 44, kernel 7.2.8-200.fc44, GNOME 50 "Preserve Battery Health" enabled
    cros_charge_control loaded with probe_with_fwk_charge_control=Y (no "Framework charge control detected, preventing load" in the journal)
    sysfs: charge_control_end_threshold = 80, charge_control_start_threshold = 75
    BIOS: Battery Charge Limit 100, Battery Extender disabled
    Result: on AC at 94 %, status = Charging; the battery previously charged to 95 %. The EC ignores the threshold.

    framework_tool is not installed, so I could not read the Framework charge limit (0x3E03).

  15. Pace17881 commented on Nov 13, 2026

    @Pace17881

    Root cause candidate (from the EC source): the EC re-clears the sustainer every second while the Framework limit (BBRAM / cmd 0x3E03) is 0 or 100

    battery_extender() is a HOOK_SECOND handler. While stage == BATT_EXTENDER_STAGE_0 it calls battery_percentage_control(), which on fwk-lilac-refresh (and fwk-lotus-azalea-19573, fwk-sakura-20260429, fwk-sunflower-dahlia-2026-09-30, same code) does:

    if (!charging_maximum_level ||
        charging_maximum_level == 100) {
            if (stage == BATT_EXTENDER_STAGE_0)
                    charger_sustainer_reset();   /* battery_sustainer_set(-1, -1);
                                                    set_chg_ctrl_mode(CHARGE_CONTROL_NORMAL); */
            return;
    }

    charging_maximum_level only mirrors the value stored through 0x3E03 (framework_tool --charge-limit, BIOS setup). A sustainer that was set through the generic EC_CMD_CHARGE_CONTROL (0x96), which is what cros_charge-control, sysfs, TLP and KDE use, is therefore cleared again within at most one second, unless the Framework limit happens to be < 100.

    This matches the EC logs in this issue: Sustainer enabled → Sustainer updated: 75 ~ 80% → Sustainer disabled roughly one HOOK_SECOND tick apart (e.g. 1051.4892 → 1052.4726). It also explains the "sysfs says 80, framework_tool --charge-limit says 100" mismatch reported above: the two paths are not merged, and the 0x3E03 path always wins.

    The == 100 condition was added by d2a654b (1d228d5 on the lilac branch). With BBRAM = 100 the old code set battery_sustainer_set(95, 100) once and then left later 0x96 writes alone. That fits "worked on 3.03, regressed on 3.04".

    Data point (confirms it is still present on current firmware):

    • Framework Laptop 13 (AMD Ryzen AI 300), BIOS 04.02 (2026-06-09)
    • Linux 7.4.0-rc1, cros_charge_control probe_with_fwk_charge_control=1, TLP 1.11 with START/STOP_CHARGE_THRESH_BAT1=75/80
    • sysfs reads back 75/80, TLP reports no error, yet on AC the battery keeps charging: 83 % → 89 % over 12 min (charge_now 2918 → 3142 mAh, which is also past 80 % of design capacity), and the EC itself reported 97 % about an hour later
    • framework_tool --charge-limit reports Minimum 0%, Maximum 100% (Framework limit unset)

    EC console right after writing 80 to charge_control_end_threshold (SB-RMI Error lines filtered out):

    [5053.407900 HC 0x0096]
    [5053.408900 Sustainer enabled: 75 ~ 80%]
    [5053.623900 sustain_battery_soc: Switched control mode to DISCHARGE]
    [5053.653900 Sustainer disabled]
    

    The sustainer is enabled (the battery is above 80 %, so the EC switches to DISCHARGE), and about 245 ms after the host command it is disabled again. That is consistent with the once-per-second battery_extender() hook clearing it.

    Possible fix (untested on hardware, not flashed): only undo a sustainer this module configured itself, so a host-set (0x96) sustainer survives:

    if (!charging_maximum_level ||
        charging_maximum_level == 100) {
            if (stage == BATT_EXTENDER_STAGE_0 && old_charger_limit)
                    charger_sustainer_reset();   /* also zeroes old_charger_limit */
            return;
    }

    Going from e.g. 80 → 100 via 0x3E03 still clears it (old_charger_limit is non-zero then). The CHG_LIMIT_OVERRIDE branch and the extender stages are unchanged. Related: #100 invalidates old_charger_limit on SET, so the two changes should be looked at together.

    Happy to turn this into a PR against the relevant branch if that's useful.

  16. mitar commented on Nov 14, 2026

    @mitar

    My workaround is to set in BIOS the firmware's own charge limit at 99% and Battery Extender disabled.

  17. mitar commented on Nov 22, 2026

    @mitar

    Follow-up to my workaround above: the cause is in the EC. battery_percentage_control() in battery_extender.c runs every second, and while the firmware's own charge limit is 0 or 100 it calls charger_sustainer_reset() on every pass. That turns the sustainer off and sets the charge control mode to normal, so within a second it clears the thresholds which Linux's cros_charge_control sets with EC_CMD_CHARGE_CONTROL.

    This commit clears the sustainer once, when the limit changes to 100%, the same way a limit below 100 is applied only when it changes. On a Laptop 13 Pro with the AMD Ryzen AI 300 Series mainboard, setting the limit to 100% then cleared the sustainer once, and thresholds which Linux set afterwards held without being cleared again. So with this firmware the BIOS limit can stay at 100% while Linux sets the thresholds: with the BIOS limit at 100%, GNOME's 40% and 60% were still in the EC four hours after Linux set them at boot (EC_CMD_CHARGE_CONTROL GET returned the lower and upper limits 40 and 60, with the charge held in IDLE).

    To load cros_charge_control on these laptops at all, it needs options cros_charge_control probe_with_fwk_charge_control=1, because it stays away by default when the EC also offers Framework's own charge limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions