mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			168 lines
		
	
	
	
		
			5.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			168 lines
		
	
	
	
		
			5.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From f50251a2f676c9b80077995a15e49f212bbeb877 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;
 | |
|  	};
 |