The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: qcom: msm8974-hammerhead: Fix the IMU mount matrix
@ 2026-11-22  5:12 EMCP333 via B4 Relay
  2026-11-23 15:27 ` Konrad Dybcio
  2026-12-04 22:25 ` Bjorn Andersson
  0 siblings, 2 replies; 3+ messages in thread
From: EMCP333 via B4 Relay @ 2026-11-22  5:12 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio
  Cc: Abel Vesa, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-arm-msm, devicetree, linux-kernel, Luca Weiss, EMCP333

From: EMCP333 <emcp@enser.io>

The mount matrix added for the MPU6515 is the negative of the one the
vendor kernel uses. LG's hammerhead device tree maps the axes as

	axis_map_x = <1>; axis_map_y = <0>; axis_map_z = <2>;
	negate_x = <0>;   negate_y = <0>;   negate_z = <1>;

that is x = y_raw, y = x_raw, z = -z_raw, while the current matrix gives
x = -y_raw, y = -x_raw, z = z_raw. Every axis is inverted, so a phone
lying face up reads -1 g on z (face down), and held upright in portrait
it reads -1 g on y, which orientation daemons take as upside down: the
screen rotates to 180 degrees when the phone is held normally.

The current matrix also has determinant -1, a reflection, which no
physical mounting can produce. The vendor mapping is a proper rotation
and gives +1 g out of the screen when face up, as
Documentation/devicetree/bindings/iio/mount-matrix.txt expects.

Tested on a Nexus 5 running the postmarketOS 6.16 kernel with only this
matrix changed in its DTB. Held upright, sideways both ways and lying
face up, it read +9.7 m/s^2 on y, +9.7 and -9.7 on x, and +9.4 to +10.0
on z, and the orientation daemon turned the screen the right way up in
each case. With the old matrix, portrait was shown upside down. On
v7.4-rc2 the DTB builds with no new dtbs_check warnings.

The code and this changelog were prepared with the help of an AI coding
assistant. The submitter has reviewed both and takes responsibility for
them.

Fixes: 73c9729f0fb5 ("ARM: dts: qcom: msm8974-hammerhead: add mount matrix for IMU")
Signed-off-by: EMCP333 <emcp@enser.io>
---
 arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts
index e34d7b864e..9128c66125 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts
+++ b/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts
@@ -213,9 +213,9 @@ mpu6515@68 {
 		pinctrl-names = "default";
 		pinctrl-0 = <&mpu6515_pin>;
 
-		mount-matrix = "0", "-1", "0",
-				"-1", "0", "0",
-				"0", "0", "1";
+		mount-matrix = "0", "1", "0",
+				"1", "0", "0",
+				"0", "0", "-1";
 
 		i2c-gate {
 			#address-cells = <1>;

---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261122-b4-hammerhead-imu-mount-matrix-3baa8237755a

Best regards,
--  
EMCP333 <emcp@enser.io>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: dts: qcom: msm8974-hammerhead: Fix the IMU mount matrix
  2026-11-22  5:12 [PATCH] ARM: dts: qcom: msm8974-hammerhead: Fix the IMU mount matrix EMCP333 via B4 Relay
@ 2026-11-23 15:27 ` Konrad Dybcio
  2026-12-04 22:25 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2026-11-23 15:27 UTC (permalink / raw)
  To: emcp, Bjorn Andersson, Konrad Dybcio
  Cc: Abel Vesa, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-arm-msm, devicetree, linux-kernel, Luca Weiss

On 11/22/26 6:12 AM, EMCP333 via B4 Relay wrote:
> From: EMCP333 <emcp@enser.io>

As mentioned on another patch, I need you to use a well-known identity
(i.e. generally your real name). I look forward to reviewing v2 of your
patches!

Konrad

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: dts: qcom: msm8974-hammerhead: Fix the IMU mount matrix
  2026-11-22  5:12 [PATCH] ARM: dts: qcom: msm8974-hammerhead: Fix the IMU mount matrix EMCP333 via B4 Relay
  2026-11-23 15:27 ` Konrad Dybcio
@ 2026-12-04 22:25 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2026-12-04 22:25 UTC (permalink / raw)
  To: emcp
  Cc: Konrad Dybcio, Abel Vesa, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-arm-msm, devicetree, linux-kernel, Luca Weiss

On Sun, Nov 22, 2026 at 05:12:54AM +0000, EMCP333 via B4 Relay wrote:
> From: EMCP333 <emcp@enser.io>
> 
> The mount matrix added for the MPU6515 is the negative of the one the
> vendor kernel uses. LG's hammerhead device tree maps the axes as
> 
> 	axis_map_x = <1>; axis_map_y = <0>; axis_map_z = <2>;
> 	negate_x = <0>;   negate_y = <0>;   negate_z = <1>;
> 
> that is x = y_raw, y = x_raw, z = -z_raw, while the current matrix gives
> x = -y_raw, y = -x_raw, z = z_raw. Every axis is inverted, so a phone
> lying face up reads -1 g on z (face down), and held upright in portrait
> it reads -1 g on y, which orientation daemons take as upside down: the
> screen rotates to 180 degrees when the phone is held normally.
> 
> The current matrix also has determinant -1, a reflection, which no
> physical mounting can produce. The vendor mapping is a proper rotation
> and gives +1 g out of the screen when face up, as
> Documentation/devicetree/bindings/iio/mount-matrix.txt expects.
> 
> Tested on a Nexus 5 running the postmarketOS 6.16 kernel with only this
> matrix changed in its DTB. Held upright, sideways both ways and lying
> face up, it read +9.7 m/s^2 on y, +9.7 and -9.7 on x, and +9.4 to +10.0
> on z, and the orientation daemon turned the screen the right way up in
> each case. With the old matrix, portrait was shown upside down. On
> v7.4-rc2 the DTB builds with no new dtbs_check warnings.
> 
> The code and this changelog were prepared with the help of an AI coding
> assistant. The submitter has reviewed both and takes responsibility for
> them.
> 
> Fixes: 73c9729f0fb5 ("ARM: dts: qcom: msm8974-hammerhead: add mount matrix for IMU")
> Signed-off-by: EMCP333 <emcp@enser.io>

Please use your real/full name.

Thanks,
Bjorn

> ---
>  arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts
> index e34d7b864e..9128c66125 100644
> --- a/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts
> +++ b/arch/arm/boot/dts/qcom/qcom-msm8974-lge-nexus5-hammerhead.dts
> @@ -213,9 +213,9 @@ mpu6515@68 {
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&mpu6515_pin>;
>  
> -		mount-matrix = "0", "-1", "0",
> -				"-1", "0", "0",
> -				"0", "0", "1";
> +		mount-matrix = "0", "1", "0",
> +				"1", "0", "0",
> +				"0", "0", "-1";
>  
>  		i2c-gate {
>  			#address-cells = <1>;
> 
> ---
> base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
> change-id: 20261122-b4-hammerhead-imu-mount-matrix-3baa8237755a
> 
> Best regards,
> --  
> EMCP333 <emcp@enser.io>
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-04 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22  5:12 [PATCH] ARM: dts: qcom: msm8974-hammerhead: Fix the IMU mount matrix EMCP333 via B4 Relay
2026-11-23 15:27 ` Konrad Dybcio
2026-12-04 22:25 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox