From: Rudraksha Gupta <guptarud@gmail.com>
To: "Ondřej Jirman" <megi@xff.cz>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Heiko Stuebner" <heiko@sntech.de>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/5] arm64: dts: rk3399-pinephone-pro: Add accelerometer sensor support
Date: Sat, 27 Sep 2025 20:54:24 -0700 [thread overview]
Message-ID: <9fb7ac10-3966-4c43-b550-827108bff886@gmail.com> (raw)
In-Reply-To: <kkxecpaatgeqk7ru4maqtbgftiqmdjjweam2zw6xrvbbzpqy4a@nz6llsm37qdx>
Hello Ondřej,
> Well, it's not clear this will work as expected. Someone should at least test it
> with some well working userspace sensor fusion program, that uses this
> information, (along with the mount matrix for accelerometer/gyro) for eg.
> compass feature or something like that.
I'm not aware of any compass app on Linux at the moment
> Also I don't see this matrix in v3 patch set.
https://lore.kernel.org/all/20250921-ppp_light_accel_mag_vol-down-v3-4-7af6651f77e4@gmail.com/
+ mount-matrix = + "0", "1", "0", + "1", "0", "0", + "0", "0", "-1";
> Did you test it? Any suggestions on what people actully use for sensor fusion on
> Linux?
Yep! I did brief testing, but I've put detailed testing below:
For the accelerometer, the screen orientation works correctly now.
Originally when tilting the ppp to the side, the screen would rotate to
the correct side. However, when the phone was held regularly in your
hand, the screen was upside down. With this patch series, it is no
longer the case
For the magnetometer, the command I ran was
```
#!/bin/sh
DEVICE="/sys/bus/iio/devices/iio:device2"
X=$(cat $DEVICE/in_magn_x_raw)
Y=$(cat $DEVICE/in_magn_y_raw)
Z=$(cat $DEVICE/in_magn_z_raw)
X_MIN=$X; X_MAX=$X
Y_MIN=$Y; Y_MAX=$Y
Z_MIN=$Z; Z_MAX=$Z
START_TIME=$(date +%s)
while [ $(($(date +%s) - START_TIME)) -lt 10 ]; do
X=$(cat $DEVICE/in_magn_x_raw)
Y=$(cat $DEVICE/in_magn_y_raw)
Z=$(cat $DEVICE/in_magn_z_raw)
[ "$X" -lt "$X_MIN" ] && X_MIN=$X
[ "$X" -gt "$X_MAX" ] && X_MAX=$X
[ "$Y" -lt "$Y_MIN" ] && Y_MIN=$Y
[ "$Y" -gt "$Y_MAX" ] && Y_MAX=$Y
[ "$Z" -lt "$Z_MIN" ] && Z_MIN=$Z
[ "$Z" -gt "$Z_MAX" ] && Z_MAX=$Z
done
echo "X_MIN: $X_MIN X_MAX: $X_MAX"
echo "Y_MIN: $Y_MIN Y_MAX: $Y_MAX"
echo "Z_MIN: $Z_MIN Z_MAX: $Z_MAX"
```
Tests:
# phone on a flat surface
top of the phone pointing north and bottom of phone pointing south: x
(between -2379 and -2263), y (between 109 and 207), z (between -2340 and
-2132)
top of the phone pointing south and bottom of phone pointing north: x
(between -1079 and -956), y (between -54 and 46), z (between -1831 and
-1621)
top of the phone pointing east and bottom of phone pointing west: x
(between -1587 and -1473), y (between -448 and -339), z (between -1850
and -1602)
top of the phone pointing west and bottom of phone pointing east: x
(between -1426 and -1300), y (between 554 and 661), z (between -1917 and
-1706)
# the following tests are where the phone is tilted at a 45 degree angle
and the top of phone is pointing up to the sky:
top of the phone pointing north and bottom of phone pointing south: x
(between -1300 and -1189), y (between 117 and 227), z (between -1819 and
-1614)
top of the phone pointing south and bottom of phone pointing north: x
(between -539 and -422), y (between 23 and 143), z (between -1160 and -922)
top of the phone pointing east and bottom of phone pointing west: x
(between -1038 and -915), y (between -408 and -313), z (between -1570
and -1345)
top of the phone pointing west and bottom of phone pointing east: x
(between -965 and -849), y (between 540 and 641), z (between -1542 and
-1336)
# the following tests are where the phone is tilted at a 45 degree angle
and the top of phone is pointing down to the ground:
top of the phone pointing north and bottom of phone pointing south: x
(between -2345 and -2237), y (between 80 and 189), z (between -1207 and
-971)
top of the phone pointing south and bottom of phone pointing north: x
(between -1805 and -1691), y (between 5 and 112), z (between -1896 and
-1651)
top of the phone pointing east and bottom of phone pointing west: x
(between -2127 and -2013), y (between 460 and 563), z (between -1621 and
-1378)
top of the phone pointing west and bottom of phone pointing east: x
(between -2158 and -2054), y (between -376 and -264), z (between -1540
and -1262)
I will put my testing in the commit itself moving forward
Thanks,
Rudraksha
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2025-09-28 3:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-21 8:04 [PATCH v2 0/5] Upstreaming Pinephone Pro Patches Rudraksha Gupta via B4 Relay
2025-09-21 8:04 ` [PATCH v2 1/5] arm64: dts: rk3399-pinephone-pro: Add light/proximity sensor support Rudraksha Gupta via B4 Relay
2025-09-21 8:04 ` [PATCH v2 2/5] arm64: dts: rk3399-pinephone-pro: Add accelerometer " Rudraksha Gupta via B4 Relay
2025-09-21 13:10 ` Ondřej Jirman
2025-09-21 13:23 ` Ondřej Jirman
2025-09-21 21:07 ` Rudraksha Gupta
2025-09-22 16:59 ` Ondřej Jirman
2025-09-28 3:54 ` Rudraksha Gupta [this message]
2025-09-21 8:04 ` [PATCH v2 3/5] arm64: dts: rk3399-pinephone-pro: Add magnetometer " Rudraksha Gupta via B4 Relay
2025-09-21 8:04 ` [PATCH v2 4/5] arm64: dts: rk3399-pinephone-pro: Add mount-matrix for magnetometer Rudraksha Gupta via B4 Relay
2025-09-21 8:04 ` [PATCH v2 5/5] arm64: dts: rk3399-pinephone-pro: Fix voltage threshold for volume down key Rudraksha Gupta via B4 Relay
2025-09-21 11:20 ` Ondřej Jirman
2025-09-21 21:06 ` Rudraksha Gupta
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=9fb7ac10-3966-4c43-b550-827108bff886@gmail.com \
--to=guptarud@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=megi@xff.cz \
--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