From 84620c3e9ae40dae2f1f8307150bc1f3d2e99db4 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 29 Oct 2024 11:53:45 +0000
Subject: [PATCH] overlays: Add TCS3472 and VEML6040 support

Extend the i2c-sensor overlay with support for the VEML6040 and TCS3472
family of light sensors.

Link: https://github.com/raspberrypi/linux/issues/6446

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README             |  6 +++
 .../boot/dts/overlays/i2c-sensor-common.dtsi  | 38 ++++++++++++++++++-
 2 files changed, 43 insertions(+), 1 deletion(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2567,12 +2567,18 @@ Params: addr                    Set the
         sgp30                   Select the Sensirion SGP30 VOC sensor.
                                 Fixed address 0x58.
 
+        tcs3472                 Select the AMS TAOS TCS3472 family of RGBW light
+                                sensors.
+                                Valid addresses 0x48-0x4b, default 0x48
+
         tmp102                  Select the Texas Instruments TMP102 temp sensor
                                 Valid addresses 0x48-0x4b, default 0x48
 
         tsl4531                 Select the AMS TSL4531 digital ambient light
                                 sensor
 
+        veml6040                Select the Vishay VEML6040 RGBW light sensor
+
         veml6070                Select the Vishay VEML6070 ultraviolet light
                                 sensor
 
--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
+++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
@@ -680,6 +680,39 @@
 		};
 	};
 
+	fragment@44 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			tcs3472: tcs3472@29 {
+				compatible = "amstaos,tcs3472";
+				reg = <0x29>;
+				interrupt-parent = <&gpio>;
+				interrupts = <4 IRQ_TYPE_EDGE_RISING>;
+				pinctrl-0 = <&int_pins>;
+				pinctrl-names = "default";
+			};
+		};
+	};
+
+	fragment@45 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			veml6040: veml6040@10 {
+				compatible = "vishay,veml6040";
+				reg = <0x10>;
+				status = "okay";
+			};
+		};
+	};
+
 	fragment@99 {
 		target = <&gpio>;
 		__dormant__ {
@@ -736,6 +769,8 @@
 		as7331 = <0>,"+41+99";
 		adxl345 = <0>,"+42+99";
 		aht20 = <0>,"+43";
+		tcs3472 = <0>,"+44+99";
+		veml6040 = <0>,"+45";
 
 		addr =	<&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0",
 			<&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0",
@@ -757,7 +792,8 @@
 			<&hdc3020>, "interrupts:0",
 			<&as73211>, "interrupts:0",
 			<&as7331>, "interrupts:0",
-			<&adxl345>, "interrupts:0";
+			<&adxl345>, "interrupts:0",
+			<&tcs3472>, "interrupts:0";
 		no_timeout = <&jc42>, "smbus-timeout-disable?";
 		reset_pin = <&bno055>,"reset-gpios:4", <0>,"+30";
 		shunt_resistor = <&ina238>,"shunt-resistor:0";
