AsahiLinux/linux

Battery charge thresholds broke after update to 6.10.6

Closed this issue · 2 comments

I have following udev rule:
KERNEL=="macsmc-battery", SUBSYSTEM=="power_supply", ATTR{charge_control_end_threshold}="55", ATTR{charge_control_start_threshold}="100"
in /usr/lib/udev/rules.d/90-asahi-battery.rules.

It worked properly on 6.10.5-400.asahi.fc40.aarch64+16k, but after update to 6.10.6-401.asahi.fc40.aarch64+16k the feature seems to be broken.

How to reproduce:

  1. create the rule shown above
  2. reboot or udevadm control --reload-rules && udevadm trigger
  3. check the thresholds:
    • cat /sys/class/power_supply/macsmc-battery/charge_control_end_threshold
    • cat /sys/class/power_supply/macsmc-battery/charge_control_start_threshold
      You should see 55 and 100, but there are 80 and 75

Additional info:
Now when I try to set the end threshold to values other than 100 and 80, it changes to 80
The start threshold automatically set to 75 if the end threshold set to 80, otherwise to 100

I don't know why, but 100 in the start threshold means no threshold, while 0 can't be set

Setting the end threshold to values other than 80 / 100 only worked in 6.10.5-400.asahi with certain SMC firmware version (those are tied to the 1st iboot stage version, i.e. system global). This is new functionality which is required on SMC firmware shipped with Sequoia betas. Unfortunately that regressed with the SMC firmware from macOS 14.0. So 6.10.6-401.asahi only uses the new method if the old one is not available.
Setting arbitrary values should be possible once a macOS installation is upgraded to Sequoia.

charge_control_start_threshold is not settable on this platform and will be either 5 less than the end threshold or 100. It is only there to ensure compatibility with software.

Closing this as won't fix

the problem has gone after updating to Sequoia.