From 837a3647eb9edd7b11d98d85e9c70997a6717397 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 4 Jan 2023 09:14:53 +0000
Subject: [PATCH] overlays: i2c-sensor: MS temp & pressure sensors

Add support for the Measurement Specialities temperature and pressure
sensors to the i2c-sensor overlay. The supported devices are MS5637,
MS5803, MS5805, MS5837 and MS8607.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README             | 20 ++++-
 .../boot/dts/overlays/i2c-sensor-common.dtsi  | 79 ++++++++++++++++++-
 2 files changed, 96 insertions(+), 3 deletions(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1982,8 +1982,9 @@ Info:   Adds support for a number of I2C
         light level and chemical sensors on i2c_arm
 Load:   dtoverlay=i2c-sensor,<param>=<val>
 Params: addr                    Set the address for the BH1750, BME280, BME680,
-                                BMP280, CCS811, DS1621, HDC100X, LM75, SHT3x or
-                                TMP102
+                                BMP280, CCS811, DS1621, HDC100X, JC42, LM75,
+                                MCP980x, MS5637, MS5803, MS5805, MS5837, MS8607,
+                                SHT3x or TMP102
 
         aht10                   Select the Aosong AHT10 temperature and humidity
                                 sensor
@@ -2044,6 +2045,21 @@ Params: addr                    Set the
                                 use the "jc42" option.
                                 Valid addresses are 0x18-0x1f (default 0x18)
 
+        ms5637                  Select the Measurement Specialities MS5637
+                                pressure and temperature sensor.
+
+        ms5803                  Select the Measurement Specialities MS5803
+                                pressure and temperature sensor.
+
+        ms5805                  Select the Measurement Specialities MS5805
+                                pressure and temperature sensor.
+
+        ms5837                  Select the Measurement Specialities MS5837
+                                pressure and temperature sensor.
+
+        ms8607                  Select the Measurement Specialities MS8607
+                                pressure and temperature sensor.
+
         no_timeout              Disable the SMBUS timeout. N.B. Only supported
                                 by some jc42 devices - using with an
                                 incompatible device can stop it from being
--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
+++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
@@ -351,6 +351,76 @@
 		};
 	};
 
+	fragment@23 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			ms5637: ms5637@76 {
+				compatible = "meas,ms5637";
+				reg = <0x76>;
+			};
+		};
+	};
+
+	fragment@24 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			ms5803: ms5803@76 {
+				compatible = "meas,ms5803";
+				reg = <0x76>;
+			};
+		};
+	};
+
+	fragment@25 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			ms5805: ms5805@76 {
+				compatible = "meas,ms5805";
+				reg = <0x76>;
+			};
+		};
+	};
+
+	fragment@26 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			ms5837: ms5837@76 {
+				compatible = "meas,ms5837";
+				reg = <0x76>;
+			};
+		};
+	};
+
+	fragment@27 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			ms8607: ms8607@76 {
+				compatible = "meas,ms8607-temppressure";
+				reg = <0x76>;
+			};
+		};
+	};
+
 	__overrides__ {
 		bme280 = <0>,"+0";
 		bmp085 = <0>,"+1";
@@ -376,11 +446,18 @@
 		aht10 = <0>,"+20";
 		mcp980x = <0>,"+21";
 		jc42 = <0>,"+22";
+		ms5637 = <0>,"+23";
+		ms5803 = <0>,"+24";
+		ms5805 = <0>,"+25";
+		ms5837 = <0>,"+26";
+		ms8607 = <0>,"+27";
 
 		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";
+			<&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";
 		no_timeout = <&jc42>, "smbus-timeout-disable?";
 	};
