Skip to contentSkip to conversation

arm64: dts: qcom: msm8916-samsung-fortuna: Add accelerometer/magnetometer

PATCH Superseded Raymond Hackley 2 participants 5 messages Apr 5, 2024 – Apr 9, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover arm64: dts: qcom: msm8916-samsung-fortuna: Add accelerometer/magnetometer

Some Grand Prime use a Bosch BMC150 accelerometer/magnetometer combo. The chip provides two separate I2C devices for the accelerometer and magnetometer that are already supported by the bmc150-accel and bmc150-magn driver.
Some Grand Prime use a ST LSM303C accelerometer/magnetometer combo. Core Prime LTE uses ST LIS2HH12 accelerometer.

Add support for them.

#1 lore raw

PATCH 1/3 arm64: dts: qcom: msm8916-samsung-fortuna: Add BMC150 accelerometer/magnetometer

From: Joe Mason <[email protected]>

Some Grand Prime use a Bosch BMC150 accelerometer/magnetometer combo. The chip provides two separate I2C devices for the accelerometer and magnetometer that are already supported by the bmc150-accel and bmc150-magn driver.

[Stephan: Move sensors to common dtsi, disabled by default]
[Raymond: Add it to grandprimelte. Use interrupts-extended]
---
 .../qcom/msm8916-samsung-fortuna-common.dtsi  | 44 +++++++++++++++++++
 .../dts/qcom/msm8916-samsung-gprimeltecan.dts |  8 ++++
 .../qcom/msm8916-samsung-grandprimelte.dts    |  8 ++++
 3 files changed, 60 insertions(+)
arch/arm64/boot/dts/qcom/msm8916-samsung-fortuna-common.dtsi +44 -0
index 5e933fb8b363..b6e1fe8b0056 100644
@@ -117,6 +117,43 @@ muic: extcon@25 {
 	};
 };
 
+&blsp_i2c2 {
+	/* Available sensors vary depending on model variant */
+	status = "okay";
+
+	bosch_accel: accelerometer@10 {
+		compatible = "bosch,bmc150_accel";
+		reg = <0x10>;
+		interrupts-extended = <&tlmm 115 IRQ_TYPE_EDGE_RISING>;
+
+		vdd-supply = <&pm8916_l5>;
+		vddio-supply = <&pm8916_l5>;
+
+		pinctrl-0 = <&accel_int_default>;
+		pinctrl-names = "default";
+
+		mount-matrix = "0", "-1", "0",
+			      "-1",  "0", "0",
+			       "0",  "0", "1";
+
+		status = "disabled";
+	};
+
+	bosch_magn: magnetometer@12 {
+		compatible = "bosch,bmc150_magn";
+		reg = <0x12>;
+
+		vdd-supply = <&pm8916_l5>;
+		vddio-supply = <&pm8916_l5>;
+
+		mount-matrix = "0", "-1", "0",
+			      "-1",  "0", "0",
+			       "0",  "0", "1";
+
+		status = "disabled";
+	};
+};
+
 &blsp_i2c4 {
 	status = "okay";
 
@@ -223,6 +260,13 @@ &wcnss_mem {
 };
 
 &tlmm {
+	accel_int_default: accel-int-default-state {
+		pins = "gpio115";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	backlight_en_default: backlight-en-default-state {
 		pins = "gpio98";
 		function = "gpio";
arch/arm64/boot/dts/qcom/msm8916-samsung-gprimeltecan.dts +8 -0
index 9d65fa58ba92..4dc74e8bf1d8 100644
@@ -21,6 +21,14 @@ tz-apps@85500000 {
 	};
 };
 
+&bosch_accel {
+	status = "okay";
+};
+
+&bosch_magn {
+	status = "okay";
+};
+
 &mpss_mem {
 	/* Firmware for gprimeltecan needs more space */
 	reg = <0x0 0x86800000 0x0 0x5400000>;
arch/arm64/boot/dts/qcom/msm8916-samsung-grandprimelte.dts +8 -0
index a66ce4b13547..cffad734c4df 100644
@@ -10,6 +10,14 @@ / {
 	chassis-type = "handset";
 };
 
+&bosch_accel {
+	status = "okay";
+};
+
+&bosch_magn {
+	status = "okay";
+};
+
 &mpss_mem {
 	/* Firmware for grandprimelte needs more space */
 	reg = <0x0 0x86800000 0x0 0x5400000>;
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/3 arm64: dts: qcom: msm8916-samsung-fortuna: Add LSM303C accelerometer/magnetometer

In reply to Raymond Hackley

From: Siddharth Manthan <[email protected]>

Some Grand Prime use a ST LSM303C accelerometer/magnetometer combo. Add support for it.

[Stephan: Move sensors to common dtsi (disabled by default)]
[Raymond: Use interrupts-extended]
---
 .../dts/qcom/msm8216-samsung-fortuna3g.dts    |  8 +++++
 .../qcom/msm8916-samsung-fortuna-common.dtsi  | 34 +++++++++++++++++++
 2 files changed, 42 insertions(+)
arch/arm64/boot/dts/qcom/msm8216-samsung-fortuna3g.dts +8 -0
index 366914be7d53..e7f6df229f9a 100644
@@ -9,3 +9,11 @@ / {
 	compatible = "samsung,fortuna3g", "qcom,msm8916";
 	chassis-type = "handset";
 };
+
+&st_accel {
+	status = "okay";
+};
+
+&st_magn {
+	status = "okay";
+};
arch/arm64/boot/dts/qcom/msm8916-samsung-fortuna-common.dtsi +34 -0
index b6e1fe8b0056..1c3e3b860d44 100644
@@ -152,6 +152,40 @@ bosch_magn: magnetometer@12 {
 
 		status = "disabled";
 	};
+
+	st_accel: accelerometer@1d {
+		compatible = "st,lsm303c-accel";
+		reg = <0x1d>;
+		interrupts-extended = <&tlmm 115 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-names = "INT1";
+
+		vdd-supply = <&pm8916_l17>;
+		vddio-supply = <&pm8916_l5>;
+
+		pinctrl-0 = <&accel_int_default>;
+		pinctrl-names = "default";
+
+		st,drdy-int-pin = <1>;
+		mount-matrix = "0", "-1",  "0",
+			       "1",  "0",  "0",
+			       "0",  "0", "-1";
+
+		status = "disabled";
+	};
+
+	st_magn: magnetometer@1e {
+		compatible = "st,lsm303c-magn";
+		reg = <0x1e>;
+
+		vdd-supply = <&pm8916_l17>;
+		vddio-supply = <&pm8916_l5>;
+
+		mount-matrix = "0", "-1",  "0",
+			       "1",  "0",  "0",
+			       "0",  "0", "-1";
+
+		status = "disabled";
+	};
 };
 
 &blsp_i2c4 {
Signature · 1 line
2.39.2
#3 lore raw

PATCH 3/3 arm64: dts: qcom: msm8916-samsung-rossa: Add LIS2HH12 accelerometer

In reply to Raymond Hackley

Core Prime LTE uses ST LIS2HH12 accelerometer. Add support for it.

[Stephen: Use common &st_accel definition from common dtsi]
---
 .../arm64/boot/dts/qcom/msm8916-samsung-rossa-common.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/qcom/msm8916-samsung-rossa-common.dtsi +8 -0
index b438fa81886c..db95bdbb9f32 100644
@@ -26,3 +26,11 @@ &clk_pwm {
 &clk_pwm_backlight {
 	status = "disabled";
 };
+
+&st_accel {
+	compatible = "st,lis2hh12";
+	mount-matrix = "1",  "0", "0",
+		       "0", "-1", "0",
+		       "0",  "0", "1";
+	status = "okay";
+};
Signature · 1 line
2.39.2
maintainer
#4 lore raw
In reply to Raymond Hackley
Quoted 11 lines · Raymond Hackley

Some Grand Prime use a Bosch BMC150 accelerometer/magnetometer combo. The chip provides two separate I2C devices for the accelerometer and magnetometer that are already supported by the bmc150-accel and bmc150-magn driver.
Some Grand Prime use a ST LSM303C accelerometer/magnetometer combo. Core Prime LTE uses ST LIS2HH12 accelerometer.

Add support for them.

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y qcom/msm8216-samsung-fortuna3g.dtb' for [email protected]:

arch/arm64/boot/dts/qcom/msm8216-samsung-fortuna3g.dtb: magnetometer@12: 'mount-matrix' does not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/iio/magnetometer/bosch,bmc150_magn.yaml#
arch/arm64/boot/dts/qcom/msm8216-samsung-fortuna3g.dtb: accelerometer@1d: 'interrupt-names' does not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/iio/st,st-sensors.yaml#