[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9fb7ac10-3966-4c43-b550-827108bff886@gmail.com>
Date: Sat, 27 Sep 2025 20:54:24 -0700
From: Rudraksha Gupta <guptarud@...il.com>
To: Ondřej Jirman <megi@....cz>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Heiko Stuebner <heiko@...ech.de>,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/5] arm64: dts: rk3399-pinephone-pro: Add
accelerometer sensor support
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
Powered by blists - more mailing lists