You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C: missing featureMissing feature that is confirmed working on Windows using the Surface Serial Hub (EC) device.D: Pro 7Device: Pro 7P: lowPriority: Low priority
Based on some reverse-engineering, the payload has the form 8bit (unused), 32bit, 32bit, 16bit, 16bit, 32bit, 32bit. Converted to integers, this yields 1, 99770, 74630, 101, 7457, 0, 13000.
@archseer: Do you see any connection to other battery values?
So looks like the 6th value has to do something with charging... Could that be a 60W charger? I think the 5th could maybe be voltage (in mV). The first value could be a status thing. As far as I can see this gets ignored in the Windows driver. I suppose you don't have any clue what TpUpdate means either?
Oh, I forgot to answer to the 0x0015 events during reloading: Those are input events (TC=0x15). They should normally get disabled when the sid_vhf module is unloaded. I suspect that those are handled a bit differently and cannot actually be disabled, which would kind-of make sense given their nature. So nothing we need to worry about.
I ran into 0x53 while working on Surface power management on Linux (linux-surface/linux-surface#2383), and I think the payload can now be named. The decode above (u8 + u32 + u32 + u16 + u16 + u32 + u32, little endian) matches what I see on a Surface Book 3 15".
No-load voltage (@11): confirmed against voltage_now of the matching battery.
Available input power (@13): the only field that follows the power source. It's the 0 → 60000 step in the log above.
The other names: taken from how Windows uses the values. The Surface SMF power management computes psys from them. For example, psys PL1 = available input power + 23 W (capped at 45 W) on the SB3. That's why psys never binds on Windows, while Linux stays at the 25/40 W boot value (SB3: system total power limit at 25 watts, including display backlight kernel#117). I'm least sure about @17.
On the SB3, the event only comes on power-source changes (after BAT 0x17), once from SAM and once or twice from KIP. The same data can be requested at any time: TC 0x02, CID 0x53, IID 0x01, with response, sent to SAM (TID 1) and KIP (TID 2).
For now my user-space prototype requests this through the debug cdev, which needs root. A small client driver that handles the event, and requests the data once at probe, would make it usable without the cdev. It could expose the values as read-only sysfs or hwmon power attributes.
Would that be welcome, and is there a preferred place for it (battery driver, a separate driver)? I'd be glad to help with it and test on the SB3.
Would that be welcome, and is there a preferred place for it (battery driver, a separate driver)? I'd be glad to help with it and test on the SB3.
Welcome definitely. How to structure the driver and everything around it is a good question. I think mostly what you opened as PR and proposed in linux-surface/linux-surface#2383 makes sense. So exposing them via the battery driver and then a separate user-space daemon. I'm not sure yet how to handle and expose all of this (e.g. whether to just always show the attributes or whether to only show them if they are actually supported) and how the detection should work. Normally, if you just query stuff that is not supported on the EC and expect an answer, you'll run into a timeout. So
is probably not something that would work well across all devices. We could use device properties, like we have for the fan profile. That requires more manual specification, but if there's not a clean way to query functionality from the EC I think that's all we have.
Thanks, agreed. Probing by request is gone; #195 now uses a registry property instead, like has_fan.
has_dptf on the battery and AC nodes. Without it, no 0x53 or adapter-rating request is sent and the attributes are hidden.
Set for: SB3, SL3 15" AMD, SL4, SL5, SL6, SLG1–3, SLS1/2, SP7+, SP8, SP9, SP9 5G, SP10, SP11 (Intel and ARM). Only the SB3 is measured; for the others the Windows power config of the device uses this data. Not set (no evidence): SL3 13" Intel, SP7, SP12 Intel. That needed new groups sl3_dptf, sp7_dptf, sp9_dptf.
Tested on the SB3 (7.3.4): values as before, PSU unplug/replug tracked, and 60 s idle with tracepoints: no 0x53 request, no timeout.
Side note: adapter_rating_mw queries the EC on every read. I'll read it less often in the daemon; the driver could cache it if you prefer.
Questions: is the name and placement OK? Splitting the groups, or rather set it for the whole group? Hide the attributes without the property (as now)?
Side note: adapter_rating_mw queries the EC on every read. I'll read it less often in the daemon; the driver could cache it if you prefer.
I think querying it every read should be fine, at least I don't think it should overwhelm the EC. Hiding unsupported attributes as done now makes sense to me. I'll have a look at the rest now.
On a Surface Pro 9 (Intel), I'm seeing problems with the type cover which seem to be linked to this patch. Specifically, moving from 7.3.4 to 7.3.6 has caused the keyboard to (often) become unresponsive when waking from sleep. There are then a lot of disconnect/reconnect events in the kernel log.
Checking the changes that went in to 7.3.5 and 7.3.6 pointed me here...
With some help from Claude I've created a local patch which maps MSHW0343 back to the group without has_dptf (same devices as the old SP9 group), with this kernel the keyboard seems to be working properly again.
I can share that patch if wanted, but it's a bit of a blunt instrument! There may well be a better fix.
Per boot (each count is the number of matching log lines; "Cover attaches" counts 045E:09B0 Keyboard input registrations):
Kernel
Suspends
Cover attaches
KIP query failures
7.3.4
26
1
0
7.3.6
7
35
8
7.3.6, MSHW0343 → group without has_dptf
3
3
2
Note: on this SP9 the EC does answer both DPTF commands quickly (3–11 ms per sysfs read), for example adapter_rating_mw=120000, max_platform_power_mw=144240, available_input_power_mw=60000. So this is not the "no answer, timeout" case the series guards against. The problem seems to be what the DPTF code adds around suspend and resume: the battery driver's new request on resume, and the event handling. The series lists the SP9 as "P" (power configuration only), not measured.
C: missing featureMissing feature that is confirmed working on Windows using the Surface Serial Hub (EC) device.D: Pro 7Device: Pro 7P: lowPriority: Low priority
Activity
fxgsell commentedon Dec 30, 2019
I also see a handful of those on the Laptop3.
archseer commentedon Dec 30, 2019
We think it might be equivalent to
surface-aggregator-module/doc/requests.txt
Line 85 in 3a34bb8
I have a raw dump of the event, but we weren't quite able to figure out the payload:
qzed commentedon Apr 22, 2020
Based on some reverse-engineering, the payload has the form
8bit (unused), 32bit, 32bit, 16bit, 16bit, 32bit, 32bit. Converted to integers, this yields1, 99770, 74630, 101, 7457, 0, 13000.@archseer: Do you see any connection to other battery values?
archseer commentedon Apr 22, 2020
@qzed I went and recorded some more event values. This time I logged only the
pldbuffer value:https://gist.github.com/archseer/dc3b41a378083a6d2a6205bf1d4f8d6c
Sidenote: I seem to have gotten a few warnings on
surface_sam_ssh, but I think that's during me live reloading the module:qzed commentedon Apr 22, 2020
Here's that decoded into numbers:
So looks like the 6th value has to do something with charging... Could that be a 60W charger? I think the 5th could maybe be voltage (in mV). The first value could be a status thing. As far as I can see this gets ignored in the Windows driver. I suppose you don't have any clue what
TpUpdatemeans either?qzed commentedon Apr 24, 2020
Oh, I forgot to answer to the 0x0015 events during reloading: Those are input events (TC=0x15). They should normally get disabled when the sid_vhf module is unloaded. I suspect that those are handled a bit differently and cannot actually be disabled, which would kind-of make sense given their nature. So nothing we need to worry about.
larsschellhas commentedon Nov 15, 2026
I ran into
0x53while working on Surface power management on Linux (linux-surface/linux-surface#2383), and I think the payload can now be named. The decode above (u8 + u32 + u32 + u16 + u16 + u32 + u32, little endian) matches what I see on a Surface Book 3 15".How I got there:
voltage_nowof the matching battery.On the SB3, the event only comes on power-source changes (after BAT
0x17), once from SAM and once or twice from KIP. The same data can be requested at any time: TC0x02, CID0x53, IID0x01, with response, sent to SAM (TID 1) and KIP (TID 2).For now my user-space prototype requests this through the debug cdev, which needs root. A small client driver that handles the event, and requests the data once at probe, would make it usable without the cdev. It could expose the values as read-only sysfs or hwmon power attributes.
Would that be welcome, and is there a preferred place for it (battery driver, a separate driver)? I'd be glad to help with it and test on the SB3.
qzed commentedon Nov 15, 2026
Welcome definitely. How to structure the driver and everything around it is a good question. I think mostly what you opened as PR and proposed in linux-surface/linux-surface#2383 makes sense. So exposing them via the battery driver and then a separate user-space daemon. I'm not sure yet how to handle and expose all of this (e.g. whether to just always show the attributes or whether to only show them if they are actually supported) and how the detection should work. Normally, if you just query stuff that is not supported on the EC and expect an answer, you'll run into a timeout. So
https://github.com/linux-surface/kernel/pull/195/changes#diff-cad12d0907d58e06f82f7c1bfd0a42018d10ffcc4349f08b37885b124736effaR265-R266
is probably not something that would work well across all devices. We could use device properties, like we have for the fan profile. That requires more manual specification, but if there's not a clean way to query functionality from the EC I think that's all we have.
https://github.com/linux-surface/kernel/blob/521f20ef604adbb6d3e3dd025c76c85bb9088a8c/drivers/platform/surface/surface_aggregator_registry.c#L78-L90
platform/surface: aggregator_registry: Add has_dptf property for batt…
power: supply: surface_battery: Add DPTF battery data
power: supply: surface_charger: Add the adapter rating
larsschellhas commentedon Nov 16, 2026
Thanks, agreed. Probing by request is gone; #195 now uses a registry property instead, like
has_fan.has_dptfon the battery and AC nodes. Without it, no 0x53 or adapter-rating request is sent and the attributes are hidden.sl3_dptf,sp7_dptf,sp9_dptf.adapter_rating_mwqueries the EC on every read. I'll read it less often in the daemon; the driver could cache it if you prefer.Questions: is the name and placement OK? Splitting the groups, or rather set it for the whole group? Hide the attributes without the property (as now)?
qzed commentedon Nov 16, 2026
I think querying it every read should be fine, at least I don't think it should overwhelm the EC. Hiding unsupported attributes as done now makes sense to me. I'll have a look at the rest now.
power: supply: surface_battery: Add DPTF battery data
power: supply: surface_charger: Add the adapter rating
platform/surface: aggregator_registry: Add has_dptf property for batt…
power: supply: surface_battery: Add DPTF battery data
power: supply: surface_charger: Add the adapter rating
platform/surface: aggregator_registry: Add has_dptf property for batt…
power: supply: surface_battery: Add DPTF battery data
power: supply: surface_charger: Add the adapter rating
is-alnilam commentedon Nov 25, 2026
On a Surface Pro 9 (Intel), I'm seeing problems with the type cover which seem to be linked to this patch. Specifically, moving from 7.3.4 to 7.3.6 has caused the keyboard to (often) become unresponsive when waking from sleep. There are then a lot of disconnect/reconnect events in the kernel log.
Checking the changes that went in to 7.3.5 and 7.3.6 pointed me here...
With some help from Claude I've created a local patch which maps
MSHW0343back to the group withouthas_dptf(same devices as the old SP9 group), with this kernel the keyboard seems to be working properly again.I can share that patch if wanted, but it's a bit of a blunt instrument! There may well be a better fix.
Per boot (each count is the number of matching log lines; "Cover attaches" counts 045E:09B0 Keyboard input registrations):
MSHW0343→ group withouthas_dptfNote: on this SP9 the EC does answer both DPTF commands quickly (3–11 ms per sysfs read), for example
adapter_rating_mw=120000,max_platform_power_mw=144240,available_input_power_mw=60000. So this is not the "no answer, timeout" case the series guards against. The problem seems to be what the DPTF code adds around suspend and resume: the battery driver's new request on resume, and the event handling. The series lists the SP9 as "P" (power configuration only), not measured.I'm happy to test any other patches!
larsschellhas commentedon Nov 25, 2026
I'm taking a look at this, @is-alnilam - thanks for reporting!