Skip to content

Commit 7e5f51a

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 e9d65b4 commit 7e5f51a

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
@@ -2289,6 +2289,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
22892289
case BUS_I2C:
22902290
bus = "I2C";
22912291
break;
2292+
case BUS_SPI:
2293+
bus = "SPI";
2294+
break;
22922295
case BUS_VIRTUAL:
22932296
bus = "VIRTUAL";
22942297
break;

drivers/hid/hid-ids.h

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

9090
#define USB_VENDOR_ID_APPLE 0x05ac
9191
#define BT_VENDOR_ID_APPLE 0x004c
92+
#define SPI_VENDOR_ID_APPLE 0x05ac
9293
#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
9394
#define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
9495
#define USB_DEVICE_ID_APPLE_MAGICMOUSE2 0x0269
@@ -188,6 +189,10 @@
188189
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f
189190
#define USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT 0x8102
190191
#define USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY 0x8302
192+
#define SPI_DEVICE_ID_APPLE_MACBOOK_AIR_2020 0x0281
193+
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020 0x0341
194+
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO14_2021 0x0342
195+
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO16_2021 0x0343
191196

192197
#define USB_VENDOR_ID_ASUS 0x0486
193198
#define USB_DEVICE_ID_ASUS_T91MT 0x0185

include/linux/hid.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,9 @@ struct hid_input {
589589
enum hid_type {
590590
HID_TYPE_OTHER = 0,
591591
HID_TYPE_USBMOUSE,
592-
HID_TYPE_USBNONE
592+
HID_TYPE_USBNONE,
593+
HID_TYPE_SPI_KEYBOARD,
594+
HID_TYPE_SPI_MOUSE,
593595
};
594596

595597
enum hid_battery_status {
@@ -747,6 +749,8 @@ struct hid_descriptor {
747749
.bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod)
748750
#define HID_I2C_DEVICE(ven, prod) \
749751
.bus = BUS_I2C, .vendor = (ven), .product = (prod)
752+
#define HID_SPI_DEVICE(ven, prod) \
753+
.bus = BUS_SPI, .vendor = (ven), .product = (prod)
750754

751755
#define HID_REPORT_ID(rep) \
752756
.report_type = (rep)

0 commit comments

Comments
 (0)