[PATCH v2] arm64: dts: qcom: x1e80100-dell-xps13-9345: enable onboard accelerometers

Aleksandrs Vinarskis posted 1 patch 2 days, 19 hours ago
.../boot/dts/qcom/x1e80100-dell-xps13-9345.dts     | 94 ++++++++++++++++++++++
1 file changed, 94 insertions(+)
[PATCH v2] arm64: dts: qcom: x1e80100-dell-xps13-9345: enable onboard accelerometers
Posted by Aleksandrs Vinarskis 2 days, 19 hours ago
Particular laptop comes with two sets of sensors:
1. Motherboard: accelerometer
2. Display/Camera module: accelerometer, ambient ligth (and more)
   sensor

Both i2c busses are bound to Snapdragon Sensor Core (SSC) and are
typically controlled by (A)DSP thus allowing for great power
efficiency. This however requires DSP libraries matching ADSP firmware,
sensors descriptions (must be extracted from Windows) and other
potentially closed-source libraries. Opensource tooling includes
`libssc` and `hexagonrpcd`, but they were not verified to be working.

Until SSC support for X1E lands, bitbang both i2c busses to enable
accelerometer functionality. In the future if/when sensors on this
platform can be used from DSP directly, this commit can be reverted.

Both accelerometers were tested individually via `monitor-sensor`.
Display accelerometer is defined first, as it appears automatic
screen rotation tools simply pick the 1st iio device.

Signed-off-by: Aleksandrs Vinarskis <alex@vinarskis.com>
---
Enable two accelerometers, one on the motherboard, one in display.
In combination with userland screen rotation tools such as Gnome's
'screen rotate' [1] this allows for automatic screen rotation depending
on device orientation.

There appears to be an ALS, a "True Color Sensor with Flicker Detection"
AMS TCS3530 at 0x39. Out-of-tree driver from OSRAM is available [2].
Document bus, address, IRQ such that it could be added in the future.

There is an issue with st_sensors which prevents initializing two
sensors at the time, fix submitted [3]. It is not blocking this series,
as without it, 2nd currently unused accelerometer on the motherboard
will simply fail to probe.

[1] https://extensions.gnome.org/extension/5389/screen-rotate
[2] https://ams-osram.com/support/download-center?search=TCS3530&type=software&subtype=driver
[3] https://lore.kernel.org/all/20260228-st-iio-trigger-v1-1-abf5909e547f@vinarskis.com/
---
Changes in v2:
- Fixed i2c node names to pass dtbs_check
- Updated commit description to reflect discussions of v1
- Link to v1: https://lore.kernel.org/r/20260228-dell-xps-9345-accel-v1-1-daf9e3b3b5ee@vinarskis.com
---
 .../boot/dts/qcom/x1e80100-dell-xps13-9345.dts     | 94 ++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/x1e80100-dell-xps13-9345.dts b/arch/arm64/boot/dts/qcom/x1e80100-dell-xps13-9345.dts
index ce7b10ea89b6dcb2a4a65c114037f4c90a4b0c6d..bde88655c36889cc4865a109370a9d2cd0166a00 100644
--- a/arch/arm64/boot/dts/qcom/x1e80100-dell-xps13-9345.dts
+++ b/arch/arm64/boot/dts/qcom/x1e80100-dell-xps13-9345.dts
@@ -40,6 +40,67 @@ switch-lid {
 		};
 	};
 
+	/* Display-mounted sensors */
+	i2c-sensors1 {
+		compatible = "i2c-gpio";
+		i2c-gpio,delay-us = <2>;
+
+		scl-gpios = <&tlmm 232 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		sda-gpios = <&tlmm 231 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+
+		pinctrl-0 = <&sensors_i2c_display_default>;
+		pinctrl-names = "default";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		accelerometer@18 {
+			compatible = "st,lis2dw12";
+			reg = <0x18>;
+
+			interrupts-extended = <&tlmm 29 IRQ_TYPE_LEVEL_LOW>;
+			pinctrl-0 = <&acc_display_int_n_default>;
+			pinctrl-names = "default";
+
+			mount-matrix = "-1", "0", "0",
+				       "0", "1", "0",
+				       "0", "0", "-1";
+		};
+
+		/* AMS TCS3530 @ 0x39, IRQ 93 */
+	};
+
+	/* Motherboard-mounted sensors */
+	i2c-sensors2 {
+		compatible = "i2c-gpio";
+		i2c-gpio,delay-us = <2>;
+
+		scl-gpios = <&tlmm 216 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		sda-gpios = <&tlmm 215 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+
+		pinctrl-0 = <&sensors_i2c_mobo_default>;
+		pinctrl-names = "default";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		accelerometer@18 {
+			compatible = "st,lis2dw12";
+			reg = <0x18>;
+
+			interrupts-extended = <&tlmm 28 IRQ_TYPE_LEVEL_LOW>;
+			pinctrl-0 = <&acc_mobo_int_n_default>;
+			pinctrl-names = "default";
+
+			vdd-supply = <&vreg_l10b_1p8>;
+			vddio-supply = <&vreg_l10b_1p8>;
+
+			mount-matrix = "0", "1", "0",
+				       "0", "0", "1",
+				       "1", "0", "0";
+		};
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -450,6 +511,13 @@ vreg_l9b_2p9: ldo9 {
 			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
 		};
 
+		vreg_l10b_1p8: ldo10 {
+			regulator-name = "vreg_l10b_1p8";
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
 		vreg_l12b_1p2: ldo12 {
 			regulator-name = "vreg_l12b_1p2";
 			regulator-min-microvolt = <1200000>;
@@ -1074,6 +1142,18 @@ &tlmm {
 			       <76 4>,  /* SPI19 (TZ Protected) */
 			       <238 1>; /* UFS Reset */
 
+	acc_display_int_n_default: acc-display-int-n-state {
+		pins = "gpio29";
+		function = "gpio";
+		bias-pull-up;
+	};
+
+	acc_mobo_int_n_default: acc-mobo-int-n-state {
+		pins = "gpio28";
+		function = "gpio";
+		bias-pull-up;
+	};
+
 	cam_indicator_en: cam-indicator-en-state {
 		pins = "gpio110";
 		function = "gpio";
@@ -1197,6 +1277,20 @@ rtmr1_default: rtmr1-reset-n-active-state {
 		bias-disable;
 	};
 
+	sensors_i2c_display_default: sensors-i2c-display-state {
+		pins = "gpio231", "gpio232";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	sensors_i2c_mobo_default: sensors-i2c-mobo-state {
+		pins = "gpio215", "gpio216";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	tpad_default: tpad-default-state {
 		disable-pins {
 			pins = "gpio38";

---
base-commit: 3b058d1aeeeff27a7289529c4944291613b364e9
change-id: 20260228-dell-xps-9345-accel-4ab40ed9c827

Best regards,
-- 
Aleksandrs Vinarskis <alex@vinarskis.com>
Re: [PATCH v2] arm64: dts: qcom: x1e80100-dell-xps13-9345: enable onboard accelerometers
Posted by Val Packett 2 days, 15 hours ago
On 3/31/26 10:36 AM, Aleksandrs Vinarskis wrote:
> Particular laptop comes with two sets of sensors:
> 1. Motherboard: accelerometer
> 2. Display/Camera module: accelerometer, ambient ligth (and more)
>     sensor
>
> Both i2c busses are bound to Snapdragon Sensor Core (SSC) and are
> typically controlled by (A)DSP thus allowing for great power
> efficiency. This however requires DSP libraries matching ADSP firmware,
> sensors descriptions (must be extracted from Windows) and other
> potentially closed-source libraries. Opensource tooling includes
> `libssc` and `hexagonrpcd`, but they were not verified to be working.
>
> Until SSC support for X1E lands, bitbang both i2c busses to enable
> accelerometer functionality. In the future if/when sensors on this
> platform can be used from DSP directly, this commit can be reverted.
>
> [..]

WDYM by "support lands"? It's a userspace setup thing, nothing new 
should be required in the kernel.

It is amazing that this bitbanging works here, I don't think it was 
expected to ever work on anything newer than msm89x7 o.0

But this is likely inefficient… and "stealing" GPIOs from ADSP like this 
sounds rather scary. And would definitely break SSC initialization for 
anyone wanting to bring up hexagonrpcd/iio-sensor-proxy.

~val

Re: [PATCH v2] arm64: dts: qcom: x1e80100-dell-xps13-9345: enable onboard accelerometers
Posted by Aleksandrs Vinarskis 2 days, 15 hours ago
On Tuesday, March 31st, 2026 at 19:05, Val Packett <val@packett.cool> wrote:

> On 3/31/26 10:36 AM, Aleksandrs Vinarskis wrote:
> > Particular laptop comes with two sets of sensors:
> > 1. Motherboard: accelerometer
> > 2. Display/Camera module: accelerometer, ambient ligth (and more)
> >     sensor
> >
> > Both i2c busses are bound to Snapdragon Sensor Core (SSC) and are
> > typically controlled by (A)DSP thus allowing for great power
> > efficiency. This however requires DSP libraries matching ADSP firmware,
> > sensors descriptions (must be extracted from Windows) and other
> > potentially closed-source libraries. Opensource tooling includes
> > `libssc` and `hexagonrpcd`, but they were not verified to be working.
> >
> > Until SSC support for X1E lands, bitbang both i2c busses to enable
> > accelerometer functionality. In the future if/when sensors on this
> > platform can be used from DSP directly, this commit can be reverted.
> >
> > [..]
> 
> WDYM by "support lands"? It's a userspace setup thing, nothing new
> should be required in the kernel.

Hi Val,

In v1 discussion [1] it was mentioned that libssc was never tested on
X1E and is likely missing required libraries. I have briefly looked
into getting `hexagonrpcd` to run without much success (though I have 
to admit, I only spend a few hours on it). It seems just having
`hexagonrpcd` and sensors .json files (extracted from Windows) is not
enough.

> 
> It is amazing that this bitbanging works here, I don't think it was
> expected to ever work on anything newer than msm89x7 o.0

Been running it for a few weeks now without issues.

> 
> But this is likely inefficient… and "stealing" GPIOs from ADSP like this
> sounds rather scary. And would definitely break SSC initialization for
> anyone wanting to bring up hexagonrpcd/iio-sensor-proxy.

Do you have any experience with `hexagonrpcd` on X1/X1E specifically?
Personally, I think it still better to go with always-working bit-bang
approach over correctly implemented but 'needs userspace customization
and firmware' approach, as in practice it means very few people will
get it to work. However, if its possible to get SSC to run X1/X1E it
would be a very good argument to drop this patch, up to maintainers'
discretion.

Speaking more broadly, while the accelerometer is not such a highly
needed feature, ALS is, as it can be used for automatic screen brightness,
keyboard backlight controls. I am planning to port ALS's driver to get
those features next, depending on sensor model other laptops would be
able to benefit from that as well, iff bit-banging approach is chosen.

Alex

[1] https://lore.kernel.org/all/20260228-dell-xps-9345-accel-v1-1-daf9e3b3b5ee@vinarskis.com/

> 
> ~val
> 
>