162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# Microsoft Surface Platform-Specific Drivers
462306a36Sopenharmony_ci#
562306a36Sopenharmony_ci
662306a36Sopenharmony_cimenuconfig SURFACE_PLATFORMS
762306a36Sopenharmony_ci	bool "Microsoft Surface Platform-Specific Device Drivers"
862306a36Sopenharmony_ci	depends on ARM64 || X86 || COMPILE_TEST
962306a36Sopenharmony_ci	default y
1062306a36Sopenharmony_ci	help
1162306a36Sopenharmony_ci	  Say Y here to get to see options for platform-specific device drivers
1262306a36Sopenharmony_ci	  for Microsoft Surface devices. This option alone does not add any
1362306a36Sopenharmony_ci	  kernel code.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci	  If you say N, all options in this submenu will be skipped and disabled.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciif SURFACE_PLATFORMS
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciconfig SURFACE3_WMI
2062306a36Sopenharmony_ci	tristate "Surface 3 WMI Driver"
2162306a36Sopenharmony_ci	depends on ACPI_WMI
2262306a36Sopenharmony_ci	depends on DMI
2362306a36Sopenharmony_ci	depends on INPUT
2462306a36Sopenharmony_ci	depends on SPI
2562306a36Sopenharmony_ci	help
2662306a36Sopenharmony_ci	  Say Y here if you have a Surface 3.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci	  To compile this driver as a module, choose M here: the module will
2962306a36Sopenharmony_ci	  be called surface3-wmi.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciconfig SURFACE_3_POWER_OPREGION
3262306a36Sopenharmony_ci	tristate "Surface 3 battery platform operation region support"
3362306a36Sopenharmony_ci	depends on ACPI
3462306a36Sopenharmony_ci	depends on I2C
3562306a36Sopenharmony_ci	help
3662306a36Sopenharmony_ci	  This driver provides support for ACPI operation
3762306a36Sopenharmony_ci	  region of the Surface 3 battery platform driver.
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciconfig SURFACE_ACPI_NOTIFY
4062306a36Sopenharmony_ci	tristate "Surface ACPI Notify Driver"
4162306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR
4262306a36Sopenharmony_ci	help
4362306a36Sopenharmony_ci	  Surface ACPI Notify (SAN) driver for Microsoft Surface devices.
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci	  This driver provides support for the ACPI interface (called SAN) of
4662306a36Sopenharmony_ci	  the Surface System Aggregator Module (SSAM) EC. This interface is used
4762306a36Sopenharmony_ci	  on 5th- and 6th-generation Microsoft Surface devices (including
4862306a36Sopenharmony_ci	  Surface Pro 5 and 6, Surface Book 2, Surface Laptops 1 and 2, and in
4962306a36Sopenharmony_ci	  reduced functionality on the Surface Laptop 3) to execute SSAM
5062306a36Sopenharmony_ci	  requests directly from ACPI code, as well as receive SSAM events and
5162306a36Sopenharmony_ci	  turn them into ACPI notifications. It essentially acts as a
5262306a36Sopenharmony_ci	  translation layer between the SSAM controller and ACPI.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci	  Specifically, this driver may be needed for battery status reporting,
5562306a36Sopenharmony_ci	  thermal sensor access, and real-time clock information, depending on
5662306a36Sopenharmony_ci	  the Surface device in question.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciconfig SURFACE_AGGREGATOR_CDEV
5962306a36Sopenharmony_ci	tristate "Surface System Aggregator Module User-Space Interface"
6062306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR
6162306a36Sopenharmony_ci	help
6262306a36Sopenharmony_ci	  Provides a misc-device interface to the Surface System Aggregator
6362306a36Sopenharmony_ci	  Module (SSAM) controller.
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci	  This option provides a module (called surface_aggregator_cdev), that,
6662306a36Sopenharmony_ci	  when loaded, will add a client device (and its respective driver) to
6762306a36Sopenharmony_ci	  the SSAM controller. Said client device manages a misc-device
6862306a36Sopenharmony_ci	  interface (/dev/surface/aggregator), which can be used by user-space
6962306a36Sopenharmony_ci	  tools to directly communicate with the SSAM EC by sending requests and
7062306a36Sopenharmony_ci	  receiving the corresponding responses.
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci	  The provided interface is intended for debugging and development only,
7362306a36Sopenharmony_ci	  and should not be used otherwise.
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciconfig SURFACE_AGGREGATOR_HUB
7662306a36Sopenharmony_ci	tristate "Surface System Aggregator Module Subsystem Device Hubs"
7762306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR
7862306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR_BUS
7962306a36Sopenharmony_ci	help
8062306a36Sopenharmony_ci	  Device-hub drivers for Surface System Aggregator Module (SSAM) subsystem
8162306a36Sopenharmony_ci	  devices.
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci	  Provides subsystem hub drivers which manage client devices on various
8462306a36Sopenharmony_ci	  SSAM subsystems. In some subsystems, notably the BAS subsystem managing
8562306a36Sopenharmony_ci	  devices contained in the base of the Surface Book 3 and the KIP subsystem
8662306a36Sopenharmony_ci	  managing type-cover devices in the Surface Pro 8 and Surface Pro X,
8762306a36Sopenharmony_ci	  devices can be (hot-)removed. Hub devices and drivers are required to
8862306a36Sopenharmony_ci	  manage these subdevices.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci	  Devices managed via these hubs are:
9162306a36Sopenharmony_ci	  - Battery/AC devices (Surface Book 3).
9262306a36Sopenharmony_ci	  - HID input devices (7th-generation and later models with detachable
9362306a36Sopenharmony_ci	    input devices).
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci	  Select M (recommended) or Y here if you want support for the above
9662306a36Sopenharmony_ci	  mentioned devices on the corresponding Surface models. Without this
9762306a36Sopenharmony_ci	  module, the respective devices mentioned above will not be instantiated
9862306a36Sopenharmony_ci	  and thus any functionality provided by them will be missing, even when
9962306a36Sopenharmony_ci	  drivers for these devices are present. This module only provides the
10062306a36Sopenharmony_ci	  respective subsystem hubs. Both drivers and device specification (e.g.
10162306a36Sopenharmony_ci	  via the Surface Aggregator Registry) for these devices still need to be
10262306a36Sopenharmony_ci	  selected via other options.
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ciconfig SURFACE_AGGREGATOR_REGISTRY
10562306a36Sopenharmony_ci	tristate "Surface System Aggregator Module Device Registry"
10662306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR
10762306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR_BUS
10862306a36Sopenharmony_ci	help
10962306a36Sopenharmony_ci	  Device-registry for Surface System Aggregator Module (SSAM) devices.
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci	  Provides a module and driver which act as a device-registry for SSAM
11262306a36Sopenharmony_ci	  client devices that cannot be detected automatically, e.g. via ACPI.
11362306a36Sopenharmony_ci	  Such devices are instead provided and managed via this registry.
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci	  Devices provided via this registry are:
11662306a36Sopenharmony_ci	  - Platform profile (performance-/cooling-mode) device (5th- and later
11762306a36Sopenharmony_ci	    generations).
11862306a36Sopenharmony_ci	  - Battery/AC devices (7th-generation).
11962306a36Sopenharmony_ci	  - HID input devices (7th-generation).
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci	  Select M (recommended) or Y here if you want support for the above
12262306a36Sopenharmony_ci	  mentioned devices on the corresponding Surface models. Without this
12362306a36Sopenharmony_ci	  module, the respective devices will not be instantiated and thus any
12462306a36Sopenharmony_ci	  functionality provided by them will be missing, even when drivers for
12562306a36Sopenharmony_ci	  these devices are present. In other words, this module only provides
12662306a36Sopenharmony_ci	  the respective client devices. Drivers for these devices still need to
12762306a36Sopenharmony_ci	  be selected via the other options.
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ciconfig SURFACE_AGGREGATOR_TABLET_SWITCH
13062306a36Sopenharmony_ci	tristate "Surface Aggregator Generic Tablet-Mode Switch Driver"
13162306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR
13262306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR_BUS
13362306a36Sopenharmony_ci	depends on INPUT
13462306a36Sopenharmony_ci	help
13562306a36Sopenharmony_ci	  Provides a tablet-mode switch input device on Microsoft Surface models
13662306a36Sopenharmony_ci	  using the KIP subsystem for detachable keyboards (e.g. keyboard covers)
13762306a36Sopenharmony_ci	  or the POS subsystem for device/screen posture changes.
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci	  The KIP subsystem is used on newer Surface generations to handle
14062306a36Sopenharmony_ci	  detachable input peripherals, specifically the keyboard cover (containing
14162306a36Sopenharmony_ci	  keyboard and touchpad) on the Surface Pro 8 and Surface Pro X. The POS
14262306a36Sopenharmony_ci	  subsystem is used for device posture change notifications on the Surface
14362306a36Sopenharmony_ci	  Laptop Studio. This module provides a driver to let user-space know when
14462306a36Sopenharmony_ci	  the device should be considered in tablet-mode due to the keyboard cover
14562306a36Sopenharmony_ci	  being detached or folded back (essentially signaling when the keyboard is
14662306a36Sopenharmony_ci	  not available for input). It does so by creating a tablet-mode switch
14762306a36Sopenharmony_ci	  input device, sending the standard SW_TABLET_MODE event on mode change.
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci	  Select M or Y here, if you want to provide tablet-mode switch input
15062306a36Sopenharmony_ci	  events on the Surface Pro 8, Surface Pro X, and Surface Laptop Studio.
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ciconfig SURFACE_DTX
15362306a36Sopenharmony_ci	tristate "Surface DTX (Detachment System) Driver"
15462306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR
15562306a36Sopenharmony_ci	depends on INPUT
15662306a36Sopenharmony_ci	help
15762306a36Sopenharmony_ci	  Driver for the Surface Book clipboard detachment system (DTX).
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci	  On the Surface Book series devices, the display part containing the
16062306a36Sopenharmony_ci	  CPU (called the clipboard) can be detached from the base (containing a
16162306a36Sopenharmony_ci	  battery, the keyboard, and, optionally, a discrete GPU) by (if
16262306a36Sopenharmony_ci	  necessary) unlocking and opening the latch connecting both parts.
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci	  This driver provides a user-space interface that can influence the
16562306a36Sopenharmony_ci	  behavior of this process, which includes the option to abort it in
16662306a36Sopenharmony_ci	  case the base is still in use or speed it up in case it is not.
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci	  Note that this module can be built without support for the Surface
16962306a36Sopenharmony_ci	  Aggregator Bus (i.e. CONFIG_SURFACE_AGGREGATOR_BUS=n). In that case,
17062306a36Sopenharmony_ci	  some devices, specifically the Surface Book 3, will not be supported.
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ciconfig SURFACE_GPE
17362306a36Sopenharmony_ci	tristate "Surface GPE/Lid Support Driver"
17462306a36Sopenharmony_ci	depends on ACPI
17562306a36Sopenharmony_ci	depends on DMI
17662306a36Sopenharmony_ci	help
17762306a36Sopenharmony_ci	  This driver marks the GPEs related to the ACPI lid device found on
17862306a36Sopenharmony_ci	  Microsoft Surface devices as wakeup sources and prepares them
17962306a36Sopenharmony_ci	  accordingly. It is required on those devices to allow wake-ups from
18062306a36Sopenharmony_ci	  suspend by opening the lid.
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ciconfig SURFACE_HOTPLUG
18362306a36Sopenharmony_ci	tristate "Surface Hot-Plug Driver"
18462306a36Sopenharmony_ci	depends on ACPI
18562306a36Sopenharmony_ci	depends on GPIOLIB
18662306a36Sopenharmony_ci	help
18762306a36Sopenharmony_ci	  Driver for out-of-band hot-plug event signaling on Microsoft Surface
18862306a36Sopenharmony_ci	  devices with hot-pluggable PCIe cards.
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci	  This driver is used on Surface Book (2 and 3) devices with a
19162306a36Sopenharmony_ci	  hot-pluggable discrete GPU (dGPU). When not in use, the dGPU on those
19262306a36Sopenharmony_ci	  devices can enter D3cold, which prevents in-band (standard) PCIe
19362306a36Sopenharmony_ci	  hot-plug signaling. Thus, without this driver, detaching the base
19462306a36Sopenharmony_ci	  containing the dGPU will not correctly update the state of the
19562306a36Sopenharmony_ci	  corresponding PCIe device if it is in D3cold. This driver adds support
19662306a36Sopenharmony_ci	  for out-of-band hot-plug notifications, ensuring that the device state
19762306a36Sopenharmony_ci	  is properly updated even when the device in question is in D3cold.
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci	  Select M or Y here, if you want to (fully) support hot-plugging of
20062306a36Sopenharmony_ci	  dGPU devices on the Surface Book 2 and/or 3 during D3cold.
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ciconfig SURFACE_PLATFORM_PROFILE
20362306a36Sopenharmony_ci	tristate "Surface Platform Profile Driver"
20462306a36Sopenharmony_ci	depends on ACPI
20562306a36Sopenharmony_ci	depends on SURFACE_AGGREGATOR_REGISTRY
20662306a36Sopenharmony_ci	select ACPI_PLATFORM_PROFILE
20762306a36Sopenharmony_ci	help
20862306a36Sopenharmony_ci	  Provides support for the ACPI platform profile on 5th- and later
20962306a36Sopenharmony_ci	  generation Microsoft Surface devices.
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci	  More specifically, this driver provides ACPI platform profile support
21262306a36Sopenharmony_ci	  on Microsoft Surface devices with a Surface System Aggregator Module
21362306a36Sopenharmony_ci	  (SSAM) connected via the Surface Serial Hub (SSH / SAM-over-SSH). In
21462306a36Sopenharmony_ci	  other words, this driver provides platform profile support on the
21562306a36Sopenharmony_ci	  Surface Pro 5, Surface Book 2, Surface Laptop, Surface Laptop Go and
21662306a36Sopenharmony_ci	  later. On those devices, the platform profile can significantly
21762306a36Sopenharmony_ci	  influence cooling behavior, e.g. setting it to 'quiet' (default) or
21862306a36Sopenharmony_ci	  'low-power' can significantly limit performance of the discrete GPU on
21962306a36Sopenharmony_ci	  Surface Books, while in turn leading to lower power consumption and/or
22062306a36Sopenharmony_ci	  less fan noise.
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci	  Select M or Y here, if you want to include ACPI platform profile
22362306a36Sopenharmony_ci	  support on the above mentioned devices.
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ciconfig SURFACE_PRO3_BUTTON
22662306a36Sopenharmony_ci	tristate "Power/home/volume buttons driver for Microsoft Surface Pro 3/4 tablet"
22762306a36Sopenharmony_ci	depends on ACPI
22862306a36Sopenharmony_ci	depends on INPUT
22962306a36Sopenharmony_ci	help
23062306a36Sopenharmony_ci	  This driver handles the power/home/volume buttons on the Microsoft Surface Pro 3/4 tablet.
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_cisource "drivers/platform/surface/aggregator/Kconfig"
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ciendif # SURFACE_PLATFORMS
235