Skip to content

Commit c167b9c

Browse files
qzedjwrdegoede
authored andcommitted
platform/surface: Add Surface Aggregator subsystem
Add Surface System Aggregator Module core and Surface Serial Hub driver, required for the embedded controller found on Microsoft Surface devices. The Surface System Aggregator Module (SSAM, SAM or Surface Aggregator) is an embedded controller (EC) found on 4th and later generation Microsoft Surface devices, with the exception of the Surface Go series. This EC provides various functionality, depending on the device in question. This can include battery status and thermal reporting (5th and later generations), but also HID keyboard (6th+) and touchpad input (7th+) on Surface Laptop and Surface Book 3 series devices. This patch provides the basic necessities for communication with the SAM EC on 5th and later generation devices. On these devices, the EC provides an interface that acts as serial device, called the Surface Serial Hub (SSH). 4th generation devices, on which the EC interface is provided via an HID-over-I2C device, are not supported by this patch. Specifically, this patch adds a driver for the SSH device (device HID MSHW0084 in ACPI), as well as a controller structure and associated API. This represents the functional core of the Surface Aggregator kernel subsystem, introduced with this patch, and will be expanded upon in subsequent commits. The SSH driver acts as the main attachment point for this subsystem and sets-up and manages the controller structure. The controller in turn provides a basic communication interface, allowing to send requests from host to EC and receiving the corresponding responses, as well as managing and receiving events, sent from EC to host. It is structured into multiple layers, with the top layer presenting the API used by other kernel drivers and the lower layers modeled after the serial protocol used for communication. Said other drivers are then responsible for providing the (Surface model specific) functionality accessible through the EC (e.g. battery status reporting, thermal information, ...) via said controller structure and API, and will be added in future commits. Signed-off-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
1 parent 5b56930 commit c167b9c

File tree

17 files changed

+8964
-0
lines changed

17 files changed

+8964
-0
lines changed

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11813,6 +11813,14 @@ L: [email protected]
1181311813
S: Supported
1181411814
F: drivers/platform/surface/surfacepro3_button.c
1181511815

11816+
MICROSOFT SURFACE SYSTEM AGGREGATOR SUBSYSTEM
11817+
M: Maximilian Luz <[email protected]>
11818+
S: Maintained
11819+
W: https://github.com/linux-surface/surface-aggregator-module
11820+
C: irc://chat.freenode.net/##linux-surface
11821+
F: drivers/platform/surface/aggregator/
11822+
F: include/linux/surface_aggregator/
11823+
1181611824
MICROTEK X6 SCANNER
1181711825
M: Oliver Neukum <[email protected]>
1181811826
S: Maintained

drivers/platform/surface/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@ config SURFACE_PRO3_BUTTON
5656
help
5757
This driver handles the power/home/volume buttons on the Microsoft Surface Pro 3/4 tablet.
5858

59+
source "drivers/platform/surface/aggregator/Kconfig"
60+
5961
endif # SURFACE_PLATFORMS

drivers/platform/surface/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
obj-$(CONFIG_SURFACE3_WMI) += surface3-wmi.o
88
obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o
99
obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o
10+
obj-$(CONFIG_SURFACE_AGGREGATOR) += aggregator/
1011
obj-$(CONFIG_SURFACE_GPE) += surface_gpe.o
1112
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-License-Identifier: GPL-2.0+
2+
# Copyright (C) 2019-2020 Maximilian Luz <[email protected]>
3+
4+
menuconfig SURFACE_AGGREGATOR
5+
tristate "Microsoft Surface System Aggregator Module Subsystem and Drivers"
6+
depends on SERIAL_DEV_BUS
7+
select CRC_CCITT
8+
help
9+
The Surface System Aggregator Module (Surface SAM or SSAM) is an
10+
embedded controller (EC) found on 5th- and later-generation Microsoft
11+
Surface devices (i.e. Surface Pro 5, Surface Book 2, Surface Laptop,
12+
and newer, with exception of Surface Go series devices).
13+
14+
Depending on the device in question, this EC provides varying
15+
functionality, including:
16+
- EC access from ACPI via Surface ACPI Notify (5th- and 6th-generation)
17+
- battery status information (all devices)
18+
- thermal sensor access (all devices)
19+
- performance mode / cooling mode control (all devices)
20+
- clipboard detachment system control (Surface Book 2 and 3)
21+
- HID / keyboard input (Surface Laptops, Surface Book 3)
22+
23+
This option controls whether the Surface SAM subsystem core will be
24+
built. This includes a driver for the Surface Serial Hub (SSH), which
25+
is the device responsible for the communication with the EC, and a
26+
basic kernel interface exposing the EC functionality to other client
27+
drivers, i.e. allowing them to make requests to the EC and receive
28+
events from it. Selecting this option alone will not provide any
29+
client drivers and therefore no functionality beyond the in-kernel
30+
interface. Said functionality is the responsibility of the respective
31+
client drivers.
32+
33+
Note: While 4th-generation Surface devices also make use of a SAM EC,
34+
due to a difference in the communication interface of the controller,
35+
only 5th and later generations are currently supported. Specifically,
36+
devices using SAM-over-SSH are supported, whereas devices using
37+
SAM-over-HID, which is used on the 4th generation, are currently not
38+
supported.
39+
40+
Choose m if you want to build the SAM subsystem core and SSH driver as
41+
module, y if you want to build it into the kernel and n if you don't
42+
want it at all.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: GPL-2.0+
2+
# Copyright (C) 2019-2020 Maximilian Luz <[email protected]>
3+
4+
obj-$(CONFIG_SURFACE_AGGREGATOR) += surface_aggregator.o
5+
6+
surface_aggregator-objs := core.o
7+
surface_aggregator-objs += ssh_parser.o
8+
surface_aggregator-objs += ssh_packet_layer.o
9+
surface_aggregator-objs += ssh_request_layer.o
10+
surface_aggregator-objs += controller.o

0 commit comments

Comments
 (0)