mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
fc00bc8ac1
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>
39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* Interface for Surface ACPI Notify (SAN) driver.
|
|
*
|
|
* Provides access to discrete GPU notifications sent from ACPI via the SAN
|
|
* driver, which are not handled by this driver directly.
|
|
*
|
|
* Copyright (C) 2019-2020 Maximilian Luz <luzmaximilian@gmail.com>
|
|
*/
|
|
|
|
#ifndef _LINUX_SURFACE_ACPI_NOTIFY_H
|
|
#define _LINUX_SURFACE_ACPI_NOTIFY_H
|
|
|
|
#include <linux/notifier.h>
|
|
#include <linux/types.h>
|
|
|
|
/**
|
|
* struct san_dgpu_event - Discrete GPU ACPI event.
|
|
* @category: Category of the event.
|
|
* @target: Target ID of the event source.
|
|
* @command: Command ID of the event.
|
|
* @instance: Instance ID of the event source.
|
|
* @length: Length of the event's payload data (in bytes).
|
|
* @payload: Pointer to the event's payload data.
|
|
*/
|
|
struct san_dgpu_event {
|
|
u8 category;
|
|
u8 target;
|
|
u8 command;
|
|
u8 instance;
|
|
u16 length;
|
|
u8 *payload;
|
|
};
|
|
|
|
int san_client_link(struct device *client);
|
|
int san_dgpu_notifier_register(struct notifier_block *nb);
|
|
int san_dgpu_notifier_unregister(struct notifier_block *nb);
|
|
|
|
#endif /* _LINUX_SURFACE_ACPI_NOTIFY_H */
|