linux/drivers/platform/surface/surface_aggregator_registry.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Surface System Aggregator Module (SSAM) client device registry.
 *
 * Registry for non-platform/non-ACPI SSAM client devices, i.e. devices that
 * cannot be auto-detected. Provides device-hubs and performs instantiation
 * for these devices.
 *
 * Copyright (C) 2020-2022 Maximilian Luz <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/types.h>

#include <linux/surface_aggregator/device.h>


/* -- Device registry. ------------------------------------------------------ */

/*
 * SSAM device names follow the SSAM module alias, meaning they are prefixed
 * with 'ssam:', followed by domain, category, target ID, instance ID, and
 * function, each encoded as two-digit hexadecimal, separated by ':'. In other
 * words, it follows the scheme
 *
 *      ssam:dd:cc:tt:ii:ff
 *
 * Where, 'dd', 'cc', 'tt', 'ii', and 'ff' are the two-digit hexadecimal
 * values mentioned above, respectively.
 */

/* Root node. */
static const struct software_node ssam_node_root =;

/* KIP device hub (connects keyboard cover devices on Surface Pro 8). */
static const struct software_node ssam_node_hub_kip =;

/* Base device hub (devices attached to Surface Book 3 base). */
static const struct software_node ssam_node_hub_base =;

/* AC adapter. */
static const struct software_node ssam_node_bat_ac =;

/* Primary battery. */
static const struct software_node ssam_node_bat_main =;

/* Secondary battery (Surface Book 3). */
static const struct software_node ssam_node_bat_sb3base =;

/* Platform profile / performance-mode device without a fan. */
static const struct software_node ssam_node_tmp_perf_profile =;

/* Platform profile / performance-mode device with a fan, such that
 * the fan controller profile can also be switched.
 */
static const struct property_entry ssam_node_tmp_perf_profile_has_fan[] =;

static const struct software_node ssam_node_tmp_perf_profile_with_fan =;

/* Thermal sensors. */
static const struct software_node ssam_node_tmp_sensors =;

/* Fan speed function. */
static const struct software_node ssam_node_fan_speed =;

/* Tablet-mode switch via KIP subsystem. */
static const struct software_node ssam_node_kip_tablet_switch =;

/* DTX / detachment-system device (Surface Book 3). */
static const struct software_node ssam_node_bas_dtx =;

/* HID keyboard (SAM, TID=1). */
static const struct software_node ssam_node_hid_sam_keyboard =;

/* HID pen stash (SAM, TID=1; pen taken / stashed away evens). */
static const struct software_node ssam_node_hid_sam_penstash =;

/* HID touchpad (SAM, TID=1). */
static const struct software_node ssam_node_hid_sam_touchpad =;

/* HID device instance 6 (SAM, TID=1, HID sensor collection). */
static const struct software_node ssam_node_hid_sam_sensors =;

/* HID device instance 7 (SAM, TID=1, UCM UCSI HID client). */
static const struct software_node ssam_node_hid_sam_ucm_ucsi =;

/* HID system controls (SAM, TID=1). */
static const struct software_node ssam_node_hid_sam_sysctrl =;

/* HID keyboard. */
static const struct software_node ssam_node_hid_main_keyboard =;

/* HID touchpad. */
static const struct software_node ssam_node_hid_main_touchpad =;

/* HID device instance 5 (unknown HID device). */
static const struct software_node ssam_node_hid_main_iid5 =;

/* HID keyboard (base hub). */
static const struct software_node ssam_node_hid_base_keyboard =;

/* HID touchpad (base hub). */
static const struct software_node ssam_node_hid_base_touchpad =;

/* HID device instance 5 (unknown HID device, base hub). */
static const struct software_node ssam_node_hid_base_iid5 =;

/* HID device instance 6 (unknown HID device, base hub). */
static const struct software_node ssam_node_hid_base_iid6 =;

/* HID keyboard (KIP hub). */
static const struct software_node ssam_node_hid_kip_keyboard =;

/* HID pen stash (KIP hub; pen taken / stashed away evens). */
static const struct software_node ssam_node_hid_kip_penstash =;

/* HID touchpad (KIP hub). */
static const struct software_node ssam_node_hid_kip_touchpad =;

/* HID device instance 5 (KIP hub, type-cover firmware update). */
static const struct software_node ssam_node_hid_kip_fwupd =;

/* Tablet-mode switch via POS subsystem. */
static const struct software_node ssam_node_pos_tablet_switch =;

/*
 * Devices for 5th- and 6th-generations models:
 * - Surface Book 2,
 * - Surface Laptop 1 and 2,
 * - Surface Pro 5 and 6.
 */
static const struct software_node *ssam_node_group_gen5[] =;

/* Devices for Surface Book 3. */
static const struct software_node *ssam_node_group_sb3[] =;

/* Devices for Surface Laptop 3 and 4. */
static const struct software_node *ssam_node_group_sl3[] =;

/* Devices for Surface Laptop 5. */
static const struct software_node *ssam_node_group_sl5[] =;

/* Devices for Surface Laptop 6. */
static const struct software_node *ssam_node_group_sl6[] =;

/* Devices for Surface Laptop 7. */
static const struct software_node *ssam_node_group_sl7[] =;

/* Devices for Surface Laptop Studio 1. */
static const struct software_node *ssam_node_group_sls1[] =;

/* Devices for Surface Laptop Studio 2. */
static const struct software_node *ssam_node_group_sls2[] =;

/* Devices for Surface Laptop Go. */
static const struct software_node *ssam_node_group_slg1[] =;

/* Devices for Surface Pro 7 and Surface Pro 7+. */
static const struct software_node *ssam_node_group_sp7[] =;

/* Devices for Surface Pro 8 */
static const struct software_node *ssam_node_group_sp8[] =;

/* Devices for Surface Pro 9 and 10 */
static const struct software_node *ssam_node_group_sp9[] =;


/* -- SSAM platform/meta-hub driver. ---------------------------------------- */

static const struct acpi_device_id ssam_platform_hub_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, ssam_platform_hub_acpi_match);

static const struct of_device_id ssam_platform_hub_of_match[] __maybe_unused =;

static int ssam_platform_hub_probe(struct platform_device *pdev)
{}

static void ssam_platform_hub_remove(struct platform_device *pdev)
{}

static struct platform_driver ssam_platform_hub_driver =;
module_platform_driver();

MODULE_ALIAS();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();