linux-cachyos icon indicating copy to clipboard operation
linux-cachyos copied to clipboard

[BUG] linux-cachyos 7.3.0-4: SENSORS_APPLESMC disabled, no keyboard backlight / macsmc-battery errors / mbpfan fails on pre-T2 MacBookPro11,4 (LTS works)

Open Yld2004 opened this issue 1 month ago • 19 comments

Pre-flight checklist

  • [x] I have searched existing issues and this is not a duplicate.
  • [x] I have read the Contributing Guidelines.
  • [x] I have verified the issue is reproducible with the latest available CachyOS kernel.
  • [x] I have tried to reproduce the issue on Arch Linux's linux kernel.

Upstream / vanilla kernel check

I have not tested with a vanilla/upstream kernel

Kernel variant

linux-cachyos (EEVDF, Clang)

System information (cachyos-bugreport.sh)

https://paste.cachyos.org/p/131b60d.log

Manual system information (if cachyos-bugreport.sh is unavailable)


Bug description

On linux-cachyos 7.3.0-4, a pre-T2 Intel MacBook (MacBookPro11,4, mid-2015, i7-4770HQ) loses three things that work on linux-cachyos-lts 6.18.55-2:

  1. CONFIG_SENSORS_APPLESMC is not set, so the applesmc module does not exist. There is no smc::kbd_backlight, and the keyboard backlight keys do nothing in KDE Plasma 6.8.1.
  2. A macsmc-battery power supply appears and fails with driver failed to report 'power_now' property: -95, about 10 lines every 5 seconds for the whole boot. [DESCRIBE what you see in KDE, e.g. wrong or missing battery readings.]
  3. mbpfan.service fails on every start and hits the start limit (no fan control).

This looks like the T2/macsmc rework disabling the old driver that non-T2 Macs still need. That part is my inference, not confirmed. A user with a MacBookPro8,3 reports the same on 7.3 (old driver disabled in the config, new driver misbehaving): https://discuss.cachyos.org/t/macsmc-is-broken-on-macbookpro8-3-linux-cachyos-7-3/37962

On the LTS kernel the old driver works: CONFIG_SENSORS_APPLESMC=m and CONFIG_SENSORS_APPLESMC_T2=m, both applesmc.ko.zst and applesmc-t2.ko.zst present, device applesmc.768. dmesg shows applesmc: key=719 fan=2 temp=48 index=43 acc=0 lux=2 kbd=1. The keyboard backlight keys work, and the battery is reported via ACPI SBS (Smart Battery System [SBS0]: Battery Slot [BAT0]).

Steps to reproduce

  1. On a pre-T2 Intel MacBook (MacBookPro11,4), boot linux-cachyos 7.3.0-4.
  2. Run zgrep APPLESMC /proc/config.gz and sudo modprobe applesmc.
  3. Run ls /sys/class/leds/ and press the keyboard backlight keys.
  4. Run journalctl -b -k | grep macsmc-battery and systemctl status mbpfan.
  5. Boot linux-cachyos-lts 6.18.55-2 and repeat; everything works there.

Expected behavior

applesmc is available on non-T2 Intel Macs (or the new macsmc driver only loads on T2 Macs). smc::kbd_backlight exists, the battery reports normally and mbpfan can start.

Actual behavior

# CONFIG_SENSORS_APPLESMC is not set; modprobe applesmc fails; /sys/class/leds/ has only macsmc-led; macsmc-battery errors flood the journal; mbpfan fails.

Logs / stack traces

$ zgrep APPLESMC /proc/config.gz
# CONFIG_SENSORS_APPLESMC is not set

$ sudo modprobe applesmc
modprobe: FATAL: Module applesmc not found in directory /lib/modules/7.3.0-4-cachyos

kernel: power_supply macsmc-battery: driver failed to report `power_now' property: -95
(repeats ~10x every 5 s for the whole boot)

systemd[1]: mbpfan.service: Failed with result 'exit-code'.
systemd[1]: mbpfan.service: Start request repeated too quickly.
systemd[1]: mbpfan.service: Failed with result 'start-limit-hit'.
systemd[1]: Failed to start A fan manager daemon for MacBook Pro.

$ pacman -Ql linux-cachyos | grep applesmc
(no output: package linux-cachyos 7.3.0-4 ships no applesmc module)

Additional system information

No response

Yld2004 avatar Oct 26 '26 16:10 Yld2004

same with my macbookpro11,2 with the linux-cachyos 7.3.0-4 kernel.

t8pt avatar Oct 26 '26 20:10 t8pt

Same on another pre-T2 model: MacBook9,1 (12", 2016, Core m3-6Y30, fanless), linux-cachyos 7.3.0-4 vs linux-cachyos-lts 6.18.55-2.

  • 7.3.0-4: # CONFIG_SENSORS_APPLESMC is not set. The only SMC line in the journal is macsmc-acpi APP0001:00: Successfully Initialized (701 keys First key: #KEY (0x234b4559) Last key: zSEN (0x7a53454e)). Unlike the MacBookPro11,4, I see no macsmc-battery errors in one 7.3 boot with four S3 cycles. I have not yet checked which macsmc cells (power, hwmon, light) register on this model.
  • 6.18 LTS: applesmc: key=701 fan=0 temp=37 index=36 acc=0 lux=2 kbd=0, so the same SMC is handled by applesmc there.

Findings that may help:

  1. The switch came with 7.3.0-1 (commit cbd3c2573e, linux-cachyos/config) and is forced by the t2 patchset: drivers/platform/x86/Kconfig, config MACSMC_ACPI, depends on MFD_MACSMC_CORE && ACPI && !SENSORS_APPLESMC.
  2. macsmc-acpi binds ACPI APP0001, which pre-T2 Macs expose too (here, MacBookPro11,4, MacBookPro8,3), so the T2 driver now runs on all Intel Macs. Arch's linux 7.2.11 keeps CONFIG_SENSORS_APPLESMC=m.
  3. An out-of-tree applesmc only works with macsmc_acpi blacklisted: macsmc-acpi takes the SMC I/O port from _CRS without reserving it, so both drivers would access the same ports without a common lock.
  4. If applesmc comes back on 7.3: upstream converted it to hwmon_device_register_with_info() (94f5081d3592), renaming fanX_output to fanX_target and fanX_manual to pwmX_enable. mbpfan may need an update even then.

Suggestion: keep SENSORS_APPLESMC=m in the generic kernel and limit the macsmc backend to T2 Macs (separate build, or a T2 check at probe time instead of the Kconfig exclusion).

Weegee avatar Oct 26 '26 22:10 Weegee

i want to add that the applesmc module also provides the fan files in /sys/devices/aaplesmc.768 to manually control the fans. This is missing also, and can not be handeled through macsmc, as this is specific to Apple Silicon. Intel Macs are totally left out. If you intent to keep as is, it would be great to be served with a mac specific kernel in the Kernel Manager for intel and ARM based macs

DerNoli avatar Oct 30 '26 05:10 DerNoli

Thanks @ptr1337 I notice that CONFIG_SENSORS_APPLESMC is still not set in the Kconfig, so that patch will fix the wrong driver loading, and theoretically allow applesmc to be built, but applesmc will still not be built, so the pre-T2 intel macs still won't have a driver. Perhaps that's coming in another patch?

pallaswept avatar Nov 02 '26 12:11 pallaswept

8. Thanks @ptr1337 I notice that CONFIG_SENSORS_APPLESMC is still not set in the Kconfig, so that patch will fix the wrong driver loading, and theoretically allow applesmc to be built, but applesmc will still not be built, so the pre-T2 intel macs still won't have a driver. Perhaps that's coming in another patch?

as far as i can see the commit hasn't yet been pulled

DerNoli avatar Nov 02 '26 14:11 DerNoli

Yep. I'm just making sure that the missing applesmc driver doesn't slip through the cracks :)

pallaswept avatar Nov 02 '26 14:11 pallaswept

Root cause of the macsmc-battery power_now -95 errors, plus a fix (MacBookPro11,2, linux-cachyos 7.3.1-1):

macsmc_battery_acpi_read() returns -EOPNOTSUPP for SMC value types it doesn't decode. add_prop_uevent() only skips -ENODEV/-ENODATA/-EINVAL, so this error aborts the whole uevent:

  • the uevent files are empty
  • AC plug/unplug events never reach userspace, so UPower and KDE only notice after 15–30 s
  • udev has no POWER_SUPPLY_* properties, so systemd thinks there's no battery

Returning -ENODATA in the default: case fixes all three:

 	default:
-		return -EOPNOTSUPP;
+		return -ENODATA;

I tested it as a DKMS module: uevents are populated, plug events arrive in about 20 ms, and the errors are gone. The patch and a DKMS workaround for 7.3.1-1 are in this gist: https://gist.github.com/pierissimo/096376836167700c43d9db6563f0cb62

PR with the fix: https://github.com/CachyOS/linux/pull/18

pierissimo avatar Nov 03 '26 10:11 pierissimo

I can confirm the same issue on an Apple MacBookAir7,2 (pre-T2 Intel Mac).

On linux-cachyos 7.3.1-1-cachyos:

  • Keyboard backlight does not work.
  • modinfo applesmc reports: Module applesmc not found.
  • /sys/class/leds has no keyboard-backlight LED; it only shows the Mac SMC status LED and keyboard indicator LEDs.
  • evtest on “Apple Internal Keyboard / Trackpad” receives KEY_KBDILLUMDOWN and KEY_KBDILLUMUP when I press the backlight keys.
  • The kernel log says: applespi spi-APP000D:00: USB interface already enabled.
  • The keyboard backlight works immediately after booting linux-cachyos-lts.

This looks consistent with the missing SENSORS_APPLESMC support described here.

whydk avatar Nov 04 '26 18:11 whydk

Same issue on a MacBookPro8,1 (13", Early 2011, Sandy Bridge i5-2415M, no T2), but here it's worse than battery errors: the system becomes unusable on linux-cachyos 7.3.1-1.

Symptoms: boot is extremely sluggish, no graphical login possible (kwin_wayland aborts, [email protected] fails), every SSH login takes >1 min.

Cause: two processes are stuck in D state from boot onwards, both blocked inside the macsmc ACPI backend reading the SMC:

udev-worker (loading macsmc_hwmon):

apple_smc_acpi_port_read+0x2f9/0x520 [macsmc_acpi]
apple_smc_acpi_get_key_info+0xeb/0x1b0 [macsmc_acpi]
apple_smc_get_key_info+0x3a/0x60 [macsmc_core]
macsmc_hwmon_register_sensors_acpi+0x40/0x150 [macsmc_hwmon]
macsmc_hwmon_probe+0x3b4/0xb00 [macsmc_hwmon]
platform_probe+0x43/0x80
...

systemd-logind (reading the battery uevent), which is why login breaks:

apple_smc_read+0x28/0x60 [macsmc_core]
macsmc_battery_get_property+0x25d/0xd80 [macsmc_power]
power_supply_format_property+0x94/0x330
power_supply_uevent+0x128/0x1e0
dev_uevent+0x27b/0x3c0
uevent_show+0xa6/0x120
...

Also seen in dmesg: macsmc-accel macsmc-accel: probe with driver macsmc-accel failed with error -16 (tried to double register : in_accel_change_en).

Works: linux-cachyos-lts 6.18.60 and linux-cachyos 7.2.7 (both with applesmc). I've downgraded to 7.2.7 and pinned it for now.

Regarding the "restrict the ACPI SMC stack to T2 Macs" commit (b5b0300): +1 to the question above. With that patch alone, pre-T2 Macs would end up with no SMC driver at all (no fan control, sensors, ALS). Could CONFIG_SENSORS_APPLESMC=m be re-enabled for non-T2 machines?

ukleeberger avatar Nov 05 '26 10:11 ukleeberger

new kernel 7.3.3-1 still no applesmc with 7.2.xxx i was using both the regular kernel and the rt kernel (for realtime audio stuff) so i'd love to see applesmc implemented again in the cachyos kernel releases as it would support hardware that is too good to leave behind...

t8pt avatar Nov 07 '26 23:11 t8pt

Same bug on a MacBookPro11,1 (MacBook Pro 13" Mid 2014, A1502, no T2). On 7.3.3-1 it is now worse than on 7.3.1: pre-T2 Macs have no SMC driver at all.

7.3.1-1-cachyos: macsmc-acpi APP0001:00: Successfully Initialized (571 keys First key: #KEY (0x234b4559) Last key: zSEN (0x7a53454e)). The keyboard backlight worked as macsmc-led (plus the known macsmc-battery: driver failed to report 'power_now' property: -95 spam).

7.3.3-1-cachyos: macsmc_core and macsmc_acpi load, but nothing binds APP0001:00 (no driver link, nothing logged). /sys/class/leds/ has no keyboard light, there are no SMC fans/sensors, and the battery falls back to ACPI SBS (BAT0/ADP1).

Why, verified on the shipped packages:

  • 7.3.3 includes b5b0300 ("platform/x86: macsmc: restrict the ACPI SMC stack to T2 Macs"). apple_smc_acpi_probe() now starts with if (!has_apple_t2_chip) return -ENODEV;. -ENODEV from probe is not logged, which is why the failure is silent.
    • The 7.3.3 macsmc-acpi.ko imports has_apple_t2_chip (nm -u); the 7.3.1 build does not.
    • The disassembly is mov $0xffffffed,%eax; cmpb $0x1,has_apple_t2_chip; jne <return> at the top of the probe.
  • has_apple_t2_chip is set from the DMI product list in arch/x86/kernel/quirks.c (MacBookPro15,x/16,x, MacBookAir8,x/9,1, Macmini8,1, MacPro7,1, iMac20,x, iMacPro1,1). MacBookPro11,1 is correctly not in it, and there is no T2 PCI device (106b:1801/1802).
  • But applesmc is still not built: the 7.3.3-1 package .config has # CONFIG_SENSORS_APPLESMC is not set, there is no applesmc.ko in the package, and linux-cachyos/config line 5552 in this repo is unchanged since 7.3.0-1 (cbd3c2573e).

Since b5b0300 also makes applesmc_init() return -ENODEV on T2 Macs, the two drivers can no longer both claim the same Mac. So the fix looks like a one-line config change: CONFIG_SENSORS_APPLESMC=m (as @pallaswept noted above).

Workaround meanwhile: linux-cachyos-lts 6.18.60-2 has applesmc. smc::kbd_backlight works there, and systemd-backlight restores it across reboots.

desmvu avatar Nov 09 '26 20:11 desmvu

new kernel 7.3.4-1 - still no applesmc

t8pt avatar Nov 14 '26 09:11 t8pt

Same on MacBookPro11,5 (Mid 2015, no T2) with linux-cachyos 7.3.4-1: APP0001:00 stays unbound and there's no keyboard backlight, fans or SMC temps.

I can confirm that CONFIG_SENSORS_APPLESMC=m alone fixes it on 7.3.4. I built the unmodified v7.3.4 drivers/hwmon/applesmc.c out of tree (DKMS, LLVM=1) against the 7.3.4-1 headers, with macsmc_acpi still loaded and not blacklisted:

applesmc: key=758 fan=2 temp=52 index=47 acc=0 lux=2 kbd=1

smc::kbd_backlight, both fans and 47 temperature sensors work, the Plasma backlight keys work, and the battery is reported correctly by ACPI BAT0. Since b5b0300, macsmc_acpi returns -ENODEV before it maps or touches the SMC ports on non-T2 Macs, so the double-access concern raised earlier in this thread no longer applies on 7.3.4.

sbagneris avatar Nov 14 '26 16:11 sbagneris

for fan: add macsmc_hwmon.fan_control=1 to your cmdline for fan and t2fanrd and macfand are not gonna work, but any other generic fan daemon should work now, and please provide dmesg for other issues.

iurjscsi1101500 avatar Nov 20 '26 16:11 iurjscsi1101500

and the kbd_backlight is now exposed as macsmc-led in /sys/class/leds/

iurjscsi1101500 avatar Nov 20 '26 16:11 iurjscsi1101500

issues with battery and motion sensor, please provide dmesg

iurjscsi1101500 avatar Nov 20 '26 16:11 iurjscsi1101500

and btw, its not a T2 specific driver, its a driver for every intel mac, this gonna be upstreamed in some time, the only inconvenience is that the path will change

iurjscsi1101500 avatar Nov 20 '26 16:11 iurjscsi1101500

Same issue on a MacBookPro8,1 (13", Early 2011, Sandy Bridge i5-2415M, no T2), but here it's worse than battery errors: the system becomes unusable on linux-cachyos 7.3.1-1.

Symptoms: boot is extremely sluggish, no graphical login possible (kwin_wayland aborts, [email protected] fails), every SSH login takes >1 min.

Cause: two processes are stuck in D state from boot onwards, both blocked inside the macsmc ACPI backend reading the SMC:

udev-worker (loading macsmc_hwmon):

apple_smc_acpi_port_read+0x2f9/0x520 [macsmc_acpi]
apple_smc_acpi_get_key_info+0xeb/0x1b0 [macsmc_acpi]
apple_smc_get_key_info+0x3a/0x60 [macsmc_core]
macsmc_hwmon_register_sensors_acpi+0x40/0x150 [macsmc_hwmon]
macsmc_hwmon_probe+0x3b4/0xb00 [macsmc_hwmon]
platform_probe+0x43/0x80
...

systemd-logind (reading the battery uevent), which is why login breaks:

apple_smc_read+0x28/0x60 [macsmc_core]
macsmc_battery_get_property+0x25d/0xd80 [macsmc_power]
power_supply_format_property+0x94/0x330
power_supply_uevent+0x128/0x1e0
dev_uevent+0x27b/0x3c0
uevent_show+0xa6/0x120
...

Also seen in dmesg: macsmc-accel macsmc-accel: probe with driver macsmc-accel failed with error -16 (tried to double register : in_accel_change_en).

Works: linux-cachyos-lts 6.18.60 and linux-cachyos 7.2.7 (both with applesmc). I've downgraded to 7.2.7 and pinned it for now.

Regarding the "restrict the ACPI SMC stack to T2 Macs" commit (b5b0300): +1 to the question above. With that patch alone, pre-T2 Macs would end up with no SMC driver at all (no fan control, sensors, ALS). Could CONFIG_SENSORS_APPLESMC=m be re-enabled for non-T2 machines?

Can you provide DMESG please?, this looks like a legit bug

iurjscsi1101500 avatar Nov 20 '26 16:11 iurjscsi1101500

Root cause of the macsmc-battery power_now -95 errors, plus a fix (MacBookPro11,2, linux-cachyos 7.3.1-1):

macsmc_battery_acpi_read() returns -EOPNOTSUPP for SMC value types it doesn't decode. add_prop_uevent() only skips -ENODEV/-ENODATA/-EINVAL, so this error aborts the whole uevent:

  • the uevent files are empty
  • AC plug/unplug events never reach userspace, so UPower and KDE only notice after 15–30 s
  • udev has no POWER_SUPPLY_* properties, so systemd thinks there's no battery

Returning -ENODATA in the default: case fixes all three:

default:

  •   return -EOPNOTSUPP;
    
  •   return -ENODATA;
    

I tested it as a DKMS module: uevents are populated, plug events arrive in about 20 ms, and the errors are gone. The patch and a DKMS workaround for 7.3.1-1 are in this gist: https://gist.github.com/pierissimo/096376836167700c43d9db6563f0cb62

PR with the fix: CachyOS/linux#18

Fixed

iurjscsi1101500 avatar Nov 20 '26 16:11 iurjscsi1101500