[PATCH 3/3] sdm845: tama: Add AMS TCS3400 ambient light sensor

Petr Hodina via B4 Relay posted 3 patches 3 weeks, 1 day ago
[PATCH 3/3] sdm845: tama: Add AMS TCS3400 ambient light sensor
Posted by Petr Hodina via B4 Relay 3 weeks, 1 day ago
From: Petr Hodina <petr.hodina@protonmail.com>

Add device tree node for TCS3400 ambient light sensor with
power supplies, interrupt on GPIO11, and pinctrl states.

Signed-off-by: Petr Hodina <petr.hodina@protonmail.com>
---
 .../boot/dts/qcom/sdm845-sony-xperia-tama.dtsi     | 36 +++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
index 7dc9349eedfd..15d56d6831c5 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
@@ -485,7 +485,23 @@ &i2c14 {
 	clock-frequency = <400000>;
 
 	/* SONY ToF sensor @ 52 */
-	/* AMS TCS3490 RGB+IR color sensor @ 72 */
+
+	tcs3400_sensor: tcs3400_sensor@39 {
+		compatible = "ams,tcs3400";
+		reg = <0x39>;
+
+		interrupts-extended = <&tlmm 11 IRQ_TYPE_EDGE_FALLING>;
+
+		vdd-supply = <&vreg_l22a_2p8>;
+		vio-supply = <&cam_vio_vreg>;
+
+		pinctrl-0 = <&ams_sensor_default>;
+		pinctrl-1 = <&ams_sensor_sleep>;
+
+		ams,rgbcir-vdd-supply = <1>;
+		ams,rgbcir-gpio-vdd = <0>;
+		ams,rgbcir-vio-supply = <1>;
+	};
 };
 
 &ibb {
@@ -751,6 +767,24 @@ int-pins {
 			bias-pull-down;
 		};
 	};
+
+	ams_sensor_default: ams-sensor-default-state {
+		int-pins {
+			pins = "gpio11";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+
+	ams_sensor_sleep: ams_sensor-sleep-state {
+		int-pins {
+			pins = "gpio11";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-pull-down;
+		};
+	};
 };
 
 &uart6 {

-- 
2.52.0
Re: [PATCH 3/3] sdm845: tama: Add AMS TCS3400 ambient light sensor
Posted by Konrad Dybcio 3 weeks ago
On 1/19/26 6:19 PM, Petr Hodina via B4 Relay wrote:
> From: Petr Hodina <petr.hodina@protonmail.com>
> 
> Add device tree node for TCS3400 ambient light sensor with
> power supplies, interrupt on GPIO11, and pinctrl states.
> 
> Signed-off-by: Petr Hodina <petr.hodina@protonmail.com>
> ---
>  .../boot/dts/qcom/sdm845-sony-xperia-tama.dtsi     | 36 +++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
> index 7dc9349eedfd..15d56d6831c5 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
> @@ -485,7 +485,23 @@ &i2c14 {
>  	clock-frequency = <400000>;
>  
>  	/* SONY ToF sensor @ 52 */
> -	/* AMS TCS3490 RGB+IR color sensor @ 72 */
> +
> +	tcs3400_sensor: tcs3400_sensor@39 {

node names (between ':' and '@') must not contain underscores,
and should be generic where possible, let's call it sensor@,
rgb-ir@ or perhaps colorimeter@ (Krzysztof, opinions?)

> +		compatible = "ams,tcs3400";
> +		reg = <0x39>;

I can't find supporting evidence for this reg change

> +
> +		interrupts-extended = <&tlmm 11 IRQ_TYPE_EDGE_FALLING>;
> +
> +		vdd-supply = <&vreg_l22a_2p8>;
> +		vio-supply = <&cam_vio_vreg>;
> +
> +		pinctrl-0 = <&ams_sensor_default>;
> +		pinctrl-1 = <&ams_sensor_sleep>;
> +
> +		ams,rgbcir-vdd-supply = <1>;
> +		ams,rgbcir-gpio-vdd = <0>;
> +		ams,rgbcir-vio-supply = <1>;
> +	};
>  };
>  
>  &ibb {
> @@ -751,6 +767,24 @@ int-pins {
>  			bias-pull-down;
>  		};
>  	};
> +
> +	ams_sensor_default: ams-sensor-default-state {
> +		int-pins {

Drop this inner level, define the properties directly under the
-state node, both cases

Konrad
Re: [PATCH 3/3] sdm845: tama: Add AMS TCS3400 ambient light sensor
Posted by David Heidelberg 3 weeks, 1 day ago
On 19/01/2026 18:19, Petr Hodina via B4 Relay wrote:
> From: Petr Hodina <petr.hodina@protonmail.com>
> 
> Add device tree node for TCS3400 ambient light sensor with
> power supplies, interrupt on GPIO11, and pinctrl states.
> 
> Signed-off-by: Petr Hodina <petr.hodina@protonmail.com>
> ---
>   .../boot/dts/qcom/sdm845-sony-xperia-tama.dtsi     | 36 +++++++++++++++++++++-
>   1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
> index 7dc9349eedfd..15d56d6831c5 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
> @@ -485,7 +485,23 @@ &i2c14 {
>   	clock-frequency = <400000>;
>   
>   	/* SONY ToF sensor @ 52 */
> -	/* AMS TCS3490 RGB+IR color sensor @ 72 */
> +

Nice! Few comments:

You replacing sensor comment at 0x72 with one 0x39, could be there 
different sensor model with different address? e.g. tcs3400 vs tcs3490?

Also the node should go above ToF sensor as @39 < @52.

> +	tcs3400_sensor: tcs3400_sensor@39 {
> +		compatible = "ams,tcs3400";
> +		reg = <0x39>;
> +
> +		interrupts-extended = <&tlmm 11 IRQ_TYPE_EDGE_FALLING>;
> +
> +		vdd-supply = <&vreg_l22a_2p8>;
> +		vio-supply = <&cam_vio_vreg>;
> +
> +		pinctrl-0 = <&ams_sensor_default>;
> +		pinctrl-1 = <&ams_sensor_sleep>;

pinctrl-names missing

> +
> +		ams,rgbcir-vdd-supply = <1>;
> +		ams,rgbcir-gpio-vdd = <0>;
> +		ams,rgbcir-vio-supply = <1>;
> +	};
>   };
>   
>   &ibb {
> @@ -751,6 +767,24 @@ int-pins {
>   			bias-pull-down;
>   		};
>   	};
> +
> +	ams_sensor_default: ams-sensor-default-state {
> +		int-pins {
> +			pins = "gpio11";
> +			function = "gpio";
> +			drive-strength = <2>;
> +			bias-pull-up;
> +		};
> +	};
> +
> +	ams_sensor_sleep: ams_sensor-sleep-state {
> +		int-pins {
> +			pins = "gpio11";
> +			function = "gpio";
> +			drive-strength = <2>;
> +			bias-pull-down;
> +		};
> +	};
>   };
>   
>   &uart6 {
> 

-- 
David Heidelberg