Skip to content

Add macsmc support for Intel Macs, replacing applesmc

Atharva Tiwari asahi keyrings linux-acpi linux-arm-kernel linux-gpio linux-hwmon linux-iio linux-integrity linux-leds linux-pci linux-pm linux-rtc linux-security-module linux-watchdog lkml mfd platform-driver-x86 sashiko-reviews 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 28 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14treewide: Add backend for macsmcMAINTAINERS drivers/gpio/Kconfig drivers/gpio/gpio-macsmc.c +12 more+337 -1662 replies
2/14platform/x86: add backend for macsmc in intel macsdrivers/platform/x86/Kconfig drivers/platform/x86/Makefile drivers/platform/x86/macsmc-acpi.c+706 -06 replies
3/14watchdog: add driver for apple smcdrivers/mfd/macsmc-core.c drivers/watchdog/Kconfig drivers/watchdog/Makefile +1 more+181 -00 replies
4/14iio/light: add new driver for macsmcdrivers/iio/light/Kconfig drivers/iio/light/Makefile drivers/iio/light/macsmc-light.c +1 more+232 -00 replies
5/14iio/accel: add driver for apple SMSdrivers/iio/accel/Kconfig drivers/iio/accel/Makefile drivers/iio/accel/macsmc-accel.c +1 more+281 -00 replies
6/14leds: add support for macsmc kbldrivers/leds/Kconfig drivers/leds/Makefile drivers/leds/leds-macsmc.c +1 more+114 -00 replies
7/14rtc: add support for x86 macs in macsmc-rtcdrivers/rtc/rtc-macsmc.c+112 -206 replies
8/14treewide: Add a flag to detect the Apple T2 chiparch/x86/kernel/quirks.c include/linux/platform_data/x86/apple.h security/integrity/platform_certs/keyring_handler.h +1 more+50 -380 replies
9/14treewide: disable other rtc's in t2 macsarch/x86/kernel/rtc.c drivers/acpi/acpi_tad.c drivers/rtc/rtc-cmos.c+15 -00 replies
10/14power/supply: add support for x86 macs in macsmc-powerdrivers/power/supply/macsmc-power.c+654 -1492 replies
11/14acpi: disable battery and adapter for x86 apple machinesdrivers/acpi/sbs.c drivers/acpi/x86/utils.c+9 -16 replies
12/14hwmon/macsmc: add more typesdrivers/hwmon/macsmc-hwmon.c+310 -01 reply
13/14hwmon: add support for x86 macs in macsmc-hwmondrivers/hwmon/Kconfig drivers/hwmon/macsmc-hwmon.c+827 -202 replies
14/14mfd/macsmc: add ioctl to access smc keysdrivers/mfd/macsmc-core.c include/linux/mfd/macsmc.h include/uapi/linux/macsmc.h+264 -562 replies

Reviews trailers per patch

None of the 14 patches has a Reviewed-by or Acked-by.

PatchIhor OdainyiAntoine SidemAditya Garg
1/14T-b T-b T-b
2/14T-b T-b T-b
3/14T-b T-b T-b
4/14T-b T-b
5/14T-b
6/14T-b T-b
7/14T-b
8/14T-b
9/14T-b
10/14T-b T-b T-b
11/14T-b T-b T-b
12/14T-b T-b T-b
13/14T-b T-b T-b
14/14T-b T-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 00/14] Add macsmc support for Intel Macs, replacing applesmc

applesmc is very old, and all of its code is lumped into one driver. Fan control, sensors, the light sensor, the motion sensor and the keyboard backlight in a single file with its own way of talking to the SMC. It is hard to extend and to support new machines.

This series adds Intel Mac support to the macsmc drivers that were written for Apple Silicon (the Asahi implementation). The SMC works the same way on both platforms, so we share a lot of code with Asahi. Only the way of talking to the SMC differs.

To make that work, patch 1 splits the macsmc driver into a common core and a backend. The existing RTKit code moves into its own backend. Patch 2 adds an ACPI backend for Intel Macs with I/O port, MMIO and interrupt support. After that, each function gets its own small driver using the standard kernel interfaces (hwmon, IIO, LEDs, power supply, RTC, watchdog), instead of one large driver doing everything.

On Intel Macs these drivers replace applesmc (hwmon, light sensor, motion sensor and keyboard backlight) and acpi-sbs (battery and adapter). They are mutually exclusive with the drivers they replace, so only one is used at a time.

The series is organised as follows:

  1      Split macsmc into a core and backends
  2      ACPI backend for Intel Macs
  3-6    New drivers: watchdog, IIO light and accelerometer,
         keyboard backlight LED
  7-9    RTC support for T2 Macs, a T2 detection flag, and
         disabling the broken ACPI RTCs
  10-11  Power supply support, replacing acpi-sbs
  12-13  hwmon support for Intel Macs
  14     ioctl for userspace access to SMC keys

Tested-on: MacBookPro16,1 , iMac20,1 , MacBookAir4,2 , MacBookPro12,1 , MacBookPro15,1, MacBookPro9,2, MacBookAir5,2.

Atharva Tiwari (14):
treewide: Add backend for macsmc
platform/x86: add backend for macsmc in intel macs
watchdog: add driver for apple smc
iio/light: add new driver for macsmc
iio/accel: add driver for apple SMS
leds: add support for macsmc kbl
rtc: add support for x86 macs in macsmc-rtc
treewide: Add a flag to detect the Apple T2 chip
treewide: disable other rtc's in t2 macs power/supply: add support for x86 macs in macsmc-power
acpi: disable battery and adapter for x86 apple machines hwmon/macsmc: add more types
hwmon: add support for x86 macs in macsmc-hwmon mfd/macsmc: add ioctl to access smc keys

 MAINTAINERS                                   |    2 +-
 arch/x86/kernel/quirks.c                      |   37 +
 arch/x86/kernel/rtc.c                         |    5 +
 drivers/acpi/acpi_tad.c                       |    5 +
 drivers/acpi/sbs.c                            |    5 +-
 drivers/acpi/x86/utils.c                      |    5 +
 drivers/gpio/Kconfig                          |    2 +-
 drivers/gpio/gpio-macsmc.c                    |   13 +-
 drivers/hwmon/Kconfig                         |    7 +-
 drivers/hwmon/macsmc-hwmon.c                  | 1152 ++++++++++++++++-
 drivers/iio/accel/Kconfig                     |   10 +
 drivers/iio/accel/Makefile                    |    1 +
 drivers/iio/accel/macsmc-accel.c              |  260 ++++
 drivers/iio/light/Kconfig                     |   11 +
 drivers/iio/light/Makefile                    |    1 +
 drivers/iio/light/macsmc-light.c              |  209 +++
 drivers/leds/Kconfig                          |   11 +
 drivers/leds/Makefile                         |    1 +
 drivers/leds/leds-macsmc.c                    |   91 ++
 drivers/mfd/Kconfig                           |   15 +-
 drivers/mfd/Makefile                          |    2 +-
 drivers/mfd/macsmc-core.c                     |  347 +++++
 drivers/platform/x86/Kconfig                  |   10 +
 drivers/platform/x86/Makefile                 |    1 +
 drivers/platform/x86/macsmc-acpi.c            |  695 ++++++++++
 drivers/power/reset/Kconfig                   |    2 +-
 drivers/power/supply/Kconfig                  |    2 +-
 drivers/power/supply/macsmc-power.c           |  803 +++++++++---
 drivers/rtc/Kconfig                           |    2 +-
 drivers/rtc/rtc-cmos.c                        |    5 +
 drivers/rtc/rtc-macsmc.c                      |  132 +-
 drivers/soc/apple/Kconfig                     |   14 +
 drivers/soc/apple/Makefile                    |    2 +
 .../macsmc.c => soc/apple/macsmc-rtkit.c}     |  185 ++-
 drivers/watchdog/Kconfig                      |   11 +
 drivers/watchdog/Makefile                     |    1 +
 drivers/watchdog/macsmc_wdt.c                 |  158 +++
 include/linux/mfd/macsmc.h                    |  153 +--
 include/linux/platform_data/x86/apple.h       |    5 +
 include/uapi/linux/macsmc.h                   |  119 ++
 .../platform_certs/keyring_handler.h          |    8 -
 security/integrity/platform_certs/load_uefi.c |   38 +-
 42 files changed, 4090 insertions(+), 448 deletions(-)
 create mode 100644 drivers/iio/accel/macsmc-accel.c
 create mode 100644 drivers/iio/light/macsmc-light.c
 create mode 100644 drivers/leds/leds-macsmc.c
 create mode 100644 drivers/mfd/macsmc-core.c
 create mode 100644 drivers/platform/x86/macsmc-acpi.c
 rename drivers/{mfd/macsmc.c => soc/apple/macsmc-rtkit.c} (70%)
 create mode 100644 drivers/watchdog/macsmc_wdt.c
 create mode 100644 include/uapi/linux/macsmc.h
Signature · 1 line
2.55.0