[PATCH 1/4] ARM: dts: qcom: msm8960: expressatt: Add Light/Proximity Sensor

Rudraksha Gupta via B4 Relay posted 4 patches 1 week, 4 days ago
There is a newer version of this series
[PATCH 1/4] ARM: dts: qcom: msm8960: expressatt: Add Light/Proximity Sensor
Posted by Rudraksha Gupta via B4 Relay 1 week, 4 days ago
From: Rudraksha Gupta <guptarud@gmail.com>

Currently the Proximity Sensor doesn't work, but light sensor does.
Left the proximity sensor as a TODO for later.

Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
 .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
index 5ee919dce75b..1e331a046e7b 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
@@ -52,6 +52,31 @@ key-volume-down {
 			linux,code = <KEY_VOLUMEDOWN>;
 		};
 	};
+
+	i2c-gpio-sensors {
+		compatible = "i2c-gpio";
+		sda-gpios = <&tlmm 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		scl-gpios = <&tlmm 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		i2c-gpio,delay-us = <5>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		light-sensor@39 {
+			compatible = "amstaos,tmd2772";
+			reg = <0x39>;
+			interrupt-parent = <&pm8921_gpio>;
+			interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
+			vdd-supply = <&pm8921_l9>;
+			vddio-supply = <&pm8921_lvs4>;
+
+			// TODO: Proximity doesn't work
+			amstaos,proximity-diodes = <0>;
+			led-max-microamp = <100000>;
+
+			pinctrl-names = "default";
+			pinctrl-0 = <&prox_sensor_int>;
+		};
+	};
 };
 
 &gsbi5 {
@@ -163,6 +188,15 @@ &pm8921 {
 	interrupts-extended = <&tlmm 104 IRQ_TYPE_LEVEL_LOW>;
 };
 
+&pm8921_gpio {
+	prox_sensor_int: prox-sensor-int-state {
+		pins = "gpio6";
+		function = "normal";
+		input-enable;
+		bias-disable;
+	};
+};
+
 &rpm {
 	regulators {
 		compatible = "qcom,rpm-pm8921-regulators";
@@ -280,6 +314,7 @@ pm8921_l9: l9 {
 			regulator-min-microvolt = <2850000>;
 			regulator-max-microvolt = <2850000>;
 			bias-pull-down;
+			regulator-always-on;
 		};
 
 		pm8921_l10: l10 {
@@ -377,6 +412,7 @@ pm8921_lvs3: lvs3 {
 
 		pm8921_lvs4: lvs4 {
 			bias-pull-down;
+			regulator-always-on;
 		};
 
 		pm8921_lvs5: lvs5 {

-- 
2.51.2
Re: [PATCH 1/4] ARM: dts: qcom: msm8960: expressatt: Add Light/Proximity Sensor
Posted by Konrad Dybcio 1 week, 4 days ago
On 11/20/25 8:14 AM, Rudraksha Gupta via B4 Relay wrote:
> From: Rudraksha Gupta <guptarud@gmail.com>
> 
> Currently the Proximity Sensor doesn't work, but light sensor does.
> Left the proximity sensor as a TODO for later.
> 
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
>  .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 36 ++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> index 5ee919dce75b..1e331a046e7b 100644
> --- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> +++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> @@ -52,6 +52,31 @@ key-volume-down {
>  			linux,code = <KEY_VOLUMEDOWN>;
>  		};
>  	};
> +
> +	i2c-gpio-sensors {
> +		compatible = "i2c-gpio";


Are you using gpio-i2c for any specific reason? Would GSBI2 not be
connected to this pair? (I am not sure FWIW)

> +		sda-gpios = <&tlmm 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
> +		scl-gpios = <&tlmm 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
> +		i2c-gpio,delay-us = <5>;
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		light-sensor@39 {
> +			compatible = "amstaos,tmd2772";
> +			reg = <0x39>;
> +			interrupt-parent = <&pm8921_gpio>;
> +			interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
> +			vdd-supply = <&pm8921_l9>;
> +			vddio-supply = <&pm8921_lvs4>;
> +
> +			// TODO: Proximity doesn't work

C-style comments ( /* foo */ ) are preferred

> +			amstaos,proximity-diodes = <0>;

Try comparing the values the upstream and downstream drivers write
to the device, maybe you're missing something

> +			led-max-microamp = <100000>;
> +
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&prox_sensor_int>;

property-n
property-names

is the preferred order

> +		};
> +	};
>  };
>  
>  &gsbi5 {
> @@ -163,6 +188,15 @@ &pm8921 {
>  	interrupts-extended = <&tlmm 104 IRQ_TYPE_LEVEL_LOW>;
>  };
>  
> +&pm8921_gpio {
> +	prox_sensor_int: prox-sensor-int-state {
> +		pins = "gpio6";
> +		function = "normal";
> +		input-enable;
> +		bias-disable;
> +	};
> +};
> +
>  &rpm {
>  	regulators {
>  		compatible = "qcom,rpm-pm8921-regulators";
> @@ -280,6 +314,7 @@ pm8921_l9: l9 {
>  			regulator-min-microvolt = <2850000>;
>  			regulator-max-microvolt = <2850000>;
>  			bias-pull-down;
> +			regulator-always-on;
>  		};
>  
>  		pm8921_l10: l10 {
> @@ -377,6 +412,7 @@ pm8921_lvs3: lvs3 {
>  
>  		pm8921_lvs4: lvs4 {
>  			bias-pull-down;
> +			regulator-always-on;

Does it stop working if you remove these regulator-always-on additions?

Konrad
Re: [PATCH 1/4] ARM: dts: qcom: msm8960: expressatt: Add Light/Proximity Sensor
Posted by Rudraksha Gupta 1 week, 3 days ago
>> +
>> +	i2c-gpio-sensors {
>> +		compatible = "i2c-gpio";
>
> Are you using gpio-i2c for any specific reason? Would GSBI2 not be
> connected to this pair? (I am not sure FWIW)

This is interesting! Downstream uses i2c-gpio and I (well, Claude) used 
that. Seems like downstream doesn't define a GSBI2, so I guessed it's 
structure in the dts and it seems to work! Thanks for the suggestion.


No GSBI2: 
https://codeberg.org/LogicalErzor/Android_Kernel_Samsung_D2/src/branch/cm-14.1/arch/arm/mach-msm/board-express-gpiomux.c#L411


>> +			amstaos,proximity-diodes = <0>;
> Try comparing the values the upstream and downstream drivers write
> to the device, maybe you're missing something
Yeah, I'll continue to try and do that. In the meantime I'll send a v2 
so I can get further comments.