162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0+
262306a36Sopenharmony_ci# Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
362306a36Sopenharmony_ci
462306a36Sopenharmony_cimenuconfig SURFACE_AGGREGATOR
562306a36Sopenharmony_ci	tristate "Microsoft Surface System Aggregator Module Subsystem and Drivers"
662306a36Sopenharmony_ci	depends on SERIAL_DEV_BUS
762306a36Sopenharmony_ci	depends on ACPI && !RISCV
862306a36Sopenharmony_ci	select CRC_CCITT
962306a36Sopenharmony_ci	help
1062306a36Sopenharmony_ci	  The Surface System Aggregator Module (Surface SAM or SSAM) is an
1162306a36Sopenharmony_ci	  embedded controller (EC) found on 5th- and later-generation Microsoft
1262306a36Sopenharmony_ci	  Surface devices (i.e. Surface Pro 5, Surface Book 2, Surface Laptop,
1362306a36Sopenharmony_ci	  and newer, with exception of Surface Go series devices).
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci	  Depending on the device in question, this EC provides varying
1662306a36Sopenharmony_ci	  functionality, including:
1762306a36Sopenharmony_ci	  - EC access from ACPI via Surface ACPI Notify (5th- and 6th-generation)
1862306a36Sopenharmony_ci	  - battery status information (all devices)
1962306a36Sopenharmony_ci	  - thermal sensor access (all devices)
2062306a36Sopenharmony_ci	  - performance mode / cooling mode control (all devices)
2162306a36Sopenharmony_ci	  - clipboard detachment system control (Surface Book 2 and 3)
2262306a36Sopenharmony_ci	  - HID / keyboard input (Surface Laptops, Surface Book 3)
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci	  This option controls whether the Surface SAM subsystem core will be
2562306a36Sopenharmony_ci	  built. This includes a driver for the Surface Serial Hub (SSH), which
2662306a36Sopenharmony_ci	  is the device responsible for the communication with the EC, and a
2762306a36Sopenharmony_ci	  basic kernel interface exposing the EC functionality to other client
2862306a36Sopenharmony_ci	  drivers, i.e. allowing them to make requests to the EC and receive
2962306a36Sopenharmony_ci	  events from it. Selecting this option alone will not provide any
3062306a36Sopenharmony_ci	  client drivers and therefore no functionality beyond the in-kernel
3162306a36Sopenharmony_ci	  interface. Said functionality is the responsibility of the respective
3262306a36Sopenharmony_ci	  client drivers.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	  Note: While 4th-generation Surface devices also make use of a SAM EC,
3562306a36Sopenharmony_ci	  due to a difference in the communication interface of the controller,
3662306a36Sopenharmony_ci	  only 5th and later generations are currently supported. Specifically,
3762306a36Sopenharmony_ci	  devices using SAM-over-SSH are supported, whereas devices using
3862306a36Sopenharmony_ci	  SAM-over-HID, which is used on the 4th generation, are currently not
3962306a36Sopenharmony_ci	  supported.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	  Choose m if you want to build the SAM subsystem core and SSH driver as
4262306a36Sopenharmony_ci	  module, y if you want to build it into the kernel and n if you don't
4362306a36Sopenharmony_ci	  want it at all.
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciconfig SURFACE_AGGREGATOR_BUS
4662306a36Sopenharmony_ci	bool "Surface System Aggregator Module Bus"
4762306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR
4862306a36Sopenharmony_ci	default y
4962306a36Sopenharmony_ci	help
5062306a36Sopenharmony_ci	  Expands the Surface System Aggregator Module (SSAM) core driver by
5162306a36Sopenharmony_ci	  providing a dedicated bus and client-device type.
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci	  This bus and device type are intended to provide and simplify support
5462306a36Sopenharmony_ci	  for non-platform and non-ACPI SSAM devices, i.e. SSAM devices that are
5562306a36Sopenharmony_ci	  not auto-detectable via the conventional means (e.g. ACPI).
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ciconfig SURFACE_AGGREGATOR_ERROR_INJECTION
5862306a36Sopenharmony_ci	bool "Surface System Aggregator Module Error Injection Capabilities"
5962306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR
6062306a36Sopenharmony_ci	depends on FUNCTION_ERROR_INJECTION
6162306a36Sopenharmony_ci	help
6262306a36Sopenharmony_ci	  Provides error-injection capabilities for the Surface System
6362306a36Sopenharmony_ci	  Aggregator Module subsystem and Surface Serial Hub driver.
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci	  Specifically, exports error injection hooks to be used with the
6662306a36Sopenharmony_ci	  kernel's function error injection capabilities to simulate underlying
6762306a36Sopenharmony_ci	  transport and communication problems, such as invalid data sent to or
6862306a36Sopenharmony_ci	  received from the EC, dropped data, and communication timeouts.
6962306a36Sopenharmony_ci	  Intended for development and debugging.
70