diff mbox series

arm64: dts: qcom: msm8916-samsung-j5-common: Add accelerometer

Message ID 20230904123123.2593-1-linmengbo0689@protonmail.com
State New
Headers show
Series arm64: dts: qcom: msm8916-samsung-j5-common: Add accelerometer | expand

Commit Message

Lin, Meng-Bo Sept. 4, 2023, 12:35 p.m. UTC
From: Markuss Broks <markuss.broks@gmail.com>

J5 and J5X have ST LIS2HH12 accelerometer.
Add support for it.

Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
Co-developed-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Co-developed-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
---
 .../dts/qcom/msm8916-samsung-j5-common.dtsi   | 39 +++++++++++++++++++
 .../boot/dts/qcom/msm8916-samsung-j5.dts      |  5 +++
 .../boot/dts/qcom/msm8916-samsung-j5x.dts     | 15 +++++++
 3 files changed, 59 insertions(+)

Comments

Konrad Dybcio Sept. 9, 2023, 11:43 a.m. UTC | #1
On 4.09.2023 14:35, Lin, Meng-Bo wrote:
> From: Markuss Broks <markuss.broks@gmail.com>
> 
> J5 and J5X have ST LIS2HH12 accelerometer.
> Add support for it.
> 
> Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
> Co-developed-by: Stephan Gerhold <stephan@gerhold.net>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> Co-developed-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
> Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
> ---
We've concluded off-list that i2c-gpio is used because Samsung
routed the sensor to pins which are not associated with QUPs.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
Bjorn Andersson Sept. 20, 2023, 3:58 a.m. UTC | #2
On Mon, 04 Sep 2023 12:35:03 +0000, Lin, Meng-Bo wrote:
> J5 and J5X have ST LIS2HH12 accelerometer.
> Add support for it.
> 
> 

Applied, thanks!

[1/1] arm64: dts: qcom: msm8916-samsung-j5-common: Add accelerometer
      commit: 922c031eb2b4897cc01f4159f7325a2dcd8d6c7e

Best regards,
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
index cb0e4a7faf91..68e22873647f 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
@@ -84,6 +84,31 @@  muic: extcon@25 {
 			pinctrl-0 = <&muic_int_default>;
 		};
 	};
+
+	i2c_sensors: i2c-sensors {
+		compatible = "i2c-gpio";
+
+		sda-gpios = <&tlmm 31 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+		scl-gpios = <&tlmm 32 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+
+		pinctrl-0 = <&sensors_i2c_default>;
+		pinctrl-names = "default";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		accelerometer: accelerometer@1d {
+			compatible = "st,lis2hh12";
+			reg = <0x1d>;
+
+			interrupts-extended = <&tlmm 115 IRQ_TYPE_LEVEL_HIGH>;
+
+			pinctrl-0 = <&accel_int_default>;
+			pinctrl-names = "default";
+
+			st,drdy-int-pin = <1>;
+		};
+	};
 };
 
 &blsp_i2c5 {
@@ -147,6 +172,13 @@  &wcnss_iris {
 };
 
 &tlmm {
+	accel_int_default: accel-int-default-state {
+		pins = "gpio115";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
 		pins = "gpio52";
 		function = "gpio";
@@ -187,6 +219,13 @@  sdc2_cd_default: sdc2-cd-default-state {
 		bias-disable;
 	};
 
+	sensors_i2c_default: sensors-i2c-default-state {
+		pins = "gpio31", "gpio32";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	tsp_int_default: tsp-int-default-state {
 		pins = "gpio13";
 		function = "gpio";
diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5.dts
index 3e1ff5b4d2d7..58c2f5a70e78 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5.dts
@@ -10,6 +10,11 @@  / {
 	chassis-type = "handset";
 };
 
+&accelerometer {
+	vdd-supply = <&pm8916_l5>;
+	vddio-supply = <&pm8916_l5>;
+};
+
 &blsp_i2c5 {
 	status = "disabled";
 };
diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5x.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5x.dts
index b2fe109723d8..8b404a9cd62d 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5x.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5x.dts
@@ -23,6 +23,17 @@  reg_vdd_tsp_a: regulator-vdd-tsp-a {
 	};
 };
 
+&accelerometer {
+	interrupts-extended = <&tlmm 49 IRQ_TYPE_LEVEL_HIGH>;
+
+	vdd-supply = <&pm8916_l6>;
+	vddio-supply = <&pm8916_l6>;
+
+	mount-matrix = "0", "-1", "0",
+		       "1", "0", "0",
+		       "0", "0", "-1";
+};
+
 &muic {
 	interrupts = <121 IRQ_TYPE_EDGE_FALLING>;
 };
@@ -40,6 +51,10 @@  tsp_ldo_en_default: tsp-ldo-en-default-state {
 	};
 };
 
+&accel_int_default {
+	pins = "gpio49";
+};
+
 &muic_int_default {
 	pins = "gpio121";
 };