Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Bjorn Andersson <andersson@kernel.org>
To: emcp@enser.io
Cc: Konrad Dybcio <konradybcio@kernel.org>,
	 Abel Vesa <abelvesa@kernel.org>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,  Luca Weiss <luca@lucaweiss.eu>
Subject: Re: [PATCH] ARM: dts: qcom: msm8974-hammerhead: Fix the IMU mount matrix
Date: Fri, 4 Dec 2026 16:25:01 -0600	[thread overview]
Message-ID: <axM9r2Bk7ZbMbcmR@zenbook> (raw)
In-Reply-To: <20261122-b4-hammerhead-imu-mount-matrix-v1-1-fa38561de9ca@enser.io>

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>
> 
> 

      parent reply	other threads:[~2026-12-04 22:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=axM9r2Bk7ZbMbcmR@zenbook \
    --to=andersson@kernel.org \
    --cc=abelvesa@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=emcp@enser.io \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca@lucaweiss.eu \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox