Skip to contentSkip to conversation

HID: Add support for Surface Aggregator Module HID transport

PATCH In review Maximilian Luz 3 participants 6 messages Mar 10, 2021 – Mar 30, 2021

Subsystems (3)
lore
Share & tools
lore

Maximilian Luz

author maintainer
#0 lore raw

cover HID: Add support for Surface Aggregator Module HID transport

This series adds support for the Surface System Aggregator Module (SSAM) HID transport subsystem.

The SSAM is an embedded controller, found on 5th- and later generation Microsoft Surface devices. On some of these devices (specifically Surface Laptops 1, 2, and 3, as well as Surface Book 3), built-in input devices are connected via the SSAM. These devices communicate (mostly) via normal HID reports, so adding support for them is (mostly) just a matter of implementing an HID transport driver.

SSAM actually has two different HID interfaces: One (legacy) interface used on Surface Laptops 1 and 2, and a newer interface for the rest. The newer interface allows for multiple HID devices to be addressed and is implemented in the first patch. The older interface only allows a single HID device to be connected and, furthermore, only allows a single output report, specifically one for the caps lock LED. This is implemented in the second patch.

See the commit messages of the respective patches for more details.

Regards,
Max

Note: This patch depends on the

platform/surface: Add Surface Aggregator device registry

series. More specifically patch

platform/surface: Set up Surface Aggregator device registry

The full series has been merged into the for-next branch of the platform-drivers-x86 tree [1]. The commit in question can be found at [2].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=for-next
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=fc622b3d36e6d91330fb21506b9ad1e3206a4dde

Maximilian Luz (2):
HID: Add support for Surface Aggregator Module HID transport
HID: surface-hid: Add support for legacy keyboard interface

 MAINTAINERS                                |   7 +
 drivers/hid/Kconfig                        |   2 +
 drivers/hid/Makefile                       |   2 +
 drivers/hid/surface-hid/Kconfig            |  42 +++
 drivers/hid/surface-hid/Makefile           |   7 +
 drivers/hid/surface-hid/surface_hid.c      | 253 +++++++++++++++++
 drivers/hid/surface-hid/surface_hid_core.c | 272 +++++++++++++++++++
 drivers/hid/surface-hid/surface_hid_core.h |  77 ++++++
 drivers/hid/surface-hid/surface_kbd.c      | 300 +++++++++++++++++++++
 9 files changed, 962 insertions(+)
 create mode 100644 drivers/hid/surface-hid/Kconfig
 create mode 100644 drivers/hid/surface-hid/Makefile
 create mode 100644 drivers/hid/surface-hid/surface_hid.c
 create mode 100644 drivers/hid/surface-hid/surface_hid_core.c
 create mode 100644 drivers/hid/surface-hid/surface_hid_core.h
 create mode 100644 drivers/hid/surface-hid/surface_kbd.c
Signature · 1 line
2.30.1
author maintainer
#1 lore raw

PATCH 1/2 HID: Add support for Surface Aggregator Module HID transport

Add a HID transport driver to support integrated HID devices on newer Microsoft Surface models (specifically 7th-generation, i.e. Surface Laptop 3, Surface Book 3, and later).

On those models, the internal keyboard and touchpad (as well as some other HID devices with currently unknown function) are connected via the generic HID subsystem (TC=0x15) of the Surface System Aggregator Module (SSAM). This subsystem provides a generic HID transport layer, support for which is implemented by this driver.

---

Note: This patch depends on the

platform/surface: Add Surface Aggregator device registry

series. More specifically patch

platform/surface: Set up Surface Aggregator device registry

The full series has been merged into the for-next branch of the platform-drivers-x86 tree [1]. The commit in question can be found at [2].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=for-next
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=fc622b3d36e6d91330fb21506b9ad1e3206a4dde

---
 MAINTAINERS                                |   7 +
 drivers/hid/Kconfig                        |   2 +
 drivers/hid/Makefile                       |   2 +
 drivers/hid/surface-hid/Kconfig            |  28 +++
 drivers/hid/surface-hid/Makefile           |   6 +
 drivers/hid/surface-hid/surface_hid.c      | 253 +++++++++++++++++++
 drivers/hid/surface-hid/surface_hid_core.c | 272 +++++++++++++++++++++
 drivers/hid/surface-hid/surface_hid_core.h |  77 ++++++
 8 files changed, 647 insertions(+)
 create mode 100644 drivers/hid/surface-hid/Kconfig
 create mode 100644 drivers/hid/surface-hid/Makefile
 create mode 100644 drivers/hid/surface-hid/surface_hid.c
 create mode 100644 drivers/hid/surface-hid/surface_hid_core.c
 create mode 100644 drivers/hid/surface-hid/surface_hid_core.h
MAINTAINERS +7 -0
index 240e8a739fd1..bb6a796dc537 100644
@@ -11817,6 +11817,13 @@ S:	Maintained
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
 F:	drivers/platform/surface/
 
+MICROSOFT SURFACE HID TRANSPORT DRIVER
+M:	Maximilian Luz <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Maintained
+F:	drivers/hid/surface-hid/
+
 MICROSOFT SURFACE HOT-PLUG DRIVER
 M:	Maximilian Luz <[email protected]>
 L:	[email protected]
drivers/hid/Kconfig +2 -0
index 786b71ef7738..26e06097ba08 100644
@@ -1206,4 +1206,6 @@ source "drivers/hid/intel-ish-hid/Kconfig"
 
 source "drivers/hid/amd-sfh-hid/Kconfig"
 
+source "drivers/hid/surface-hid/Kconfig"
+
 endmenu
drivers/hid/Makefile +2 -0
index c4f6d5c613dc..1044ed238856 100644
@@ -145,3 +145,5 @@ obj-$(CONFIG_INTEL_ISH_HID)	+= intel-ish-hid/
 obj-$(INTEL_ISH_FIRMWARE_DOWNLOADER)	+= intel-ish-hid/
 
 obj-$(CONFIG_AMD_SFH_HID)       += amd-sfh-hid/
+
+obj-$(CONFIG_SURFACE_HID_CORE)  += surface-hid/
drivers/hid/surface-hid/Kconfig new file +28 -0
new file mode 100644
index 000000000000..642c7f0e64fe
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0+
+menu "Surface System Aggregator Module HID support"
+	depends on SURFACE_AGGREGATOR
+	depends on INPUT
+
+config SURFACE_HID
+	tristate "HID transport driver for Surface System Aggregator Module"
+	depends on SURFACE_AGGREGATOR_REGISTRY
+	select SURFACE_HID_CORE
+	help
+	  Driver to support integrated HID devices on newer Microsoft Surface
+	  models.
+
+	  This driver provides support for the HID transport protocol provided
+	  by the Surface Aggregator Module (i.e. the embedded controller) on
+	  7th-generation Microsoft Surface devices, i.e. Surface Book 3 and
+	  Surface Laptop 3. On those models, it is mainly used to connect the
+	  integrated touchpad and keyboard.
+
+	  Say M or Y here, if you want support for integrated HID devices, i.e.
+	  integrated touchpad and keyboard, on 7th generation Microsoft Surface
+	  models.
+
+endmenu
+
+config SURFACE_HID_CORE
+	tristate
+	select HID
drivers/hid/surface-hid/Makefile new file +6 -0
new file mode 100644
index 000000000000..62fc04632d3d
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Makefile - Surface System Aggregator Module (SSAM) HID transport driver.
+#
+obj-$(CONFIG_SURFACE_HID_CORE)	+= surface_hid_core.o
+obj-$(CONFIG_SURFACE_HID)	+= surface_hid.o
drivers/hid/surface-hid/surface_hid.c new file +253 -0

253 lines not on this page · raw message

drivers/hid/surface-hid/surface_hid_core.c new file +272 -0

272 lines not on this page · raw message

drivers/hid/surface-hid/surface_hid_core.h new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.30.1
author maintainer
#2 lore raw

PATCH 2/2 HID: surface-hid: Add support for legacy keyboard interface

In reply to Maximilian Luz

Add support for the legacy keyboard (KBD/TC=0x08) HID transport layer of the Surface System Aggregator Module (SSAM) to the Surface HID driver. On Surface Laptops 1 and 2, this interface is used to connect the integrated keyboard.

Note that this subsystem interface essentially provides a limited HID transport layer. In contrast to the generic HID interface (TC=0x15) used on newer Surface models, this interface only allows (as far as we know) for a single device to be connected and is otherwise severely limited in terms of support for feature- and output-reports. Specifically, only caps-lock-LED output-reports and a single read-only feature-report are supported.

---

Note: This patch depends on the

platform/surface: Add Surface Aggregator device registry

series. More specifically patch

platform/surface: Set up Surface Aggregator device registry

The full series has been merged into the for-next branch of the platform-drivers-x86 tree [1]. The commit in question can be found at [2].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=for-next
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=fc622b3d36e6d91330fb21506b9ad1e3206a4dde

---
 drivers/hid/surface-hid/Kconfig       |  14 ++
 drivers/hid/surface-hid/Makefile      |   1 +
 drivers/hid/surface-hid/surface_kbd.c | 300 ++++++++++++++++++++++++++
 3 files changed, 315 insertions(+)
 create mode 100644 drivers/hid/surface-hid/surface_kbd.c
drivers/hid/surface-hid/Kconfig +14 -0
index 642c7f0e64fe..7ce9b5d641eb 100644
@@ -21,6 +21,20 @@ config SURFACE_HID
 	  integrated touchpad and keyboard, on 7th generation Microsoft Surface
 	  models.
 
+config SURFACE_KBD
+	tristate "HID keyboard transport driver for Surface System Aggregator Module"
+	select SURFACE_HID_CORE
+	help
+	  Driver to support HID keyboards on Surface Laptop 1 and 2 devices.
+
+	  This driver provides support for the HID transport protocol provided
+	  by the Surface Aggregator Module (i.e. the embedded controller) on
+	  Microsoft Surface Laptops 1 and 2. It is used to connect the
+	  integrated keyboard on those devices.
+
+	  Say M or Y here, if you want support for the integrated keyboard on
+	  Microsoft Surface Laptops 1 and 2.
+
 endmenu
 
 config SURFACE_HID_CORE
drivers/hid/surface-hid/Makefile +1 -0
index 62fc04632d3d..4ae11cf09b25 100644
@@ -4,3 +4,4 @@
 #
 obj-$(CONFIG_SURFACE_HID_CORE)	+= surface_hid_core.o
 obj-$(CONFIG_SURFACE_HID)	+= surface_hid.o
+obj-$(CONFIG_SURFACE_KBD)	+= surface_kbd.o
drivers/hid/surface-hid/surface_kbd.c new file +300 -0

300 lines not on this page · raw message

Signature · 1 line
2.30.1
#3 lore raw
In reply to Maximilian Luz

Hi,

Quoted 29 lines · Maximilian Luz

This series adds support for the Surface System Aggregator Module (SSAM) HID transport subsystem.

The SSAM is an embedded controller, found on 5th- and later generation Microsoft Surface devices. On some of these devices (specifically Surface Laptops 1, 2, and 3, as well as Surface Book 3), built-in input devices are connected via the SSAM. These devices communicate (mostly) via normal HID reports, so adding support for them is (mostly) just a matter of implementing an HID transport driver.

SSAM actually has two different HID interfaces: One (legacy) interface used on Surface Laptops 1 and 2, and a newer interface for the rest. The newer interface allows for multiple HID devices to be addressed and is implemented in the first patch. The older interface only allows a single HID device to be connected and, furthermore, only allows a single output report, specifically one for the caps lock LED. This is implemented in the second patch.

See the commit messages of the respective patches for more details.

Regards,
Max

Note: This patch depends on the

platform/surface: Add Surface Aggregator device registry

series. More specifically patch

Quoted 8 lines

platform/surface: Set up Surface Aggregator device registry

The full series has been merged into the for-next branch of the platform-drivers-x86 tree [1]. The commit in question can be found at [2].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=for-next
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=fc622b3d36e6d91330fb21506b9ad1e3206a4dde

Jiri, I'll prepare an immutable branch with the necessary pdx86 pre-reqs for this and I'll send you a pull-req for that IM branch, then you can merge these through the HID tree after merging that pull-req.

Regards,

Hans

Quoted 22 lines

Maximilian Luz (2):
HID: Add support for Surface Aggregator Module HID transport
HID: surface-hid: Add support for legacy keyboard interface

 MAINTAINERS                                |   7 +
 drivers/hid/Kconfig                        |   2 +
 drivers/hid/Makefile                       |   2 +
 drivers/hid/surface-hid/Kconfig            |  42 +++
 drivers/hid/surface-hid/Makefile           |   7 +
 drivers/hid/surface-hid/surface_hid.c      | 253 +++++++++++++++++
 drivers/hid/surface-hid/surface_hid_core.c | 272 +++++++++++++++++++
 drivers/hid/surface-hid/surface_hid_core.h |  77 ++++++
 drivers/hid/surface-hid/surface_kbd.c      | 300 +++++++++++++++++++++
 9 files changed, 962 insertions(+)
 create mode 100644 drivers/hid/surface-hid/Kconfig
 create mode 100644 drivers/hid/surface-hid/Makefile
 create mode 100644 drivers/hid/surface-hid/surface_hid.c
 create mode 100644 drivers/hid/surface-hid/surface_hid_core.c
 create mode 100644 drivers/hid/surface-hid/surface_hid_core.h
 create mode 100644 drivers/hid/surface-hid/surface_kbd.c
author maintainer
#4 lore raw
In reply to Maximilian Luz
Quoted 52 lines · Maximilian Luz

This series adds support for the Surface System Aggregator Module (SSAM) HID transport subsystem.

The SSAM is an embedded controller, found on 5th- and later generation Microsoft Surface devices. On some of these devices (specifically Surface Laptops 1, 2, and 3, as well as Surface Book 3), built-in input devices are connected via the SSAM. These devices communicate (mostly) via normal HID reports, so adding support for them is (mostly) just a matter of implementing an HID transport driver.

SSAM actually has two different HID interfaces: One (legacy) interface used on Surface Laptops 1 and 2, and a newer interface for the rest. The newer interface allows for multiple HID devices to be addressed and is implemented in the first patch. The older interface only allows a single HID device to be connected and, furthermore, only allows a single output report, specifically one for the caps lock LED. This is implemented in the second patch.

See the commit messages of the respective patches for more details.

Regards,
Max

Note: This patch depends on the

platform/surface: Add Surface Aggregator device registry

series. More specifically patch

platform/surface: Set up Surface Aggregator device registry

The full series has been merged into the for-next branch of the platform-drivers-x86 tree [1]. The commit in question can be found at [2].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=for-next
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=fc622b3d36e6d91330fb21506b9ad1e3206a4dde

Maximilian Luz (2):
HID: Add support for Surface Aggregator Module HID transport
HID: surface-hid: Add support for legacy keyboard interface

  MAINTAINERS                                |   7 +
  drivers/hid/Kconfig                        |   2 +
  drivers/hid/Makefile                       |   2 +
  drivers/hid/surface-hid/Kconfig            |  42 +++
  drivers/hid/surface-hid/Makefile           |   7 +
  drivers/hid/surface-hid/surface_hid.c      | 253 +++++++++++++++++
  drivers/hid/surface-hid/surface_hid_core.c | 272 +++++++++++++++++++
  drivers/hid/surface-hid/surface_hid_core.h |  77 ++++++
  drivers/hid/surface-hid/surface_kbd.c      | 300 +++++++++++++++++++++
  9 files changed, 962 insertions(+)
Quoted 7 lines

create mode 100644 drivers/hid/surface-hid/Kconfig create mode 100644 drivers/hid/surface-hid/Makefile create mode 100644 drivers/hid/surface-hid/surface_hid.c create mode 100644 drivers/hid/surface-hid/surface_hid_core.c create mode 100644 drivers/hid/surface-hid/surface_hid_core.h create mode 100644 drivers/hid/surface-hid/surface_kbd.c

Hi, is there any status update on this?

Regards,
Max

maintainer
#5 lore raw
In reply to Maximilian Luz
Quoted 18 lines · Maximilian Luz

This series adds support for the Surface System Aggregator Module (SSAM) HID transport subsystem.

The SSAM is an embedded controller, found on 5th- and later generation Microsoft Surface devices. On some of these devices (specifically Surface Laptops 1, 2, and 3, as well as Surface Book 3), built-in input devices are connected via the SSAM. These devices communicate (mostly) via normal HID reports, so adding support for them is (mostly) just a matter of implementing an HID transport driver.

SSAM actually has two different HID interfaces: One (legacy) interface used on Surface Laptops 1 and 2, and a newer interface for the rest. The newer interface allows for multiple HID devices to be addressed and is implemented in the first patch. The older interface only allows a single HID device to be connected and, furthermore, only allows a single output report, specifically one for the caps lock LED. This is implemented in the second patch.

Quoted 1 line

See the commit messages of the respective patches for more details.

Now queued in hid.git#for-5.13/surface-system-aggregator-intergration

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs