aboutsummaryrefslogtreecommitdiff
path: root/target/linux/bcm27xx/patches-6.1/950-0539-overlays-i2c-sensor-Add-mpu6050-and-mpu9250.patch
blob: 9ff84dd1e7c4ef73e6a63dc463f594ecaad7aa11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
From d9cc69d32d100db9e383c81bd5c8f62ec16fd61c Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 17 Jan 2023 15:47:04 +0000
Subject: [PATCH] overlays: i2c-sensor: Add mpu6050 and mpu9250

Add support for the MPU6050 and MPU9250 IMU sensors to the i2c-sensor
container overlay. At the same time, deprecate the standalone mpu6050
overlay, but keep it around for now.

(Also fix a few typos spotted while editing)

See: https://github.com/raspberrypi/linux/issues/5325

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README             | 26 ++++++-----
 .../boot/dts/overlays/i2c-sensor-common.dtsi  | 43 ++++++++++++++++++-
 arch/arm/boot/dts/overlays/overlay_map.dts    |  4 ++
 3 files changed, 61 insertions(+), 12 deletions(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1983,8 +1983,8 @@ Info:   Adds support for a number of I2C
 Load:   dtoverlay=i2c-sensor,<param>=<val>
 Params: addr                    Set the address for the BH1750, BME280, BME680,
                                 BMP280, CCS811, DS1621, HDC100X, JC42, LM75,
-                                MCP980x, MS5637, MS5803, MS5805, MS5837, MS8607,
-                                SHT3x or TMP102
+                                MCP980x, MPU6050, MPU9250, MS5637, MS5803,
+                                MS5805, MS5837, MS8607, SHT3x or TMP102
 
         aht10                   Select the Aosong AHT10 temperature and humidity
                                 sensor
@@ -2016,8 +2016,8 @@ Params: addr                    Set the
 
         htu21                   Select the HTU21 temperature and humidity sensor
 
-        int_pin                 Set the GPIO to use for interrupts (max30102
-                                only)
+        int_pin                 Set the GPIO to use for interrupts (max30102,
+                                mpu6050 and mpu9250 only)
 
         jc42                    Select any of the many JEDEC JC42.4-compliant
                                 temperature sensors, including:
@@ -2045,6 +2045,12 @@ Params: addr                    Set the
                                 use the "jc42" option.
                                 Valid addresses are 0x18-0x1f (default 0x18)
 
+        mpu6050                 Select the InvenSense MPU6050 IMU. Valid
+                                valid addresses are 0x68 and 0x69 (default 0x68)
+
+        mpu9250                 Select the InvenSense MPU9250 IMU. Valid
+                                valid addresses are 0x68 and 0x69 (default 0x68)
+
         ms5637                  Select the Measurement Specialities MS5637
                                 pressure and temperature sensor.
 
@@ -2913,10 +2919,10 @@ Params: overclock_50            Clock (i
 
 
 Name:   mpu6050
-Info:   Overlay for i2c connected mpu6050 imu
-Load:   dtoverlay=mpu6050,<param>=<val>
-Params: interrupt               GPIO pin for interrupt (default 4)
-        addr                    I2C address of the device (default 0x68)
+Info:   This overlay has been deprecated - use "dtoverlay=i2c-sensor,mpu6050"
+        instead. Note that "int_pin" is the new name for the "interrupt"
+        parameter.
+Load:   <Deprecated>
 
 
 Name:   mz61581
@@ -3416,7 +3422,7 @@ Params: <None>
 
 
 Name:   rpi-dac
-Info:   This overlay has been renaamed to i2s-dac.
+Info:   This overlay has been renamed to i2s-dac.
 Load:   <Deprecated>
 
 
@@ -3546,7 +3552,7 @@ Params: poe_fan_temp0           Temperat
 
 
 Name:   rpi-proto
-Info:   This overlay has been renamaed to proto-codec.
+Info:   This overlay has been renamed to proto-codec.
 Load:   <Deprecated>
 
 
--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
+++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
@@ -421,6 +421,40 @@
 		};
 	};
 
+	fragment@28 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+                        clock-frequency = <400000>;
+
+                        mpu6050: mpu6050@68 {
+                                compatible = "invensense,mpu6050";
+                                reg = <0x68>;
+                                interrupt-parent = <&gpio>;
+                                interrupts = <4 2>;
+                        };
+		};
+	};
+
+	fragment@29 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+                        clock-frequency = <400000>;
+
+                        mpu9250: mpu9250@68 {
+                                compatible = "invensense,mpu9250";
+                                reg = <0x68>;
+                                interrupt-parent = <&gpio>;
+                                interrupts = <4 2>;
+                        };
+		};
+	};
+
 	__overrides__ {
 		bme280 = <0>,"+0";
 		bmp085 = <0>,"+1";
@@ -451,14 +485,19 @@
 		ms5805 = <0>,"+25";
 		ms5837 = <0>,"+26";
 		ms8607 = <0>,"+27";
+		mpu6050 = <0>,"+28";
+		mpu9250 = <0>,"+29";
 
 		addr =  <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0",
 			<&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0",
 			<&ds1621>,"reg:0", <&bme680>,"reg:0", <&ccs811>,"reg:0",
 			<&bh1750>,"reg:0", <&mcp980x>,"reg:0", <&jc42>,"reg:0",
 			<&ms5637>,"reg:0", <&ms5803>,"reg:0", <&ms5805>,"reg:0",
-			<&ms5837>,"reg:0", <&ms8607>,"reg:0";
-		int_pin = <&max30102>, "interrupts:0";
+			<&ms5837>,"reg:0", <&ms8607>,"reg:0",
+			<&mpu6050>, "reg:0", <&mpu9250>, "reg:0";
+		int_pin = <&max30102>, "interrupts:0",
+			<&mpu6050>, "interrupts:0",
+			<&mpu9250>, "interrupts:0";
 		no_timeout = <&jc42>, "smbus-timeout-disable?";
 	};
 };
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -61,6 +61,10 @@
 		bcm2711;
 	};
 
+	mpu6050 {
+		deprecated = "use i2c-sensor,mpu6050";
+	};
+
 	pcie-32bit-dma {
 		bcm2711;
 	};