Skip to content

power: supply: macsmc: hold the charge with CHLS where CHTE and CH0C are absent - #1474

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
parity-idx/macsmc-chls-hold
Nov 10, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
parity-idx/macsmc-chls-hold

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

The SMC firmware of the M4 Pro MacBook Pros has no CHTE, CH0C or CH0I, so charge_behaviour there offers only auto and auto-discharge. It does have the CHLS limit word and the CH0J inflow key.

  • inhibit-charge where neither CHTE nor CH0C exists: CHLS = current charge (10-99 %) with CHLS_HOLD (bit 9, hold at the limit instead of charging through to full), no drain. The user's own limit is kept while the hold lasts (the end threshold reads and sets it) and is written back by auto/auto-discharge.
  • force-discharge where CH0I is absent: CH0J = 1 cuts the external power inflow, 0 restores it. CH0J is a command key; the state comes from CH0R bit 5.
  • Macs with CHTE or CH0C keep their inhibit key and bit 9 is left alone there.

Testing

KUnit (arm64 QEMU, macsmc*): 24/24, including three new cases (hold and restore of the user's limit, CHTE precedence, CH0J).

J616s (M4 Pro), 7.3.0-aurora-fleet53, this driver as a module, on external power:

step status battery current charge_behaviour
before Full, 100 % 0 [auto] auto-discharge
patched Full 0 [auto] inhibit-charge force-discharge auto-discharge
force-discharge (+ CPU load) Discharging, 100 -> 96 % -5509 mA [force-discharge]
auto Charging +1919 mA [auto]
inhibit-charge Not charging within 1 s 0 mA after 20 s [inhibit-charge]
auto Charging +3394..+3599 mA [auto]

The end threshold read 100 throughout. s2idle x3 woken by the apple-pmu-rtc wakealarm: 3/3. SELinux enforcing, 0 AVCs, 0 speaker amp fault lines.

M2 (J413), same build, fleet53: force-discharge is now offered (CH0J) and runs the Mac from the battery on external power (Discharging, -1206 mA); auto returns to Full; inhibit-charge stays on CHTE. s2idle 3/3, 0 AVCs.

…are absent

The SMC firmware of the M4 Pro MacBook Pros has neither CHTE nor CH0C
(and no CH0I), so charge_behaviour offers no inhibit-charge and no
force-discharge there. It has the CHLS charge limit word and the CH0J
inflow key.

- inhibit-charge: where neither CHTE nor CH0C exists, set CHLS to the
  current charge (clamped to 10-99 %) with CHLS_HOLD (bit 9: hold at the
  limit instead of charging through to full) and no drain. The user's
  own limit is kept while the hold lasts: the end threshold still reads
  and sets it, and auto or auto-discharge writes it back.
- force-discharge: where CH0I is absent, write 1 to CH0J to cut the
  external power inflow; 0 restores it. CH0J is a command key, so the
  state is read from CH0R bit 5.

Macs with CHTE or CH0C keep their inhibit key, and bit 9 is left alone
there. KUnit covers the hold, the restore of the user's limit, the
CHTE precedence and CH0J.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant