Skip to content

platform/surface: aggregator_registry: Add thermal sensors and fan speed for Surface Laptop Go - #198

Open
neveltyc wants to merge 1 commit into
linux-surface:v7.3-surface-develfrom
neveltyc:slg-temp-fan-offset
Open

neveltyc wants to merge 1 commit into
linux-surface:v7.3-surface-develfrom
neveltyc:slg-temp-fan-offset

Conversation

@neveltyc

@neveltyc neveltyc commented Nov 20, 2026 •

Copy link
Copy Markdown

This PR enables thermal sensor and fan speed monitoring on the Surface Laptop Go series.

Changes

  • Problem: The Surface Laptop Go EC provides the same thermal sensor and fan speed interfaces as newer Surface models, but ssam_node_group_slg1 does not list them, so surface_temp and surface_fan never bind.
  • Change: Add ssam_node_tmp_sensors and ssam_node_fan_speed to ssam_node_group_slg1.
  • Scope: ssam_node_group_slg1 is shared by the Surface Laptop Go 1, 2, and 3. This change has only been tested on a Surface Laptop Go 1; the Go 2 and Go 3 have not been tested on hardware.

Testing

Tested on a Surface Laptop Go 1 with ACPI ID MSHW0118 and SAM firmware 7.100.139:

  • surface_temp binds and exposes all 11 EC thermal channels: I_RTS1–I_RTS8 and I_VTS1–I_VTS3.
  • surface_fan binds and reports the live fan speed in rpm.

@larsschellhas

Copy link
Copy Markdown
Contributor

Thanks for this, and sorry for the late reply. I can't test any of the Laptop Go models myself, but I can add what the Windows side and the EC firmware say. I went through both commits with the SMF blobs and Windows clients of the Go 1, 2 and 3, and with the EC firmware in their Windows driver packages (Go 1 7.100.139, Go 2 6.302.139, Go 3 12.202.139, unpacked with linux-surface/sam-fwxtract). Because commit 2 reaches every surface_temp device, I also looked at the offset command in the firmware packages of several other models. All of this is static reading of the package versions, not measurement, and a device may run a different version.

The series applies to the current v7.3-surface-devel, builds with W=1, and checkpatch --strict is clean. It might be easier to split it, so that commit 1 does not have to wait for the offset discussion.

Commit 1 (sensors and fan speed)

This would be very welcome. ssam_node_group_slg1 is shared by the Go 1, 2 and 3, so the nodes appear on all three. All three firmware images have I_RTS1-I_RTS8 and I_VTS1-I_VTS3 and handle the sensor list, name, temperature and fan-speed requests. So the firmware supports the nodes on the whole group, but they have only been read on a Go 1. It may help to say that in the commit message.

On has_fan: as far as I can read the firmware, FAN 0x0e is not handled on the Go 1 and Go 2 but is handled on the Go 3. Leaving has_fan out keeps the Go 3 as it is today, so nothing changes there. Only the statement in the commit message is broader than what was measured.

Commit 2 (tempX_offset)

tempX_offset looks like the right interface to me, since the ABI describes exactly this. It would also let user space apply the Windows offset without raw requests through /dev/surface/aggregator. The main thing I want to point out is that the patch adds a writable attribute to every sensor on every device where surface_temp binds, and the firmware behaves quite differently across them:

  • Go 1 and Go 2: only sensors 9-11 are accepted. On the Go 1, 10 and 11 look broken (the handler reads their factory value through a pointer that is not set up for them), so I would avoid sending those.
  • Go 3, Pro 9 and Laptop 5: I find no handler for 0x24 at all.
  • Pro 10, Pro 11 (Intel) and Laptop 6: sensors 1-5 are accepted too. They shift the hardware inputs behind several I_RTS sensors, and with them the readings that other users of these sensors see. Only whole kelvin take effect there.
  • None of the handlers I read checks the value.

The command has no response, so a write returns success in all of these cases, and reading the attribute back shows the cached value. Across all the SMF blobs I have, Windows only ever writes sensor 9, and the value stays between -3.0 K and +2.5 K. On the Go 1 that is about -2 K with an external display and 0 otherwise.

So my suggestion would be:

  • Expose only temp9_offset, and only where a registry property enables it (similar to has_fan). For now that would be the Go 1, the device it was measured on, so slg1 would have to be split. Other devices, including the SB3 base sensors on the KIP hub and the Arm models, would stay without the attribute until someone checks them.
  • Use a tighter bound, for example ±5 K. The EC fan curve follows I_VTS1, so a large negative value can keep the fan off while the board is warm. I also can't rule out that some EC protection uses the value.
  • Write 0 at probe and at shutdown, not only at removal. The offset lives in EC RAM. The Go 1 EC drops it whenever it reloads the virtual-sensor constants (for example when it switches the sensor configuration by itself), and it is probably kept over a reboot of the host. So the cached value and the EC can drift apart.

On the framing: in 7.100.139 I don't find anything between the host interface and the 0x24 handler that reads the instance ID. Requests are routed by target ID and category, and the handler takes the sensor from the payload. So from the firmware I would expect the Windows frame (instance = sensor) to work as well, and I can't explain the no-op you saw. Could you post the output of sudo dmesg | grep "SAM firmware version", plus the exact commands you used for both variants? In particular: did the second variant send a different value than the first, and did you wait more than one 5-second tick? Until that is clear, it might be safer not to state in the commit message that the instance variant is ignored.

Two small code notes. The hwmon core already serialises attribute reads and writes, so the driver's own mutex should not be needed. I also checked ssam_tmp_mc_to_f32() against the C float conversion for every value from -100000 to 100000, and it matches.

Other models

Several other groups have no sensor node either (Pro 7+, Pro 8, Laptop 4, Laptop 7, Laptop Studio 1). I'm collecting readings from testers for those and will send them separately, so they don't need to go into this PR. A question for @qzed, so I know what to aim for: for read-only sensor nodes, is the firmware of the driver package plus a reading from one device of the group enough, or would you want a reading from each model in the group?

Thanks again, the measurements on the Go 1 are really useful.

…eed for Surface Laptop Go

The Surface Laptop Go EC provides the same thermal sensor and fan speed
interfaces as newer Surface models, but ssam_node_group_slg1 does not
register them yet. Add both nodes so that surface_temp and surface_fan
can bind.

On the Surface Laptop Go 1, the separate fan profile command has no
effect, so keep ssam_node_tmp_perf_profile without the has_fan property.

ssam_node_group_slg1 is shared by the Surface Laptop Go 1, 2, and 3.
This change has only been tested on a Surface Laptop Go 1, where
surface_temp exposes the 11 EC thermal channels and surface_fan reports
the fan speed; the Go 2 and Go 3 have not been tested on hardware.

Signed-off-by: Yuchao Tang <neveltyc@gmail.com>
@neveltyc
neveltyc force-pushed the slg-temp-fan-offset branch from 6d6f5b8 to 057ae1f Compare November 30, 2026 17:50
@neveltyc neveltyc changed the title Surface Laptop Go: Add thermal sensors and fan speed, and expose sensor offsets in surface_temp platform/surface: aggregator_registry: Add thermal sensors and fan speed for Surface Laptop Go Nov 30, 2026
@neveltyc

Copy link
Copy Markdown
Author

@larsschellhas Thanks for the review and the firmware analysis!

The device runs the same firmware version as the driver package:

[    1.350918] surface_serial_hub serial0-0: SAM firmware version: 7.100.139

You were right about the 0x24 framing test. My initial script sent instance_id = 0x09 with -3.0, waited only 3 seconds, and then sent instance_id = 0x00 with the same -3.0 value right before the 5-second EC tick fired. Re-testing instance_id = 0x09 on its own with a 6-second wait confirmed that it works as expected.

Following your suggestion, I have split the series:

@larsschellhas

Copy link
Copy Markdown
Contributor

Great! Now, let's give @qzed some time 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants