/linux-6.12.1/Documentation/driver-api/surface_aggregator/ |
D | overview.rst | 1 .. SPDX-License-Identifier: GPL-2.0+ 7 The Surface/System Aggregator Module (SAM, SSAM) is an (arguably *the*) 8 embedded controller (EC) on Microsoft Surface devices. It has been originally 9 introduced on 4th generation devices (Surface Pro 4, Surface Book 1), but 10 its responsibilities and feature-set have since been expanded significantly 17 Not much is currently known about SAM on 4th generation devices (Surface Pro 18 4, Surface Book 1), due to the use of a different communication interface 19 between host and EC (as detailed below). On 5th (Surface Pro 2017, Surface 20 Book 2, Surface Laptop 1) and later generation devices, SAM is responsible 23 sensors (e.g. skin temperature) and cooling/performance-mode setting to the [all …]
|
D | ssh.rst | 1 .. SPDX-License-Identifier: GPL-2.0+ 22 Surface Serial Hub Protocol 25 The Surface Serial Hub (SSH) is the central communication interface for the 26 embedded Surface Aggregator Module controller (SAM or EC), found on newer 27 Surface generations. We will refer to this protocol and interface as 28 SAM-over-SSH, as opposed to SAM-over-HID for the older generations. 30 On Surface devices with SAM-over-SSH, SAM is connected to the host via UART 32 significant functionality is provided via SAM, including access to battery 33 and power information and events, thermal read-outs and events, and many 34 more. For Surface Laptops, keyboard input is handled via HID directed [all …]
|
D | client.rst | 1 .. SPDX-License-Identifier: GPL-2.0+ 35 client-api 45 are non-discoverable and instead need to be explicitly provided by some 49 Non-SSAM Client Drivers 52 All communication with the SAM EC is handled via the |ssam_controller| 53 representing that EC to the kernel. Drivers targeting a non-SSAM device (and 67 .. code-block:: c 73 ctrl = ssam_client_bind(&pdev->dev); 75 return PTR_ERR(ctrl) == -ENODEV ? -EPROBE_DEFER : PTR_ERR(ctrl); 103 setup provided through the parent-child relation, are preserved. If [all …]
|
/linux-6.12.1/drivers/platform/surface/aggregator/ |
D | Kconfig | 1 # SPDX-License-Identifier: GPL-2.0+ 2 # Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com> 5 tristate "Microsoft Surface System Aggregator Module Subsystem and Drivers" 10 The Surface System Aggregator Module (Surface SAM or SSAM) is an 11 embedded controller (EC) found on 5th- and later-generation Microsoft 12 Surface devices (i.e. Surface Pro 5, Surface Book 2, Surface Laptop, 13 and newer, with exception of Surface Go series devices). 17 - EC access from ACPI via Surface ACPI Notify (5th- and 6th-generation) 18 - battery status information (all devices) 19 - thermal sensor access (all devices) [all …]
|
D | core.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Surface Serial Hub (SSH) driver for communication with the Surface/System 4 * Aggregator Module (SSAM/SAM). 6 * Provides access to a SAM-over-SSH connected EC via a controller device. 10 * Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com> 37 /* -- Static controller reference. ------------------------------------------ */ 47 * ssam_get_controller() - Get reference to SSAM controller. 65 if (WARN_ON(!kref_get_unless_zero(&ctrl->kref))) in ssam_get_controller() 75 * ssam_try_set_controller() - Try to set the main controller reference. 81 * Return: Returns zero on success or %-EEXIST if the reference has already [all …]
|
D | controller.c | 1 // SPDX-License-Identifier: GPL-2.0+ 5 * Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com> 38 /* -- Safe counters. -------------------------------------------------------- */ 41 * ssh_seq_reset() - Reset/initialize sequence ID counter. 46 WRITE_ONCE(c->value, 0); in ssh_seq_reset() 50 * ssh_seq_next() - Get next sequence ID. 57 u8 old = READ_ONCE(c->value); in ssh_seq_next() 61 while (unlikely((ret = cmpxchg(&c->value, old, new)) != old)) { in ssh_seq_next() 70 * ssh_rqid_reset() - Reset/initialize request ID counter. 75 WRITE_ONCE(c->value, 0); in ssh_rqid_reset() [all …]
|
/linux-6.12.1/Documentation/devicetree/bindings/platform/ |
D | microsoft,surface-sam.yaml | 1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 3 --- 4 $id: http://devicetree.org/schemas/platform/microsoft,surface-sam.yaml# 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 7 title: Surface System Aggregator Module (SAM, SSAM) 10 - Konrad Dybcio <konradybcio@kernel.org> 13 Surface devices use a standardized embedded controller to let the 20 const: microsoft,surface-sam 25 current-speed: true 28 - compatible [all …]
|
/linux-6.12.1/drivers/platform/surface/ |
D | surface_aggregator_registry.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Surface System Aggregator Module (SSAM) client device registry. 5 * Registry for non-platform/non-ACPI SSAM client devices, i.e. devices that 6 * cannot be auto-detected. Provides device-hubs and performs instantiation 9 * Copyright (C) 2020-2022 Maximilian Luz <luzmaximilian@gmail.com> 23 /* -- Device registry. ------------------------------------------------------ */ 28 * function, each encoded as two-digit hexadecimal, separated by ':'. In other 33 * Where, 'dd', 'cc', 'tt', 'ii', and 'ff' are the two-digit hexadecimal 42 /* KIP device hub (connects keyboard cover devices on Surface Pro 8). */ 48 /* Base device hub (devices attached to Surface Book 3 base). */ [all …]
|
D | Kconfig | 1 # SPDX-License-Identifier: GPL-2.0-only 3 # Microsoft Surface Platform-Specific Drivers 7 bool "Microsoft Surface Platform-Specific Device Drivers" 11 Say Y here to get to see options for platform-specific device drivers 12 for Microsoft Surface devices. This option alone does not add any 20 tristate "Surface 3 WMI Driver" 26 Say Y here if you have a Surface 3. 29 be called surface3-wmi. 32 tristate "Surface 3 battery platform operation region support" 37 region of the Surface 3 battery platform driver. [all …]
|
D | surface_platform_profile.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Surface Platform Profile / Performance Mode driver for Surface System 6 * Copyright (C) 2021-2022 Maximilian Luz <luzmaximilian@gmail.com> 88 return ssam_retry(__ssam_fan_profile_set, sdev->ctrl, &profile); in ssam_fan_profile_set() 107 dev_err(&sdev->dev, "invalid performance profile: %d", p); in convert_ssam_tmp_to_profile() 108 return -EINVAL; in convert_ssam_tmp_to_profile() 131 return -EOPNOTSUPP; in convert_profile_to_ssam_tmp() 153 return -EOPNOTSUPP; in convert_profile_to_ssam_fan() 166 status = ssam_tmp_profile_get(tpd->sdev, &tp); in ssam_platform_profile_get() 170 status = convert_ssam_tmp_to_profile(tpd->sdev, tp); in ssam_platform_profile_get() [all …]
|
D | surface_aggregator_tabletsw.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Surface System Aggregator Module (SSAM) tablet mode switch driver. 19 /* -- SSAM generic tablet switch driver framework. -------------------------- */ 73 const char *state = sw->ops.state_name(sw, &sw->state); in state_show() 94 status = sw->ops.get_state(sw, &state); in ssam_tablet_sw_update_workfn() 98 if (sw->state.source == state.source && sw->state.state == state.state) in ssam_tablet_sw_update_workfn() 100 sw->state = state; in ssam_tablet_sw_update_workfn() 103 tablet = sw->ops.state_is_tablet_mode(sw, &state); in ssam_tablet_sw_update_workfn() 104 input_report_switch(sw->mode_switch, SW_TABLET_MODE, tablet); in ssam_tablet_sw_update_workfn() 105 input_sync(sw->mode_switch); in ssam_tablet_sw_update_workfn() [all …]
|
D | surface_aggregator_hub.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Driver for Surface System Aggregator Module (SSAM) subsystem device hubs. 7 * (hot-)removal. 9 * Copyright (C) 2020-2022 Maximilian Luz <luzmaximilian@gmail.com> 21 /* -- SSAM generic subsystem hub driver framework. -------------------------- */ 73 status = hub->ops.get_state(hub, &state); in ssam_hub_update_workfn() 78 * There is a small possibility that hub devices were hot-removed and in ssam_hub_update_workfn() 79 * re-added before we were able to remove them here. In that case, both in ssam_hub_update_workfn() 82 * leave child devices without proper (re-)initialization and the in ssam_hub_update_workfn() 83 * hot-remove flag set. in ssam_hub_update_workfn() [all …]
|
D | surface_acpi_notify.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Driver for the Surface ACPI Notify (SAN) interface/shim. 5 * Translates communication from ACPI to Surface System Aggregator Module 6 * (SSAM/SAM) requests and back, specifically SAM-over-SSH. Translates SSAM 11 * Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com> 42 /* -- dGPU notifier interface. ---------------------------------------------- */ 64 status = -EBUSY; in san_set_rqsg_interface_device() 71 * san_client_link() - Link client as consumer to SAN device. 83 * Return: Returns zero on success, %-ENXIO if the SAN interface has not been 84 * set up yet, and %-ENOMEM if device link creation failed. [all …]
|
/linux-6.12.1/include/uapi/linux/surface_aggregator/ |
D | cdev.h | 1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 3 * Surface System Aggregator Module (SSAM) user-space EC interface. 5 * Definitions, structs, and IOCTLs for the /dev/surface/aggregator misc 6 * device. This device provides direct user-space access to the SSAM EC. 9 * Copyright (C) 2020-2021 Maximilian Luz <luzmaximilian@gmail.com> 19 * enum ssam_cdev_request_flags - Request flags for SSAM cdev request IOCTL. 39 * struct ssam_cdev_request - Controller request IOCTL argument. 40 * @target_category: Target category of the SAM request. 41 * @target_id: Target ID of the SAM request. 42 * @command_id: Command ID of the SAM request. [all …]
|
/linux-6.12.1/include/linux/surface_aggregator/ |
D | device.h | 1 /* SPDX-License-Identifier: GPL-2.0+ */ 3 * Surface System Aggregator Module (SSAM) bus and client-device subsystem. 5 * Main interface for the surface-aggregator bus, surface-aggregator client 7 * Provides support for non-platform/non-ACPI SSAM clients via dedicated 10 * Copyright (C) 2019-2021 Maximilian Luz <luzmaximilian@gmail.com> 24 /* -- Surface System Aggregator Module bus. --------------------------------- */ 27 * enum ssam_device_domain - SAM device domain. 29 * @SSAM_DOMAIN_SERIALHUB: Physical device connected via Surface Serial Hub. 37 * enum ssam_virtual_tc - Target categories for the virtual SAM domain. 45 * struct ssam_device_uid - Unique identifier for SSAM device. [all …]
|
D | controller.h | 1 /* SPDX-License-Identifier: GPL-2.0+ */ 3 * Surface System Aggregator Module (SSAM) controller interface. 9 * Copyright (C) 2019-2021 Maximilian Luz <luzmaximilian@gmail.com> 22 /* -- Main data types and definitions --------------------------------------- */ 25 * enum ssam_event_flags - Flags for enabling/disabling SAM events 33 * struct ssam_event - SAM event sent from the EC to the host. 51 * enum ssam_request_flags - Flags for SAM requests. 70 * struct ssam_request - SAM request description. 79 * This struct fully describes a SAM request with payload. It is intended to 94 * struct ssam_response - Response buffer for SAM request. [all …]
|
D | serial_hub.h | 1 /* SPDX-License-Identifier: GPL-2.0+ */ 3 * Surface Serial Hub (SSH) protocol and communication interface. 5 * Lower-level communication layers and SSH protocol definitions for the 6 * Surface System Aggregator Module (SSAM). Provides the interface for basic 7 * packet- and request-based communication with the SSAM EC via SSH. 9 * Copyright (C) 2019-2021 Maximilian Luz <luzmaximilian@gmail.com> 15 #include <linux/crc-itu-t.h> 22 /* -- Data structures for SAM-over-SSH communication. ----------------------- */ 25 * enum ssh_frame_type - Frame types for SSH frames. 42 * For command-type payloads, this can also mean that the command is [all …]
|
/linux-6.12.1/Documentation/driver-api/surface_aggregator/clients/ |
D | san.rst | 1 .. SPDX-License-Identifier: GPL-2.0+ 8 Surface ACPI Notify 11 The Surface ACPI Notify (SAN) device provides the bridge between ACPI and 12 SAM controller. Specifically, ACPI code can execute requests and handle 14 relating to the discrete GPU (dGPU) of the Surface Book 2 can be sent from 15 ACPI code (note: the Surface Book 3 uses a different method for this). The 16 only currently known event sent via this interface is a dGPU power-on 22 registration and notifier-block registration. 30 Notifier-blocks can be registered by any device for as long as the module is 41 .. kernel-doc:: include/linux/surface_acpi_notify.h [all …]
|
D | cdev.rst | 1 .. SPDX-License-Identifier: GPL-2.0+ 8 User-Space EC Interface (cdev) 11 The ``surface_aggregator_cdev`` module provides a misc-device for the SSAM 12 controller to allow for a (more or less) direct connection from user-space to 13 the SAM EC. It is intended to be used for development and debugging, and 17 The provided interface is accessible through the ``/dev/surface/aggregator`` 18 device-file. All functionality of this interface is provided via IOCTLs. 23 at https://github.com/linux-surface/surface-aggregator-module/tree/master/scripts/ssam. 31 Events can be received by reading from the device-file. The are represented by 37 interface, associated with a specific target category and device-file-instance. [all …]
|
/linux-6.12.1/drivers/hwmon/ |
D | surface_fan.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Surface Fan driver for Surface System Aggregator Module. It provides access 65 hdev = devm_hwmon_device_register_with_info(&sdev->dev, in surface_fan_probe() 74 { SSAM_SDEV(FAN, SAM, 0x01, 0x01) }, 90 MODULE_DESCRIPTION("Fan Driver for Surface System Aggregator Module");
|
D | surface_temp.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Thermal sensor subsystem driver for Surface System Aggregator Module (SSAM). 5 * Copyright (C) 2022-2023 Maximilian Luz <luzmaximilian@gmail.com> 17 /* -- SAM interface. -------------------------------------------------------- */ 20 * Available sensors are indicated by a 16-bit bitfield, where a 1 marks the 28 * the maximum zero-padded space observed in the returned buffer. 73 status = __ssam_tmp_get_temperature(sdev->ctrl, sdev->uid.target, iid, &temp_le); in ssam_tmp_get_temperature() 78 *temperature = (le16_to_cpu(temp_le) - 2731) * 100L; in ssam_tmp_get_temperature() 87 status = __ssam_tmp_get_name(sdev->ctrl, sdev->uid.target, iid, &name_rsp); in ssam_tmp_get_name() 93 * null-terminated or someone changed something in the struct in ssam_tmp_get_name() [all …]
|
/linux-6.12.1/drivers/power/supply/ |
D | surface_charger.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * AC driver for 7th-generation Microsoft Surface devices via Surface System 6 * Copyright (C) 2019-2021 Maximilian Luz <luzmaximilian@gmail.com> 19 /* -- SAM interface. -------------------------------------------------------- */ 43 /* -- Device structures. ---------------------------------------------------- */ 65 /* -- State management. ----------------------------------------------------- */ 69 __le32 old = ac->state; in spwr_ac_update_unlocked() 72 lockdep_assert_held(&ac->lock); in spwr_ac_update_unlocked() 74 status = ssam_retry(ssam_bat_get_psrc, ac->sdev, &ac->state); in spwr_ac_update_unlocked() 78 return old != ac->state; in spwr_ac_update_unlocked() [all …]
|
D | surface_battery.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Battery driver for 7th-generation Microsoft Surface devices via Surface 6 * Copyright (C) 2019-2021 Maximilian Luz <luzmaximilian@gmail.com> 22 /* -- SAM interface. -------------------------------------------------------- */ 112 /* -- Device structures. ---------------------------------------------------- */ 140 /* -- Module parameters. ---------------------------------------------------- */ 147 /* -- State management. ----------------------------------------------------- */ 157 lockdep_assert_held(&bat->lock); in spwr_battery_present() 159 return le32_to_cpu(bat->sta) & SAM_BATTERY_STA_PRESENT; in spwr_battery_present() 164 lockdep_assert_held(&bat->lock); in spwr_battery_load_sta() [all …]
|
/linux-6.12.1/drivers/hid/surface-hid/ |
D | surface_hid.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Surface System Aggregator Module (SSAM) HID transport driver for the 5 * integrated HID devices on Surface Laptop 3, Book 3, and later. 7 * Copyright (C) 2019-2021 Blaž Hrastnik <blaz@mxxn.io>, 23 /* -- SAM interface. -------------------------------------------------------- */ 57 buffer_len = ARRAY_SIZE(buffer) - sizeof(struct surface_hid_buffer_slice); in ssam_hid_get_descriptor() 59 rqst.target_category = shid->uid.category; in ssam_hid_get_descriptor() 60 rqst.target_id = shid->uid.target; in ssam_hid_get_descriptor() 62 rqst.instance_id = shid->uid.instance; in ssam_hid_get_descriptor() 71 slice->entry = entry; in ssam_hid_get_descriptor() [all …]
|
D | surface_kbd.c | 1 // SPDX-License-Identifier: GPL-2.0+ 3 * Surface System Aggregator Module (SSAM) HID transport driver for the legacy 5 * integrated HID keyboard on Surface Laptops 1 and 2. 7 * Copyright (C) 2019-2021 Maximilian Luz <luzmaximilian@gmail.com> 22 /* -- SAM interface (KBD). -------------------------------------------------- */ 40 rqst.target_category = shid->uid.category; in ssam_kbd_get_descriptor() 41 rqst.target_id = shid->uid.target; in ssam_kbd_get_descriptor() 43 rqst.instance_id = shid->uid.instance; in ssam_kbd_get_descriptor() 52 status = ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(entry)); in ssam_kbd_get_descriptor() 57 dev_err(shid->dev, "invalid descriptor length: got %zu, expected, %zu\n", in ssam_kbd_get_descriptor() [all …]
|