Skip to content

Commit d5e8434

Browse files
committed
HID: add device IDs for Apple SPI HID devices
Apple Silicon based laptop use SPI as transport for HID. Add support for SPI-based HID devices and and Apple keyboard and trackpad devices. Intel based laptops using the keyboard input driver applespi use the same HID over SPI protocol and can be supported later. This requires SPI keyboard/mouse HID types since Apple's intenal keyboards/trackpads use the same product id. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 038d61f commit d5e8434

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

drivers/hid/hid-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,6 +2303,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
23032303
case BUS_I2C:
23042304
bus = "I2C";
23052305
break;
2306+
case BUS_SPI:
2307+
bus = "SPI";
2308+
break;
23062309
case BUS_VIRTUAL:
23072310
bus = "VIRTUAL";
23082311
break;

drivers/hid/hid-ids.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393

9494
#define USB_VENDOR_ID_APPLE 0x05ac
9595
#define BT_VENDOR_ID_APPLE 0x004c
96+
#define SPI_VENDOR_ID_APPLE 0x05ac
9697
#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
9798
#define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
9899
#define USB_DEVICE_ID_APPLE_MAGICMOUSE2 0x0269
@@ -194,6 +195,10 @@
194195
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f
195196
#define USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT 0x8102
196197
#define USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY 0x8302
198+
#define SPI_DEVICE_ID_APPLE_MACBOOK_AIR_2020 0x0281
199+
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020 0x0341
200+
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO14_2021 0x0342
201+
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO16_2021 0x0343
197202

198203
#define USB_VENDOR_ID_ASETEK 0x2433
199204
#define USB_DEVICE_ID_ASETEK_INVICTA 0xf300

include/linux/hid.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ struct hid_input {
594594
enum hid_type {
595595
HID_TYPE_OTHER = 0,
596596
HID_TYPE_USBMOUSE,
597-
HID_TYPE_USBNONE
597+
HID_TYPE_USBNONE,
598+
HID_TYPE_SPI_KEYBOARD,
599+
HID_TYPE_SPI_MOUSE,
598600
};
599601

600602
enum hid_battery_status {
@@ -755,6 +757,8 @@ struct hid_descriptor {
755757
.bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod)
756758
#define HID_I2C_DEVICE(ven, prod) \
757759
.bus = BUS_I2C, .vendor = (ven), .product = (prod)
760+
#define HID_SPI_DEVICE(ven, prod) \
761+
.bus = BUS_SPI, .vendor = (ven), .product = (prod)
758762

759763
#define HID_REPORT_ID(rep) \
760764
.report_type = (rep)

0 commit comments

Comments
 (0)