OSDN Git Service

platform/surface: Add Surface ACPI Notify driver
authorMaximilian Luz <luzmaximilian@gmail.com>
Mon, 21 Dec 2020 18:39:59 +0000 (19:39 +0100)
committerHans de Goede <hdegoede@redhat.com>
Wed, 6 Jan 2021 23:06:39 +0000 (00:06 +0100)
commitfc00bc8ac1dada4085f9308f85f2d6359da0faa8
treec4e56ab87d1f6e6bce5d531d5b2ba061b1804e8c
parent178f6ab77e617c984d6520b92e747075a12676ff
platform/surface: Add Surface ACPI Notify driver

The Surface ACPI Notify (SAN) device provides an ACPI interface to the
Surface Aggregator EC, specifically the Surface Serial Hub interface.
This interface allows EC requests to be made from ACPI code and can
convert a subset of EC events back to ACPI notifications.

Specifically, this interface provides a GenericSerialBus operation
region ACPI code can execute a request by writing the request command
data and payload to this operation region and reading back the
corresponding response via a write-then-read operation. Furthermore,
this interface provides a _DSM method to be called when certain events
from the EC have been received, essentially turning them into ACPI
notifications.

The driver provided in this commit essentially takes care of translating
the request data written to the operation region, executing the request,
waiting for it to finish, and finally writing and translating back the
response (if the request has one). Furthermore, this driver takes care
of enabling the events handled via ACPI _DSM calls. Lastly, this driver
also exposes an interface providing discrete GPU (dGPU) power-on
notifications on the Surface Book 2, which are also received via the
operation region interface (but not handled by the SAN driver directly),
making them accessible to other drivers (such as a dGPU hot-plug driver
that may be added later on).

On 5th and 6th generation Surface devices (Surface Pro 5/2017, Pro 6,
Book 2, Laptop 1 and 2), the SAN interface provides full battery and
thermal subsystem access, as well as other EC based functionality. On
those models, battery and thermal sensor devices are implemented as
standard ACPI devices of that type, however, forward ACPI calls to the
corresponding Surface Aggregator EC request via the SAN interface and
receive corresponding notifications (e.g. battery information change)
from it. This interface is therefore required to provide said
functionality on those devices.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201221183959.1186143-10-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Documentation/driver-api/surface_aggregator/clients/index.rst
Documentation/driver-api/surface_aggregator/clients/san.rst [new file with mode: 0644]
MAINTAINERS
drivers/platform/surface/Kconfig
drivers/platform/surface/Makefile
drivers/platform/surface/surface_acpi_notify.c [new file with mode: 0644]
include/linux/surface_acpi_notify.h [new file with mode: 0644]