Skip to content

power: supply: macsmc: make force-discharge to the charge limit configurable#521

Open
BoiledElectricity wants to merge 1 commit into
AsahiLinux:asahi-wipfrom
BoiledElectricity:macsmc-force-discharge-configurable
Open

power: supply: macsmc: make force-discharge to the charge limit configurable#521
BoiledElectricity wants to merge 1 commit into
AsahiLinux:asahi-wipfrom
BoiledElectricity:macsmc-force-discharge-configurable

Conversation

@BoiledElectricity

Copy link
Copy Markdown

Lowering the charge limit always sets CHLS_FORCE_DISCHARGE, so the battery actively drains down to the limit even on AC. Add a force_discharge module param (default on = no behaviour change) to make that opt-out, so the limit can just cap charging instead.

Resolves the in-code TODO. Tested on M1 MacBook Pro (j293).

…gurable

When lowering the charge-control end threshold on machines that use the
CHLS key, the driver unconditionally sets CHLS_FORCE_DISCHARGE, actively
draining the battery down to the limit even on AC power. Most laptop
charge-limit implementations instead just cap charging at the threshold
and let the battery drain naturally through use.

Add a "force_discharge" module parameter (default on, preserving the
existing behaviour) so users can opt out of active discharge and have
the charge limit only cap charging. Resolves the existing TODO.

Signed-off-by: James A DellaMorte <james.dellamorte@gmail.com>
@BoiledElectricity

Copy link
Copy Markdown
Author

Tested on Apple MacBook Pro 13" M1 (j293), kernel 6.19.14, on AC at 100% (this firmware uses the CHLS path, has_chls=1):

  • force_discharge=N + set 90% limit → battery just caps charging, no discharge (Full, current_now=0)
  • force_discharge=Y (default) + set 90% limit → actively discharges (Discharging, ~-360 mA)
force_discharge=N, end_threshold=90:
  status=Full  current_now=0 uA        x4 samples over 8s

force_discharge=Y, end_threshold=90:
  status=Full         current_now=0 uA
  status=Discharging  current_now=-347000 uA
  status=Discharging  current_now=-376000 uA
  status=Discharging  current_now=-361000 uA

Battery restored to 100% / default afterwards.

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