overview.rst 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. ========
  3. Overview
  4. ========
  5. The Surface/System Aggregator Module (SAM, SSAM) is an (arguably *the*)
  6. embedded controller (EC) on Microsoft Surface devices. It has been originally
  7. introduced on 4th generation devices (Surface Pro 4, Surface Book 1), but
  8. its responsibilities and feature-set have since been expanded significantly
  9. with the following generations.
  10. Features and Integration
  11. ========================
  12. Not much is currently known about SAM on 4th generation devices (Surface Pro
  13. 4, Surface Book 1), due to the use of a different communication interface
  14. between host and EC (as detailed below). On 5th (Surface Pro 2017, Surface
  15. Book 2, Surface Laptop 1) and later generation devices, SAM is responsible
  16. for providing battery information (both current status and static values,
  17. such as maximum capacity etc.), as well as an assortment of temperature
  18. sensors (e.g. skin temperature) and cooling/performance-mode setting to the
  19. host. On the Surface Book 2, specifically, it additionally provides an
  20. interface for properly handling clipboard detachment (i.e. separating the
  21. display part from the keyboard part of the device), on the Surface Laptop 1
  22. and 2 it is required for keyboard HID input. This HID subsystem has been
  23. restructured for 7th generation devices and on those, specifically Surface
  24. Laptop 3 and Surface Book 3, is responsible for all major HID input (i.e.
  25. keyboard and touchpad).
  26. While features have not changed much on a coarse level since the 5th
  27. generation, internal interfaces have undergone some rather large changes. On
  28. 5th and 6th generation devices, both battery and temperature information is
  29. exposed to ACPI via a shim driver (referred to as Surface ACPI Notify, or
  30. SAN), translating ACPI generic serial bus write-/read-accesses to SAM
  31. requests. On 7th generation devices, this additional layer is gone and these
  32. devices require a driver hooking directly into the SAM interface. Equally,
  33. on newer generations, less devices are declared in ACPI, making them a bit
  34. harder to discover and requiring us to hard-code a sort of device registry.
  35. Due to this, a SSAM bus and subsystem with client devices
  36. (:c:type:`struct ssam_device <ssam_device>`) has been implemented.
  37. Communication
  38. =============
  39. The type of communication interface between host and EC depends on the
  40. generation of the Surface device. On 4th generation devices, host and EC
  41. communicate via HID, specifically using a HID-over-I2C device, whereas on
  42. 5th and later generations, communication takes place via a USART serial
  43. device. In accordance to the drivers found on other operating systems, we
  44. refer to the serial device and its driver as Surface Serial Hub (SSH). When
  45. needed, we differentiate between both types of SAM by referring to them as
  46. SAM-over-SSH and SAM-over-HID.
  47. Currently, this subsystem only supports SAM-over-SSH. The SSH communication
  48. interface is described in more detail below. The HID interface has not been
  49. reverse engineered yet and it is, at the moment, unclear how many (and
  50. which) concepts of the SSH interface detailed below can be transferred to
  51. it.
  52. Surface Serial Hub
  53. ------------------
  54. As already elaborated above, the Surface Serial Hub (SSH) is the
  55. communication interface for SAM on 5th- and all later-generation Surface
  56. devices. On the highest level, communication can be separated into two main
  57. types: Requests, messages sent from host to EC that may trigger a direct
  58. response from the EC (explicitly associated with the request), and events
  59. (sometimes also referred to as notifications), sent from EC to host without
  60. being a direct response to a previous request. We may also refer to requests
  61. without response as commands. In general, events need to be enabled via one
  62. of multiple dedicated requests before they are sent by the EC.
  63. See Documentation/driver-api/surface_aggregator/ssh.rst for a
  64. more technical protocol documentation and
  65. Documentation/driver-api/surface_aggregator/internal.rst for an
  66. overview of the internal driver architecture.