Skip to content

Commit

Permalink
WIP: HID: transport: spi: add Apple SPI transport
Browse files Browse the repository at this point in the history
Keyboard and trackpad of Apple Sillicon SoCs (M1, M1 Pro/Max) laptops
are are HID devices connected via SPI.

This is the same protocol as implemented by applespi.c. It was not
noticed that protocol is a transport for HID. Adding support for ACPI
based Intel MacBooks will be done in a separate commit.

How HID is mapped in this protocol is not yet fully understood.

Microsoft has a specification for HID over SPI [1] incompatible with the
transport protocol used by Apple.

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/hid-over-spi

Signed-off-by: Janne Grunau <j@jannau.net>
  • Loading branch information
jannau authored and marcan committed Aug 2, 2022
1 parent 89d8ef5 commit 80d3940
Show file tree
Hide file tree
Showing 7 changed files with 1,238 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/hid/Kconfig
Expand Up @@ -1322,4 +1322,6 @@ source "drivers/hid/amd-sfh-hid/Kconfig"

source "drivers/hid/surface-hid/Kconfig"

source "drivers/hid/spi-hid/Kconfig"

endmenu
2 changes: 2 additions & 0 deletions drivers/hid/Makefile
Expand Up @@ -156,3 +156,5 @@ obj-$(INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ish-hid/
obj-$(CONFIG_AMD_SFH_HID) += amd-sfh-hid/

obj-$(CONFIG_SURFACE_HID_CORE) += surface-hid/

obj-$(CONFIG_SPI_HID_APPLE_CORE) += spi-hid/
26 changes: 26 additions & 0 deletions drivers/hid/spi-hid/Kconfig
@@ -0,0 +1,26 @@
# SPDX-License-Identifier: GPL-2.0-only
menu "SPI HID support"
depends on SPI

config SPI_HID_APPLE_OF
tristate "HID over SPI transport layer for Apple Silicon SoCs"
default ARCH_APPLE
depends on SPI && INPUT && OF
help
Say Y here if you use Apple Silicon based laptop. The keyboard and
touchpad are HID based devices connected via SPI.

If unsure, say N.

This support is also available as a module. If so, the module
will be called spi-hid-apple-of. It will also build/depend on the
module spi-hid-apple.

endmenu

config SPI_HID_APPLE_CORE
tristate
default y if SPI_HID_APPLE_OF=y
default m if SPI_HID_APPLE_OF=m
select HID
select CRC16
10 changes: 10 additions & 0 deletions drivers/hid/spi-hid/Makefile
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Makefile for SPI HID tarnsport drivers
#

obj-$(CONFIG_SPI_HID_APPLE_CORE) += spi-hid-apple.o

spi-hid-apple-objs = spi-hid-apple-core.o

obj-$(CONFIG_SPI_HID_APPLE_OF) += spi-hid-apple-of.o

0 comments on commit 80d3940

Please sign in to comment.