Skip to contentSkip to conversation

Add support for the Microsoft Surface Pro X

PATCH In review Val Packett 6 participants 20 messages Nov 4 – Nov 23

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover Add support for the Microsoft Surface Pro X

The Surface Pro X is a 2019-era tablet powered by the Qualcomm SC8180X SoC, released in three variants (SQ1, Wi-Fi, SQ2).

Patches to support it have been around in a downstream tree at
https://github.com/linux-surface/kernel for a while. Let's upstream it!

I have permission from Maximilian Luz to use his From/S-o-b with modified (squashed, stripped down and split by model variant) patches:
https://github.com/linux-surface/surface-pro-x/issues/7#issuecomment-6597291831

One aspect that will need some input from people with internal qcom docs :) is the PCIe setup. There is sort of a multi PHY or multi controller setup, and for now we've been setting up a single controller with num-lanes=<2> and it does work, but it's not the proper way to do it..

Thanks,
~val

Maximilian Luz (3):
arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X
rtc: Add basic support for RTC via Surface System Aggregator Module platform/surface: aggregator_registry: Add support for Surface Pro X

Val Packett (2):
dt-bindings: arm: qcom: Document Microsoft Surface Pro X
firmware: qcom: scm: Allow QSEECOM on the Surface Pro X

 .../devicetree/bindings/arm/qcom.yaml         |   4 +-
 MAINTAINERS                                   |   8 +
 arch/arm64/boot/dts/qcom/Makefile             |   3 +
 .../dts/qcom/sc8180x-microsoft-cambria.dts    |  38 +
 .../dts/qcom/sc8180x-microsoft-carina.dts     |  50 +
 .../dts/qcom/sc8180x-microsoft-caspar.dts     |  38 +
 .../qcom/sc8180x-microsoft-surface-pro-x.dtsi | 853 ++++++++++++++++++
 drivers/firmware/qcom/qcom_scm.c              |   3 +
 .../surface/surface_aggregator_registry.c     |  26 +
 drivers/rtc/Kconfig                           |   9 +
 drivers/rtc/Makefile                          |   1 +
 drivers/rtc/rtc-surface.c                     | 129 +++
 12 files changed, 1161 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sc8180x-microsoft-cambria.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc8180x-microsoft-carina.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc8180x-microsoft-caspar.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi
 create mode 100644 drivers/rtc/rtc-surface.c
Signature · 1 line
2.56.0
#1 lore raw

PATCH 1/5 dt-bindings: arm: qcom: Document Microsoft Surface Pro X

The Surface Pro X tablet was listed as a single generic compatible in dt-bindings, but a device tree using it has not landed upstream.

Replace it with three model-specific compatibles:
* microsoft,cambria for the orginal SQ1 model (with cellular)
* microsoft,carina for the Wi-Fi-only (SQ1) model
* microsoft,carina for the SQ2 refresh

---
 Documentation/devicetree/bindings/arm/qcom.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/qcom.yaml +3 -1
index 121ca557ce1e..74f46697a363 100644
@@ -925,7 +925,9 @@ properties:
       - items:
           - enum:
               - lenovo,flex-5g
-              - microsoft,surface-prox
+              - microsoft,cambria
+              - microsoft,carina
+              - microsoft,caspar
               - qcom,sc8180x-primus
           - const: qcom,sc8180x
 
Signature · 1 line
2.56.0
#2 lore raw

Re: [PATCH 1/5] dt-bindings: arm: qcom: Document Microsoft Surface Pro X

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dt-bindings: arm: qcom: commit message duplicates carina and omits caspar --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: arm: qcom: commit message duplicates carina and omits caspar --

commit c0354ee6a701cd3d9a5f7b5512415336071339b5
Author: Val Packett <[email protected]>

dt-bindings: arm: qcom: Document Microsoft Surface Pro X

This commit replaces the generic microsoft,surface-prox compatible string in Documentation/devicetree/bindings/arm/qcom.yaml with three model-specific compatible strings for the Surface Pro X variants.

Quoted 17 lines

dt-bindings: arm: qcom: Document Microsoft Surface Pro X

The Surface Pro X tablet was listed as a single generic compatible in dt-bindings, but a device tree using it has not landed upstream.

Replace it with three model-specific compatibles:
* microsoft,cambria for the orginal SQ1 model (with cellular)
* microsoft,carina for the Wi-Fi-only (SQ1) model
* microsoft,carina for the SQ2 refresh

Documentation/devicetree/bindings/arm/qcom.yaml +0 -0
index 121ca557ce1ef..74f46697a363f 100644

Documentation/devicetree/bindings/arm/qcom.yaml properties: · line 930

Quoted 7 lines
Documentation/devicetree/bindings/arm/qcom.yaml +3 -1
@@ -925,7 +925,9 @@ properties:
       - items:
           - enum:
               - lenovo,flex-5g
-              - microsoft,surface-prox
+              - microsoft,cambria
+              - microsoft,carina
+              - microsoft,caspar

[Severity: Low]
In Documentation/devicetree/bindings/arm/qcom.yaml under properties.compatible, the schema adds microsoft,cambria, microsoft,carina, and microsoft,caspar, but the commit message lists microsoft,carina twice (for both the Wi-Fi-only SQ1 model and the SQ2 refresh) and omits microsoft,caspar.

Should the Wi-Fi-only (SQ1) entry in the commit description say microsoft,caspar instead of microsoft,carina?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

Re: [PATCH 1/5] dt-bindings: arm: qcom: Document Microsoft Surface Pro X

In reply to Val Packett
Quoted 5 lines · Val Packett

The Surface Pro X tablet was listed as a single generic compatible in dt-bindings, but a device tree using it has not landed upstream.

Replace it with three model-specific compatibles:
* microsoft,cambria for the orginal SQ1 model (with cellular)

Nit: "orginal" -> "original"

Quoted 1 line

* microsoft,carina for the Wi-Fi-only (SQ1) model[...]

Nit: ,carina -> ,caspar

Wi-Fi-only has both SQ1 and SQ2, please see reply to 2/2 in series.

Thanks,
Haipeng

#4 lore raw

PATCH 2/5 arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X

In reply to Val Packett

From: Maximilian Luz <[email protected]>

Introduce a device tree for the Surface Pro X tablet in all 3 variants (SQ1 with cellular, SQ1 Wi-Fi only, SQ2 with cellular).

Currently working:

* Display, backlight (eDP panel)
* USB 2.0
* Wi-Fi and Bluetooth (WCN3998)
* NVMe on PCIe2
* Embedded controller (Surface SAM over UART)
* All remoteprocs (ADSP, CDSP, MPSS, SLPI)
* Volume and power buttons

---
 arch/arm64/boot/dts/qcom/Makefile             |   3 +
 .../dts/qcom/sc8180x-microsoft-cambria.dts    |  38 +
 .../dts/qcom/sc8180x-microsoft-carina.dts     |  50 +
 .../dts/qcom/sc8180x-microsoft-caspar.dts     |  38 +
 .../qcom/sc8180x-microsoft-surface-pro-x.dtsi | 853 ++++++++++++++++++
 5 files changed, 982 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/sc8180x-microsoft-cambria.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc8180x-microsoft-carina.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc8180x-microsoft-caspar.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi
arch/arm64/boot/dts/qcom/Makefile +3 -0
index d6e440cd252b..dcaf74dc876b 100644
@@ -324,6 +324,9 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sc7280-idp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc7280-idp2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc7280-crd-r3.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc8180x-lenovo-flex-5g.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sc8180x-microsoft-cambria.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sc8180x-microsoft-carina.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sc8180x-microsoft-caspar.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sc8180x-primus.dtb
 sc8280xp-crd-el2-dtbs	:= sc8280xp-crd.dtb sc8280xp-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= sc8280xp-crd.dtb sc8280xp-crd-el2.dtb
arch/arm64/boot/dts/qcom/sc8180x-microsoft-cambria.dts new file +38 -0
new file mode 100644
index 000000000000..fcf7e49b3ae4
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+/dts-v1/;
+
+#include "sc8180x-microsoft-surface-pro-x.dtsi"
+
+/ {
+	model = "Microsoft Surface Pro X (SQ1)";
+	compatible = "microsoft,cambria", "qcom,sc8180x";
+};
+
+&gpu_zap_shader {
+	firmware-name = "qcom/sc8180x/microsoft/cambria/qcdxkmsuc8180.mbn";
+};
+
+&remoteproc_adsp {
+	firmware-name = "qcom/sc8180x/microsoft/cambria/qcadsp8180.mbn";
+
+	status = "okay";
+};
+
+&remoteproc_cdsp {
+	firmware-name = "qcom/sc8180x/microsoft/cambria/qccdsp8180.mbn";
+
+	status = "okay";
+};
+
+&remoteproc_mpss {
+	firmware-name = "qcom/sc8180x/microsoft/cambria/qcmpss8180.mbn";
+
+	status = "okay";
+};
+
+&remoteproc_slpi {
+	firmware-name = "qcom/sc8180x/microsoft/cambria/qcslpi8180.mbn";
+
+	status = "okay";
+};
arch/arm64/boot/dts/qcom/sc8180x-microsoft-carina.dts new file +50 -0

50 lines not on this page · raw message

arch/arm64/boot/dts/qcom/sc8180x-microsoft-caspar.dts new file +38 -0
new file mode 100644
index 000000000000..df42020ff81a
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+/dts-v1/;
+
+#include "sc8180x-microsoft-surface-pro-x.dtsi"
+
+/ {
+	model = "Microsoft Surface Pro X (Wi-Fi)";
+	compatible = "microsoft,caspar", "qcom,sc8180x";
+};
+
+&gpu_zap_shader {
+	firmware-name = "qcom/sc8180x/microsoft/caspar/qcdxkmsuc8180.mbn";
+};
+
+&remoteproc_adsp {
+	firmware-name = "qcom/sc8180x/microsoft/caspar/qcadsp8180.mbn";
+
+	status = "okay";
+};
+
+&remoteproc_cdsp {
+	firmware-name = "qcom/sc8180x/microsoft/caspar/qccdsp8180.mbn";
+
+	status = "okay";
+};
+
+&remoteproc_mpss {
+	firmware-name = "qcom/sc8180x/microsoft/caspar/qcmpss8180_nm.mbn";
+
+	status = "okay";
+};
+
+&remoteproc_slpi {
+	firmware-name = "qcom/sc8180x/microsoft/caspar/qcslpi8180.mbn";
+
+	status = "okay";
+};
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +853 -0

853 lines not on this page · raw message

Signature · 1 line
2.56.0
#5 lore raw

Re: [PATCH 2/5] arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X

Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider: - [High] arm64: dts: qcom: disabled qupv3_id_2 prevents uart13 and uart15 from probing - [Medium] arm64…

Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider:
- [High] arm64: dts: qcom: disabled qupv3_id_2 prevents uart13 and uart15 from probing
- [Medium] arm64: dts: qcom: build failure from undefined smb2351_2 and smb2351_a labels
- [Medium] arm64: dts: qcom: build failure from undefined remoteproc_slpi label
- [Medium] arm64: dts: qcom: vdda-phy-supply and vdda-pll-supply swapped on USB QMP PHYs
- [Medium] arm64: dts: qcom: missing power-supply and broken power sequencing on edp-panel
- [Low] arm64: dts: qcom: duplicate pmc8180a-thermal zone for pmc8180_temp sensor
- [Low] arm64: dts: qcom: child node names violate RSC, TLMM, PMIC GPIO, and ADC schemas --

commit 5309d200eb0928bd90998981b5c8364f2e0ed95e
Author: Maximilian Luz <[email protected]>

arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X

This commit adds a common device tree include and three board device trees for the Microsoft Surface Pro X tablet variants (Cambria, Carina, and Caspar) based on the Qualcomm SC8180X platform.

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +0 -0
new file mode 100644
index 0000000000000..17fb01c6b164f
@@ -0,0 +1,853 @@

[ ... ]

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 121

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +6 -0
+	thermal-zones {
+		pmc8180a-thermal {
+			polling-delay-passive = <100>;
+			polling-delay = <0>;
+
+			thermal-sensors = <&pmc8180_temp>;

[Severity: Low]
Should this node be named pmc8180-thermal instead of pmc8180a-thermal?

Because sc8180x-pmics.dtsi already defines /thermal-zones/pmc8180-thermal with thermal-sensors = <&pmc8180_temp>, using the name pmc8180a-thermal creates a second thermal zone node in the DTB for the same 0-cell sensor rather than overriding the existing pmc8180-thermal node. When qpnp_tm_probe() registers pmc8180_temp via devm_thermal_of_zone_register(), thermal_of_zone_register() only binds the first matching zone (pmc8180-thermal) and leaves pmc8180a-thermal unused.

[ ... ]

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 226

Quoted 4 lines

+&apps_rsc {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +3 -0
+	pmc8180-a-rpmh-regulators {
+		compatible = "qcom,pmc8180-rpmh-regulators";
+		qcom,pmic-id = "a";

[Severity: Low]
This isn't a runtime bug, but several child node names in this file do not match the patternProperties required by their respective DT bindings (which set additionalProperties: false) and will cause dtbs_check validation failures:

1. Under &apps_rsc, pmc8180-a-rpmh-regulators, pmc8180-e-rpmh-regulators, and pmc8180c-rpmh-regulators do not match ^regulators(-[0-9])?$ in Documentation/devicetree/bindings/soc/qcom/qcom,rpmh-rsc.yaml.

2. Under &tlmm, the subnodes of uart13-state, uart15-state, and ssam-state (cts, rts-tx, rx, and wake-int) do not end with -pins as required by Documentation/devicetree/bindings/pinctrl/qcom,sc8180x-tlmm.yaml.

3. Under &pmc8180_1_gpios, pmc8180a_gpio1 and pmc8180a_gpio6 do not end with -state as required by Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.yaml.

4. Under pmc8180e_adc and &pmc8180_adc, the channel child nodes (ref-gnd@0, vref-1p25@1, die-temp@6, xo-therm@4c, vph-pwr@83, and vcoin@85) do not match ^channel@[0-9a-f]+$ as required by Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml.

Could these node names be updated to match the binding schemas?

[ ... ]

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 406

Quoted 7 lines

+&smb2351_2 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +6 -0
+	status = "disabled";
+};
+
+&smb2351_a {
+	status = "disabled";
+};

[Severity: Medium]
Does this compile cleanly with dtc?

In arch/arm64/boot/dts/qcom/sc8180x-pmics.dtsi, the two qcom,smb2351 PMIC nodes under &spmi_bus are defined without labels:

	pmic@2 {
		compatible = "qcom,smb2351", "qcom,spmi-pmic";
		reg = <0x2 SPMI_USID>;
		...
	};
	...
	pmic@a {
		compatible = "qcom,smb2351", "qcom,spmi-pmic";
		reg = <0xa SPMI_USID>;
		...
	};

Because neither smb2351_2 nor smb2351_a is defined anywhere in the tree, building the new Surface Pro X DTB targets under CONFIG_ARCH_QCOM fails with unresolved label errors.

[ ... ]

Quoted 4 lines

+&mdss_edp {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +3 -0
+	pinctrl-0 = <&edp_hpd_active>;
+	pinctrl-names = "default";
+

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 633

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +10 -0
+	status = "okay";
+
+	aux-bus {
+		panel {
+			compatible = "edp-panel";
+			enable-gpios = <&tlmm 130 GPIO_ACTIVE_HIGH>;
+			no-hpd;
+
+			pinctrl-0 = <&panel_vdd_en_default_state>;
+			pinctrl-names = "default";

[Severity: Medium]
Should GPIO 130 be modeled as a fixed regulator connected to power-supply on the panel node rather than enable-gpios?

Documentation/devicetree/bindings/display/panel/panel-edp.yaml requires power-supply on compatible = "edp-panel" nodes. In addition, GPIO 130 is the panel VDD regulator enable pin (panel-vdd-en-default-state). In drivers/gpu/drm/panel/panel-edp.c, panel_edp_probe() requests enable-gpios with GPIOD_OUT_LOW, which drives GPIO 130 low and cuts panel power, and generic_edp_panel_probe() -> panel_edp_prepare_once() then re-asserts enable_gpio and immediately attempts DP AUX EDID reads with zero delay because no-hpd is set without hpd-absent-delay-ms.

[ ... ]

Quoted 8 lines

+&usb_prim_qmpphy {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +7 -0
+	vdda-phy-supply = <&vreg_l3c_1p2>;
+	vdda-pll-supply = <&vreg_l9e_0p88>;
+
+	orientation-switch;
+
+	status = "okay";
+};

[ ... ]

Quoted 8 lines

+&usb_sec_qmpphy {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +7 -0
+	vdda-phy-supply = <&vreg_l3c_1p2>;
+	vdda-pll-supply = <&vreg_l9e_0p88>;
+
+	orientation-switch;
+
+	status = "okay";
+};

[ ... ]

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 734

Quoted 13 lines

+&usb_mp_qmpphy0 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +12 -0
+	vdda-phy-supply = <&vreg_l3c_1p2>;
+	vdda-pll-supply = <&vreg_l9e_0p88>;
+
+	status = "okay";
+};
+
+&usb_mp_qmpphy1 {
+	vdda-phy-supply = <&vreg_l3c_1p2>;
+	vdda-pll-supply = <&vreg_l9e_0p88>;
+
+	status = "okay";
+};

[Severity: Medium]
Are vdda-phy-supply and vdda-pll-supply swapped on usb_prim_qmpphy, usb_sec_qmpphy, usb_mp_qmpphy0, and usb_mp_qmpphy1?

On SC8180X QMP PHYs (including pcie1_phy and pcie2_phy below, as well as sc8180x-primus.dts and sc8180x-lenovo-flex-5g.dts), vdda-phy-supply is the 0.88V rail and vdda-pll-supply is the 1.2V rail (&vreg_l3c_1p2). In drivers/phy/qualcomm/phy-qcom-qmp-combo.c and drivers/phy/qualcomm/phy-qcom-qmp-usb.c, qmp_phy_vreg_l sets a 21800 uA load on vdda-phy and a 36000 uA load on vdda-pll, so swapping them applies the wrong current load votes to the two LDOs.

[ ... ]

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 805

Quoted 3 lines

+&remoteproc_slpi {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +2 -0
+	memory-region = <&slpi_mem>;
+};

[Severity: Medium]
Where is the remoteproc_slpi label defined?

Both sc8180x-microsoft-surface-pro-x.dtsi and the three board DTS files (sc8180x-microsoft-cambria.dts, sc8180x-microsoft-carina.dts, and sc8180x-microsoft-caspar.dts) reference &remoteproc_slpi, but arch/arm64/boot/dts/qcom/sc8180x.dtsi only defines remoteproc_mpss, remoteproc_cdsp, and remoteproc_adsp. Because remoteproc_slpi does not exist in sc8180x.dtsi, dtc fails to build all three DTB targets.

Quoted 26 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +26 -0
+
+&uart13 {
+	pinctrl-0 = <&uart13_state>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	bluetooth {
+		compatible = "qcom,wcn3998-bt";
+
+		vddio-supply = <&vreg_s4a_1p8>;
+		vddxo-supply = <&vreg_l7a_1p8>;
+		vddrf-supply = <&vreg_l9a_1p3>;
+		vddch0-supply = <&vreg_l11c_3p3>;
+
+		max-speed = <3200000>;
+	};
+};
+
+&uart15 {
+	pinctrl-0 = <&uart15_state>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	embedded-controller {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 841

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +10 -0
+		compatible = "microsoft,surface-sam";
+
+		interrupts-extended = <&tlmm 180 IRQ_TYPE_EDGE_RISING>;
+
+		current-speed = <4000000>;
+
+		pinctrl-0 = <&ssam_state>;
+		pinctrl-names = "default";
+	};
+};

[Severity: High]
Don't we also need to enable &qupv3_id_2 for uart13 and uart15 to probe?

In arch/arm64/boot/dts/qcom/sc8180x.dtsi, uart13 and uart15 are children of qupv3_id_2 (geniqup@cc0000), which defaults to status = "disabled":

		qupv3_id_2: geniqup@cc0000 {
			compatible = "qcom,geni-se-qup";
			...
			status = "disabled";

Child serial engines under qcom,geni-se-qup are populated when geni_se_probe() calls devm_of_platform_populate(). Without setting status = "okay" on &qupv3_id_2, the parent QUPv3 wrapper never probes and neither uart13 (Bluetooth) nor uart15 (the Surface SAM embedded controller) is instantiated.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#6 lore raw

Re: [PATCH 2/5] arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X

In reply to Val Packett
Quoted 7 lines · Val Packett

From: Maximilian Luz <[email protected]>

Introduce a device tree for the Surface Pro X tablet in all 3 variants (SQ1 with cellular, SQ1 Wi-Fi only, SQ2 with cellular).

Currently working:

Quoted 7 lines

* Display, backlight (eDP panel)
* USB 2.0
* Wi-Fi and Bluetooth (WCN3998)
* NVMe on PCIe2
* Embedded controller (Surface SAM over UART)
* All remoteprocs (ADSP, CDSP, MPSS, SLPI)
* Volume and power buttons

[...]

This needs some sorting etc., but let's tackle the bigger prob first

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 630

Quoted 11 lines

+&mdss_edp {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +10 -0
+	pinctrl-0 = <&edp_hpd_active>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	aux-bus {
+		panel {
+			compatible = "edp-panel";
+			enable-gpios = <&tlmm 130 GPIO_ACTIVE_HIGH>;
+			no-hpd;

Is there really no HPD? The pinctrl above suggests otherwise

[...]

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 746

Quoted 3 lines

+&pcie2 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +2 -0
+	// XXX: pcie1 and pcie2 are multi'd together, for now use just one
+	num-lanes = <2>;

We should be using the new phy-qcom-qmp-pcie-multiphy.c driver I think, I'll try chasing down the right magic values

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 751

Quoted 5 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +5 -0
+
+	pinctrl-0 = <&pcie1_default_state>;
+	pinctrl-names = "default";
+
+	// HACK: Remove "global" interrupt

Why?

Konrad

#7 lore raw

Re: [PATCH 2/5] arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X

Quoted 20 lines · Konrad Dybcio
Quoted 7 lines · Val Packett

From: Maximilian Luz <[email protected]>

Introduce a device tree for the Surface Pro X tablet in all 3 variants (SQ1 with cellular, SQ1 Wi-Fi only, SQ2 with cellular).

Currently working:

Quoted 7 lines

* Display, backlight (eDP panel)
* USB 2.0
* Wi-Fi and Bluetooth (WCN3998)
* NVMe on PCIe2
* Embedded controller (Surface SAM over UART)
* All remoteprocs (ADSP, CDSP, MPSS, SLPI)
* Volume and power buttons

[...]

This needs some sorting etc., but let's tackle the bigger prob first

Quoted 12 lines

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 630

Quoted 11 lines

+&mdss_edp {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +10 -0
+	pinctrl-0 = <&edp_hpd_active>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	aux-bus {
+		panel {
+			compatible = "edp-panel";
+			enable-gpios = <&tlmm 130 GPIO_ACTIVE_HIGH>;
+			no-hpd;

Is there really no HPD? The pinctrl above suggests otherwise

Looks like that's been pretty much copy-pasted from lenovo-flex-5g where it's also set with no explanation, with the same pinctrl also existing.

I'm suspecting that might've been an attempt at working around the inconsistent display initialization, pre clk_rcg2_shared_ops etc.?

I'll try removing it. (Also will convert gpio130 to a power supply like flex-5g has it)

Quoted 7 lines

[...]

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 746

Quoted 3 lines

+&pcie2 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +2 -0
+	// XXX: pcie1 and pcie2 are multi'd together, for now use just one
+	num-lanes = <2>;

We should be using the new phy-qcom-qmp-pcie-multiphy.c driver I think, I'll try chasing down the right magic values

Thanks!!

Quoted 6 lines

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 751

Quoted 5 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +5 -0
+
+	pinctrl-0 = <&pcie1_default_state>;
+	pinctrl-names = "default";
+
+	// HACK: Remove "global" interrupt

Why?

Related to not having the proper multiphy driver support,

"it seems like that interrupt is expected to signal when the device is ready for use after initial setup. Unfortunately that doesn't seem to work for the NVME, potentially due to the composite PHYs. Likely it's just waiting forever and the IRQ doesn't get triggered. As it's optional, we can just drop it for now."

~val

#8 lore raw

Re: [PATCH 2/5] arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X

In reply to Val Packett
Quoted 4 lines · Val Packett

From: Maximilian Luz <[email protected]>

Introduce a device tree for the Surface Pro X tablet in all 3 variants (SQ1 with cellular, SQ1 Wi-Fi only, SQ2 with cellular).

[...]

I believe there is also a Wi-Fi only SQ2 variant. Looking at the WoA drivers for 8180_CAS (Caspar, Wi-Fi only)
https://github.com/WOA-Project/Qualcomm-Reference-Drivers/tree/master/Surface/8180_CAS/200.0.31.0

This variant is the only that has both SurfaceSMF_SQ1.cab and SurfaceSMF_SQ2.cab. Only 8180_CAS MPSS INF maps the no-modem subsystem ID (SUBSYS_MSNM8180 -> qcmpss8180_nm.mbn), the 8180_CAR (Carina) only lists the cellular MSWW/MSJP/MSCN IDs.

My SQ2 Wi-Fi boots with the caspar dts in this patch fine but the gold cluster is pinned at SQ1's top clocks because the 3.072 / 3.1488 GHz OPPs are only in carina.dts.

Quoted 19 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-carina.dts new file +13 -0
new file mode 100644
index 000000000000..5d155c69907a
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+/dts-v1/;
+
+#include "sc8180x-microsoft-surface-pro-x.dtsi"
+
+/ {
+	model = "Microsoft Surface Pro X (SQ2)";
+	compatible = "microsoft,carina", "qcom,sc8180x";
+};
+
+&cpu4_opp_table {
+	opp-3072000000 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-carina.dts line 23

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-carina.dts new file +10 -0
+		opp-hz = /bits/ 64 <3072000000>;
+		opp-peak-kBps = <8368000 51609600>;
+	};
+
+	opp-3148800000 {
+		opp-hz = /bits/ 64 <3148800000>;
+		opp-peak-kBps = <8368000 51609600>;
+	};
+};
+

[...]

Would it make sense to move opp-3072000000 and opp-3148800000 into the shared sc8180x-microsoft-surface-pro-x.dtsi? qcom-cpufreq-hw disables all DT OPPs first and only re-enables freqs present in the hardware LUT so this would work for SQ1 and caspar.dtb will cover both the SQ1 and SQ2 Wi-Fi models out of the box and carina.dts won't need its own &cpu4_opp_table override.

Quoted 5 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +0 -0
new file mode 100644
index 000000000000..17fb01c6b164

[...]

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 406

Quoted 7 lines

+&smb2351_2 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +6 -0
+	status = "disabled";
+};
+
+&smb2351_a {
+	status = "disabled";
+};

Confirmed on hardware that labeling pmic@2 and pmic@a in sc8180x-pmics.dtsi fixes the dtc build failure here.

[...]> +&uart13 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 811

Quoted 4 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +4 -0
+	pinctrl-0 = <&uart13_state>;
+	pinctrl-names = "default";
+
+	status = "okay";

[...]

On linux-surface, ad1bb617a15a from Maximilian Luz had

&qupv3_id_2 {
status = "okay";
};

Would it be helpful to add here? I confirmed on hardware that adding it allows uart13 (WCN3998 Bluetooth) and uart15 (SAM EC) to populate and probe properly.

Thanks,
Haipeng

#9 lore raw

Re: [PATCH 2/5] arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X

Quoted 10 lines · Haipeng Lin
Quoted 4 lines · Val Packett

From: Maximilian Luz <[email protected]>

Introduce a device tree for the Surface Pro X tablet in all 3 variants (SQ1 with cellular, SQ1 Wi-Fi only, SQ2 with cellular).

[...]

I believe there is also a Wi-Fi only SQ2 variant. Looking at the WoA drivers for 8180_CAS (Caspar, Wi-Fi only)
https://github.com/WOA-Project/Qualcomm-Reference-Drivers/tree/master/Surface/8180_CAS/200.0.31.0

Huuuh, okay..

Quoted 40 lines

This variant is the only that has both SurfaceSMF_SQ1.cab and SurfaceSMF_SQ2.cab. Only 8180_CAS MPSS INF maps the no-modem subsystem ID (SUBSYS_MSNM8180 -> qcmpss8180_nm.mbn), the 8180_CAR (Carina) only lists the cellular MSWW/MSJP/MSCN IDs.

My SQ2 Wi-Fi boots with the caspar dts in this patch fine but the gold cluster is pinned at SQ1's top clocks because the 3.072 / 3.1488 GHz OPPs are only in carina.dts.

Quoted 29 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-carina.dts new file +23 -0
new file mode 100644
index 000000000000..5d155c69907a
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+/dts-v1/;
+
+#include "sc8180x-microsoft-surface-pro-x.dtsi"
+
+/ {
+	model = "Microsoft Surface Pro X (SQ2)";
+	compatible = "microsoft,carina", "qcom,sc8180x";
+};
+
+&cpu4_opp_table {
+	opp-3072000000 {
+		opp-hz = /bits/ 64 <3072000000>;
+		opp-peak-kBps = <8368000 51609600>;
+	};
+
+	opp-3148800000 {
+		opp-hz = /bits/ 64 <3148800000>;
+		opp-peak-kBps = <8368000 51609600>;
+	};
+};
+

[...]

Quoted 6 lines

Would it make sense to move opp-3072000000 and opp-3148800000 into the shared sc8180x-microsoft-surface-pro-x.dtsi? qcom-cpufreq-hw disables all DT OPPs first and only re-enables freqs present in the hardware LUT so this would work for SQ1 and caspar.dtb will cover both the SQ1 and SQ2 Wi-Fi models out of the box and carina.dts won't need its own &cpu4_opp_table override.

I'm pretty sure mine *did* complain very loudly about having these OPPs and might've even had broken scaling.

I'll retest again, if it works I'll move it to the shared dtsi (or even the SoC's?)

Quoted 6 lines
Quoted 5 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +0 -0
new file mode 100644
index 000000000000..17fb01c6b164

[...]

Quoted 9 lines

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 406

Quoted 7 lines

+&smb2351_2 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +6 -0
+	status = "disabled";
+};
+
+&smb2351_a {
+	status = "disabled";
+};

Confirmed on hardware that labeling pmic@2 and pmic@a in sc8180x-pmics.dtsi fixes the dtc build failure here.

Yeahh, forgot to include, will be in v2

Quoted 9 lines

[...]> +&uart13 {

arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi line 811

Quoted 4 lines
arch/arm64/boot/dts/qcom/sc8180x-microsoft-surface-pro-x.dtsi new file +4 -0
+	pinctrl-0 = <&uart13_state>;
+	pinctrl-names = "default";
+
+	status = "okay";

[...]

On linux-surface, ad1bb617a15a from Maximilian Luz had

Quoted 7 lines
&qupv3_id_2 {
   status = "okay";
};

Would it be helpful to add here? I confirmed on hardware that adding it allows uart13 (WCN3998 Bluetooth) and uart15 (SAM EC) to populate and probe properly.

Of course; it should've been the _2 in the first place but I made a mistake during last-minute cleanup and left out the wrong ones…

Quoted 2 lines

Thanks,
Haipeng

BTW, please send me the output of sudo fwupdtool hwids, these are needed to add support to dtbloader/systemd-stub/stubble DT auto-selection.

(If anyone with the cellular variants reads this: you too :))

Thanks,

~val

#10 lore raw

Re: [PATCH 2/5] arm64: dts: qcom: sc8180x: Add Microsoft Surface Pro X

On 11/15/26 3:20 AM, Val Packett wrote:

[...]>> Would it make sense to move opp-3072000000 and opp-3148800000 into the

Quoted 9 lines
Quoted 5 lines

shared sc8180x-microsoft-surface-pro-x.dtsi? qcom-cpufreq-hw disables all DT OPPs first and only re-enables freqs present in the hardware LUT so this would work for SQ1 and caspar.dtb will cover both the SQ1 and SQ2 Wi-Fi models out of the box and carina.dts won't need its own &cpu4_opp_table override.

I'm pretty sure mine *did* complain very loudly about having these OPPs and might've even had broken scaling.

I'll retest again, if it works I'll move it to the shared dtsi (or even the SoC's?)

I like the idea of moving it to the SoC. Did a test on my SQ2 Wi-Fi with opp-3072000000/opp-3148800000 moved into sc8180x.dtsi, dropping it from carina.dts, plus a dummy opp-32256000000 above my LUT's top entry so I can "simulate" the SQ1 situation where there's a DT OPP that the LUT does not have. Booting that with caspar.dtb:

- no cpufreq/OPP messages at all (e.g., "Voltage update failed" or "failed to update OPP" as observed for caspar.dts in this v1 on SQ2)
- policy4 scaling_available_frequencies tops out at 3148800, the dummy 3225600 is disabled silently (by qcom_cpufreq_hw_read_lut() ?)
- under load time_in_state shows gold cluster sits at 3148800

Hopefully, this solution should work for both SQ1 and SQ2. sc8180x.dtsi looks like it tops out at 2995200, and that is SQ1's bin above the "regular" 8cx Gen 1's 2.84 GHz on the gold cluster so if it was broken it would already be broken for the 8cx G1 due to the SQ1 entries...

[...]>

Quoted 8 lines

BTW, please send me the output of sudo fwupdtool hwids, these are needed to add support to dtbloader/systemd-stub/stubble DT auto-selection.

(If anyone with the cellular variants reads this: you too :))

Thanks,

~val

This is not the latest BIOS which is 11.504.140 according to
https://support.microsoft.com/en-us/surface/updates/surface-pro-x-update-history
but I don't have dual boot to update it...

Surface Pro X SQ2 Wi-Fi only:

Computer Information
--------------------
BiosVendor: Microsoft Corporation
BiosVersion: 11.311.140
BiosMajorRelease: 255
BiosMinorRelease: 255
BiosReleaseDate: 2/03/2026
FirmwareMajorRelease: ff
FirmwareMinorRelease: ff
Manufacturer: Microsoft Corporation
Family: Surface
ProductName: Surface Pro X
ProductSku: Surface_Pro_X_2010
EnclosureKind: 9
BaseboardManufacturer: Microsoft Corporation
BaseboardProduct: Surface Pro X
Hardware IDs
------------

{bf87a823-6823-50f1-9f18-2030fd86b087}   <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease
{43cb3df2-05e6-5637-a89c-718381284f3d}   <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease
{1d2505b3-3329-5a15-b934-e1990787e978}   <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease
{75b4817e-50ec-5e63-a904-1175cd1abff6}   <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct
{cdf510a8-d41c-54bf-b2c5-61ba10957019}   <- Manufacturer + Family + ProductName + ProductSku
{cc2bc434-a08a-59c0-85ac-2576ed611de6}   <- Manufacturer + Family + ProductName
{69c2fd0d-8593-575f-b6af-5f70f0299ea4}   <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct
{aa2c30e9-117c-5aeb-a8aa-4b01761cf493}   <- Manufacturer + ProductSku
{b07028e2-19c1-577d-a3c9-2eabef35c2a1}   <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct
{5d018db8-6de6-55f8-8d8b-4b773caf8450}   <- Manufacturer + ProductName
{db7e6e61-56bf-531d-b594-e4b1660d04aa}   <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct
{ca2e5189-1d32-509f-88a0-d4ebcc721899}   <- Manufacturer + Family
{aca387a9-183e-5da9-8f9d-f460c3f50f54}   <- Manufacturer + EnclosureKind
{f199ec04-d0d9-542b-b035-209532a4d1f6}   <- Manufacturer + BaseboardManufacturer + BaseboardProduct
{cc0aea32-ad2c-5013-8bed-cede6be8c9f4}   <- Manufacturer

Thanks,
Haipeng

#11 lore raw

PATCH 3/5 firmware: qcom: scm: Allow QSEECOM on the Surface Pro X

In reply to Val Packett

Add the Surface Pro X tablet (all 3 variants) to the QSEECOM allowlist for enabling access to efivars.

---
 drivers/firmware/qcom/qcom_scm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/firmware/qcom/qcom_scm.c +3 -0
index 60949b71a3c5..7c82596907e1 100644
@@ -2287,6 +2287,9 @@ static const struct of_device_id qcom_scm_qseecom_allowlist[] __maybe_unused = {
 	{ .compatible = "microsoft,arcata", },
 	{ .compatible = "microsoft,surface-pro-12in", },
 	{ .compatible = "microsoft,blackrock" },
+	{ .compatible = "microsoft,cambria" },
+	{ .compatible = "microsoft,carina" },
+	{ .compatible = "microsoft,caspar" },
 	{ .compatible = "microsoft,denali", },
 	{ .compatible = "microsoft,romulus13", },
 	{ .compatible = "microsoft,romulus15", },
Signature · 1 line
2.56.0
#12 lore raw

Re: [PATCH 3/5] firmware: qcom: scm: Allow QSEECOM on the Surface Pro X

Sashiko has reviewed this patch and found no issues.
Quoted 4 lines

Add the Surface Pro X tablet (all 3 variants) to the QSEECOM allowlist for enabling access to efivars.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#13 lore raw

PATCH 4/5 rtc: Add basic support for RTC via Surface System Aggregator Module

In reply to Val Packett

From: Maximilian Luz <[email protected]>

The Surface Pro X uses an RTC provided by the SSAM. Add a driver for it.

---
 MAINTAINERS               |   8 +++
 drivers/rtc/Kconfig       |   9 +++
 drivers/rtc/Makefile      |   1 +
 drivers/rtc/rtc-surface.c | 129 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 147 insertions(+)
 create mode 100644 drivers/rtc/rtc-surface.c
MAINTAINERS +8 -0
index d23f7d8c4c17..36b3abad50f4 100644
@@ -18585,6 +18585,14 @@ L:	[email protected]
 S:	Supported
 F:	drivers/platform/surface/surfacepro3_button.c
 
+MICROSOFT SURFACE PRO X RTC DRIVER
+M:	Maximilian Luz <[email protected]>
+M:	Val Packett <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Maintained
+F:	drivers/rtc/rtc-surface.c
+
 MICROSOFT SURFACE SYSTEM AGGREGATOR HUB DRIVER
 M:	Maximilian Luz <[email protected]>
 L:	[email protected]
drivers/rtc/Kconfig +9 -0
index 73ec9230edfd..6af1aa18724f 100644
@@ -1451,6 +1451,15 @@ config RTC_DRV_NTXEC
 	  embedded controller found in certain e-book readers designed by the
 	  original design manufacturer Netronix.
 
+config RTC_DRV_SURFACE
+	tristate "Microsoft Surface Aggregator RTC"
+	depends on SURFACE_AGGREGATOR
+	depends on SURFACE_AGGREGATOR_BUS
+	help
+	  Say yes here if you want to support the RTC functionality of the
+	  Surface Aggregator Module (embedded controller) found in the
+	  Microsoft Surface Pro X tablet.
+
 comment "on-CPU RTC drivers"
 
 config RTC_DRV_ASM9260
drivers/rtc/Makefile +1 -0
index 46f1a0fc2416..f86e827c14e0 100644
@@ -186,6 +186,7 @@ obj-$(CONFIG_RTC_DRV_SUN4V)	+= rtc-sun4v.o
 obj-$(CONFIG_RTC_DRV_SUN6I)	+= rtc-sun6i.o
 obj-$(CONFIG_RTC_DRV_SUNPLUS)	+= rtc-sunplus.o
 obj-$(CONFIG_RTC_DRV_SUNXI)	+= rtc-sunxi.o
+obj-$(CONFIG_RTC_DRV_SURFACE)	+= rtc-surface.o
 obj-$(CONFIG_RTC_DRV_TEGRA)	+= rtc-tegra.o
 obj-$(CONFIG_RTC_DRV_TEST)	+= rtc-test.o
 obj-$(CONFIG_RTC_DRV_TI_K3)	+= rtc-ti-k3.o
drivers/rtc/rtc-surface.c new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
2.56.0
#14 lore raw

Re: [PATCH 4/5] rtc: Add basic support for RTC via Surface System Aggregator Module

Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

From: Maximilian Luz <[email protected]>

The Surface Pro X uses an RTC provided by the SSAM. Add a driver for it.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#15 lore raw

Re: [PATCH 4/5] rtc: Add basic support for RTC via Surface System Aggregator Module

In reply to Val Packett

drivers/rtc/rtc-surface.c line 109

Quoted 5 lines · Val Packett
drivers/rtc/rtc-surface.c new file +5 -0
+static void surface_rtc_remove(struct ssam_device *sdev)
+{
+	/* Device-managed allocations take care of everything... */
+}
+

I guess the function can simply be dropped then. Else, this looks good to me.

Quoted 23 lines
drivers/rtc/rtc-surface.c new file +20 -0
+static const struct ssam_device_id surface_rtc_match[] = {
+	{ SSAM_SDEV(SAM, SAM, 0x00, 0x00) },
+	{ },
+};
+MODULE_DEVICE_TABLE(ssam, surface_rtc_match);
+
+static struct ssam_device_driver surface_rtc_driver = {
+	.probe = surface_rtc_probe,
+	.remove = surface_rtc_remove,
+	.match_table = surface_rtc_match,
+	.driver = {
+		.name = "surface_rtc",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
+	},
+};
+module_ssam_device_driver(surface_rtc_driver);
+
+MODULE_AUTHOR("Maximilian Luz <[email protected]>");
+MODULE_DESCRIPTION("RTC driver for Surface System Aggregator Module");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.56.0
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Tested-by on v1 4/5
#16 lore raw

Re: [PATCH 4/5] rtc: Add basic support for RTC via Surface System Aggregator Module

In reply to Val Packett

Hi Val,

Tested on a Surface Pro 8 (x86, Tiger Lake): this is not SPX/ARM-only, the same SAM RTC sits behind the aggregator there. Two things came out of it.

First, as posted the driver cannot bind on the x86 machines: 5/5 adds ssam_node_rtc only to ssam_node_group_spx[], while the x86 devices come from the ACPI-matched groups. With one line in ssam_node_group_sp8[],

	&ssam_node_rtc,

"ssam:01:01:01:00:00" appears and the driver registers rtc2:

	surface_rtc 01:01:01:00:00: registered as rtc2

It would be good to have the node in the other x86 groups as well. Note that the node name will collide with the SPX one, so whichever lands first keeps it.

Second, set_time() needs a timezone compensation. The EC keeps UTC in the SAM timestamp (CID 0x10), but also exposes _GRT (CID 0x1f), the same clock plus the zone stored in the EC, and the firmware copies _GRT into rtc_cmos at POST. Right after a cold boot here:

	rtc0 read at boot	 1795199717
	true UTC at boot	 1795170940
	EC _GRT at boot		 1795199714	(zone +28800)

so CMOS came from _GRT, 8 h ahead of UTC. The write side shows the same:
after "hwclock -w -f /dev/rtc2" the SAM timestamp equals system UTC and _GRT is then UTC + zone, so the next cold boot is off by the zone again. Either write (UTC - zone), taking the zone from _GRT minus the timestamp, or state that this RTC is local time and leave the conversion to user space.

Since the same RTC is on the x86 machines, the descriptions are no longer accurate either: the commit message, the Kconfig help and the MAINTAINERS entry all name the Pro X:

drivers/rtc/Kconfig config RTC_DRV_NTXEC

Quoted 5 lines
drivers/rtc/Kconfig +4 -0
+	  Say yes here if you want to support the RTC functionality of the
+	  Surface Aggregator Module (embedded controller) found in the
+	  Microsoft Surface Pro X tablet.
 
+MICROSOFT SURFACE PRO X RTC DRIVER

Something like "found in Microsoft Surface devices with the Surface Aggregator Module" for the Kconfig text, and "MICROSOFT SURFACE AGGREGATOR RTC DRIVER" for the MAINTAINERS entry, would cover the ARM64 Pro X and the x86 machines both. The file header already says "7th-generation Microsoft Surface devices", so this would make the three consistent.

Thanks,
Emfox

#17 lore raw

PATCH 5/5 platform/surface: aggregator_registry: Add support for Surface Pro X

In reply to Val Packett

From: Maximilian Luz <[email protected]>

Add SAM client device nodes for the Surface Pro X.

---
 .../surface/surface_aggregator_registry.c     | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/platform/surface/surface_aggregator_registry.c +26 -0
index cf3ae252b1c4..bec0a87a2a95 100644
@@ -51,6 +51,12 @@ static const struct software_node ssam_node_hub_base = {
 	.parent = &ssam_node_root,
 };
 
+/* Real-Time Clock. */
+static const struct software_node ssam_node_rtc = {
+	.name = "ssam:01:01:01:00:00",
+	.parent = &ssam_node_root,
+};
+
 /* AC adapter. */
 static const struct software_node ssam_node_bat_ac = {
 	.name = "ssam:01:02:01:01:01",
@@ -352,6 +358,22 @@ static const struct software_node *ssam_node_group_sp7[] = {
 	NULL,
 };
 
+/* Devices for Surface Pro X */
+static const struct software_node *ssam_node_group_spx[] = {
+	&ssam_node_root,
+	&ssam_node_hub_kip,
+	&ssam_node_rtc,
+	&ssam_node_bat_ac,
+	&ssam_node_bat_main,
+	&ssam_node_tmp_sensors,
+	&ssam_node_kip_tablet_switch,
+	&ssam_node_hid_kip_keyboard,
+	&ssam_node_hid_kip_penstash,
+	&ssam_node_hid_kip_touchpad,
+	&ssam_node_hid_kip_fwupd,
+	NULL,
+};
+
 /* Devices for Surface Pro 8 */
 static const struct software_node *ssam_node_group_sp8[] = {
 	&ssam_node_root,
@@ -508,6 +530,10 @@ 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 = {
+	/* Surface Pro X */
+	{ .compatible = "microsoft,cambria", (void *)ssam_node_group_spx },
+	{ .compatible = "microsoft,carina", (void *)ssam_node_group_spx },
+	{ .compatible = "microsoft,caspar", (void *)ssam_node_group_spx },
 	/* Surface Pro 9 5G (ARM/QCOM) */
 	{ .compatible = "microsoft,arcata", (void *)ssam_node_group_sp9_5g },
 	/* Surface Pro 11 (ARM/QCOM) */
Signature · 1 line
2.56.0
#18 lore raw

Re: [PATCH 5/5] platform/surface: aggregator_registry: Add support for Surface Pro X

Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

From: Maximilian Luz <[email protected]>

Add SAM client device nodes for the Surface Pro X.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Tested-by on the v1 series
#19 lore raw
In reply to Val Packett
Quoted 10 lines · Val Packett

The Surface Pro X is a 2019-era tablet powered by the Qualcomm SC8180X SoC, released in three variants (SQ1, Wi-Fi, SQ2).

Patches to support it have been around in a downstream tree at
https://github.com/linux-surface/kernel for a while. Let's upstream it!

I have permission from Maximilian Luz to use his From/S-o-b with modified (squashed, stripped down and split by model variant) patches:
https://github.com/linux-surface/surface-pro-x/issues/7#issuecomment-6597291831
[...]

Hi Val,

Thanks for your work upstreaming this. I've been running the linux-surface SPX patches on my Surface Pro X Wi-Fi SQ2 (Surface_Pro_X_2010) for a while and tested this series on it (v7.4-rc1
+ your SLPI + this series) plus a few fixups needed to get it working:

1. Labels for smb2351_2 (pmic@2) and smb2351_a (pmic@a) in sc8180x-pmics.dtsi so the board DTS files build.

2. &qupv3_id_2 { status = "okay"; } in the SPX dtsi so uart13 (BT) and uart15 (SAM EC) are populated.

3. Tested caspar.dtb as-is but this will cap CPU4 at 2.995 GHz (SQ1 clocks). Added carina's two SQ2 CPU4 OPPs to reach 3.15 GHz on my SQ2 Wi-Fi. Please see reply to 2/5.

4. Wi-Fi: I had to revert v7.4-rc1 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint registration") otherwise MPSS hits a fatal error ~40s after every start and crash-loops. Wi-Fi associates but never passes traffic.
After reverting it the modem starts up so this may be a regression unrelated to this series.

With the fixups noted above, for
- Surface Pro X Wi-Fi SQ2 (Surface_Pro_X_2010)

Happy to re-test v2 on this unit if needed.

Thanks,
Haipeng