[PATCH v4 2/4] arm64: dts: rk3399-pinephone-pro: Add accelerometer sensor support

Rudraksha Gupta via B4 Relay posted 4 patches 2 days, 15 hours ago
[PATCH v4 2/4] arm64: dts: rk3399-pinephone-pro: Add accelerometer sensor support
Posted by Rudraksha Gupta via B4 Relay 2 days, 15 hours ago
From: Ondrej Jirman <megi@xff.cz>

Pinephone Pro uses mpu6500 according to the schematic.

Tests:
// Setup: This watches the raw values from the device. The variable with
// the biggest magnitude and its sign will be recorded
$ sudo systemctl stop iio-sensor-proxy
$ cat /sys/bus/iio/devices/iio:device3/in_accel_{x,y,z}_raw

// Let's start with phone screen facing up to the sky and the charger
// port closer to you than the front camera.
z: -16000

// Tilt the phone onto it's left edge
x: -16000

// Tilt the phone onto it's right edge
x: 16000

// Tilt the phone so that the charger port is pointing straight up to
// the sky
y: -16000

// Tilt the phone so that the top of the phone is pointing straight up
// to the sky
y: 16000

// Put the phone face down so the screen is touching the table
z: 16000

Co-developed-by: Martijn Braam <martijn@brixit.nl>
Signed-off-by: Martijn Braam <martijn@brixit.nl>
Co-developed-by: Kamil Trzciński <ayufan@ayufan.eu>
Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
index 71d32c4bae0d0336ac0c912043618fc9b94919ef..d9f18a8005f15f3ec26e086e5b451bf1bbdc21c0 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
@@ -542,7 +542,13 @@ mpu6500@68 {
 		reg = <0x68>;
 		interrupt-parent = <&gpio1>;
 		interrupts = <RK_PC6 IRQ_TYPE_LEVEL_LOW>;
+		vdd-supply = <&vcc_1v8>;
 		vddio-supply = <&vcc_1v8>;
+
+		mount-matrix =
+			"1", "0", "0",
+			"0", "1", "0",
+			"0", "0", "-1";
 	};
 };
 

-- 
2.51.0