Skip to contentSkip to conversation

Pinctrl cleanup for MSM8916, add sensors for samsung-a2015

PATCH New Stephan Gerhold 1 participant 5 messages Jun 22, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Pinctrl cleanup for MSM8916, add sensors for samsung-a2015

This patch sets prepares for adding the accelerometer/magnetometer used in msm8916-samsung-a2015 by:

1. Cleaning up existing pinctrl configurations
(Bjorn recently suggested using a simpler form)
2. Restoring the minimal drive strength for the I2C pins by default (The higher drive strength is only set for apq8016-sbc)

And finally the accelerometer/magnetometer is added to the msm8916-samsung-a2015 device tree.

Stephan Gerhold (4):
arm64: dts: msm8916-samsung/longcheer: Move pinctrl/regulators to end
of file
arm64: dts: qcom: msm8916: Simplify pinctrl configuration
arm64: dts: qcom: msm8916: Use higher I2C drive-strength only on

    DB410c

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

 arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi     | 187 ++--
 .../boot/dts/qcom/msm8916-longcheer-l8150.dts |  42 +-
 arch/arm64/boot/dts/qcom/msm8916-pins.dtsi    | 861 +++++++-----------
 .../qcom/msm8916-samsung-a2015-common.dtsi    | 150 +--
 .../boot/dts/qcom/msm8916-samsung-a3u-eur.dts |  20 +-
 .../boot/dts/qcom/msm8916-samsung-a5u-eur.dts |  20 +-
 6 files changed, 508 insertions(+), 772 deletions(-)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/4 arm64: dts: msm8916-samsung/longcheer: Move pinctrl/regulators to end of file

It is helpful to be able to see all hardware components in one part of the device tree, without having to scroll over the large amount of regulator/pinctrl nodes. Keep those separated at the end of the file to make navigation a bit easier.

This also makes it consistent with the order used in apq8016-sbc.dtsi.

---
 .../boot/dts/qcom/msm8916-longcheer-l8150.dts |  50 +++---
 .../qcom/msm8916-samsung-a2015-common.dtsi    | 158 +++++++++---------
 2 files changed, 104 insertions(+), 104 deletions(-)
arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts +25 -25
index d5230cb76eb1..ed105e06c3fc 100644
@@ -108,31 +108,6 @@ volume-up {
 	};
 };
 
-&msmgpio {
-	gpio_keys_default: gpio-keys-default {
-		pinmux {
-			function = "gpio";
-			pins = "gpio107";
-		};
-		pinconf {
-			pins = "gpio107";
-			drive-strength = <2>;
-			bias-pull-up;
-		};
-	};
-
-	usb_vbus_default: usb-vbus-default {
-		pinmux {
-			function = "gpio";
-			pins = "gpio62";
-		};
-		pinconf {
-			pins = "gpio62";
-			bias-pull-up;
-		};
-	};
-};
-
 &spmi_bus {
 	pm8916@0 {
 		pon@800 {
@@ -258,3 +233,28 @@ l18 {
 		regulator-max-microvolt = <2700000>;
 	};
 };
+
+&msmgpio {
+	gpio_keys_default: gpio-keys-default {
+		pinmux {
+			function = "gpio";
+			pins = "gpio107";
+		};
+		pinconf {
+			pins = "gpio107";
+			drive-strength = <2>;
+			bias-pull-up;
+		};
+	};
+
+	usb_vbus_default: usb-vbus-default {
+		pinmux {
+			function = "gpio";
+			pins = "gpio62";
+		};
+		pinconf {
+			pins = "gpio62";
+			bias-pull-up;
+		};
+	};
+};
arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi +79 -79

171 lines not on this page · raw message

Signature · 1 line
2.27.0
#2 lore raw

PATCH 2/4 arm64: dts: qcom: msm8916: Simplify pinctrl configuration

In reply to Stephan Gerhold

So far we have been separating pinctrl entries into pinmux/pinconf. It turns out it is also possible to combine them: The advantage is that the device tree is overall more concise because the "pins" to configure just need to be specified once, not separately for pinmux/pinconf.

Using the simpler form only for new entries would be rather confusing. This commit makes all MSM8916 device trees use the simplfied form.

---
Bjorn suggested using this form here:
https://lore.kernel.org/linux-arm-msm/[email protected]/

---
 arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi     | 171 ++--
 .../boot/dts/qcom/msm8916-longcheer-l8150.dts |  26 +-
 arch/arm64/boot/dts/qcom/msm8916-pins.dtsi    | 861 +++++++-----------
 .../qcom/msm8916-samsung-a2015-common.dtsi    |  85 +-
 .../boot/dts/qcom/msm8916-samsung-a3u-eur.dts |  14 +-
 .../boot/dts/qcom/msm8916-samsung-a5u-eur.dts |  14 +-
 6 files changed, 426 insertions(+), 745 deletions(-)
arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi +69 -102
index 364014c96632..6fff96a158e9 100644
@@ -781,133 +781,102 @@ l18 {
 
 &msmgpio {
 	msmgpio_leds: msmgpio-leds {
-		pinconf {
-			pins = "gpio21", "gpio120";
-			function = "gpio";
-			output-low;
-		};
+		pins = "gpio21", "gpio120";
+		function = "gpio";
+
+		output-low;
 	};
 
 	usb_id_default: usb-id-default {
-		pinmux {
-			function = "gpio";
-			pins = "gpio121";
-		};
+		pins = "gpio121";
+		function = "gpio";
 
-		pinconf {
-			pins = "gpio121";
-			drive-strength = <8>;
-			input-enable;
-			bias-pull-up;
-		};
+		drive-strength = <8>;
+		input-enable;
+		bias-pull-up;
 	};
 
 	adv7533_int_active: adv533-int-active {
-		pinmux {
-			function = "gpio";
-			pins = "gpio31";
-		};
-		pinconf {
-			pins = "gpio31";
-			drive-strength = <16>;
-			bias-disable;
-		};
+		pins = "gpio31";
+		function = "gpio";
+
+		drive-strength = <16>;
+		bias-disable;
 	};
 
 	adv7533_int_suspend: adv7533-int-suspend {
-		pinmux {
-			function = "gpio";
-			pins = "gpio31";
-		};
-		pinconf {
-			pins = "gpio31";
-			drive-strength = <2>;
-			bias-disable;
-		};
+		pins = "gpio31";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
 	};
 
 	adv7533_switch_active: adv7533-switch-active {
-		pinmux {
-			function = "gpio";
-			pins = "gpio32";
-		};
-		pinconf {
-			pins = "gpio32";
-			drive-strength = <16>;
-			bias-disable;
-		};
+		pins = "gpio32";
+		function = "gpio";
+
+		drive-strength = <16>;
+		bias-disable;
 	};
 
 	adv7533_switch_suspend: adv7533-switch-suspend {
-		pinmux {
-			function = "gpio";
-			pins = "gpio32";
-		};
-		pinconf {
-			pins = "gpio32";
-			drive-strength = <2>;
-			bias-disable;
-		};
+		pins = "gpio32";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
 	};
 
 	msm_key_volp_n_default: msm-key-volp-n-default {
-		pinmux {
-			function = "gpio";
-			pins = "gpio107";
-		};
-		pinconf {
-			pins = "gpio107";
-			drive-strength = <8>;
-			input-enable;
-			bias-pull-up;
-		};
+		pins = "gpio107";
+		function = "gpio";
+
+		drive-strength = <8>;
+		input-enable;
+		bias-pull-up;
 	};
 };
 
 &pm8916_gpios {
 	usb_hub_reset_pm: usb-hub-reset-pm {
-		pinconf {
-			pins = "gpio3";
-			function = PMIC_GPIO_FUNC_NORMAL;
-			input-disable;
-			output-high;
-		};
+		pins = "gpio3";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		input-disable;
+		output-high;
 	};
 
 	usb_hub_reset_pm_device: usb-hub-reset-pm-device {
-		pinconf {
-			pins = "gpio3";
-			function = PMIC_GPIO_FUNC_NORMAL;
-			output-low;
-		};
+		pins = "gpio3";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		output-low;
 	};
 
 	usb_sw_sel_pm: usb-sw-sel-pm {
-		pinconf {
-			pins = "gpio4";
-			function = PMIC_GPIO_FUNC_NORMAL;
-			power-source = <PM8916_GPIO_VPH>;
-			input-disable;
-			output-high;
-		};
+		pins = "gpio4";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		power-source = <PM8916_GPIO_VPH>;
+		input-disable;
+		output-high;
 	};
 
 	usb_sw_sel_pm_device: usb-sw-sel-pm-device {
-		pinconf {
-			pins = "gpio4";
-			function = PMIC_GPIO_FUNC_NORMAL;
-			power-source = <PM8916_GPIO_VPH>;
-			input-disable;
-			output-low;
-		};
+		pins = "gpio4";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		power-source = <PM8916_GPIO_VPH>;
+		input-disable;
+		output-low;
 	};
 
 	pm8916_gpios_leds: pm8916-gpios-leds {
-		pinconf {
-			pins = "gpio1", "gpio2";
-			function = PMIC_GPIO_FUNC_NORMAL;
-			output-low;
-		};
+		pins = "gpio1", "gpio2";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		output-low;
 	};
 };
 
@@ -916,19 +885,17 @@ &pm8916_mpps {
 	pinctrl-0 = <&ls_exp_gpio_f>;
 
 	ls_exp_gpio_f: pm8916-mpp4 {
-		pinconf {
-			pins = "mpp4";
-			function = "digital";
-			output-low;
-			power-source = <PM8916_MPP_L5>;	// 1.8V
-		};
+		pins = "mpp4";
+		function = "digital";
+
+		output-low;
+		power-source = <PM8916_MPP_L5>;	// 1.8V
 	};
 
 	pm8916_mpps_leds: pm8916-mpps-leds {
-		pinconf {
-			pins = "mpp2", "mpp3";
-			function = "digital";
-			output-low;
-		};
+		pins = "mpp2", "mpp3";
+		function = "digital";
+
+		output-low;
 	};
 };
arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts +9 -17
index ed105e06c3fc..9f2c8e94fd26 100644
@@ -236,25 +236,17 @@ l18 {
 
 &msmgpio {
 	gpio_keys_default: gpio-keys-default {
-		pinmux {
-			function = "gpio";
-			pins = "gpio107";
-		};
-		pinconf {
-			pins = "gpio107";
-			drive-strength = <2>;
-			bias-pull-up;
-		};
+		pins = "gpio107";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-pull-up;
 	};
 
 	usb_vbus_default: usb-vbus-default {
-		pinmux {
-			function = "gpio";
-			pins = "gpio62";
-		};
-		pinconf {
-			pins = "gpio62";
-			bias-pull-up;
-		};
+		pins = "gpio62";
+		function = "gpio";
+
+		bias-pull-up;
 	};
 };
arch/arm64/boot/dts/qcom/msm8916-pins.dtsi +308 -553

1,101 lines not on this page · raw message

arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi +30 -55

106 lines not on this page · raw message

arch/arm64/boot/dts/qcom/msm8916-samsung-a3u-eur.dts +5 -9
index b46c87289033..33160a3687ce 100644
@@ -51,14 +51,10 @@ dsi0_out: endpoint {
 
 &msmgpio {
 	panel_vdd3_default: panel-vdd3-default {
-		pinmux {
-			function = "gpio";
-			pins = "gpio9";
-		};
-		pinconf {
-			pins = "gpio9";
-			drive-strength = <2>;
-			bias-disable;
-		};
+		pins = "gpio9";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
 	};
 };
arch/arm64/boot/dts/qcom/msm8916-samsung-a5u-eur.dts +5 -9
index a555db8f6b34..e4b6fa18ca25 100644
@@ -38,14 +38,10 @@ iris {
 
 &msmgpio {
 	ts_int_default: ts-int-default {
-		pinmux {
-			function = "gpio";
-			pins = "gpio13";
-		};
-		pinconf {
-			pins = "gpio13";
-			drive-strength = <2>;
-			bias-disable;
-		};
+		pins = "gpio13";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
 	};
 };
Signature · 1 line
2.27.0
#3 lore raw

PATCH 3/4 arm64: dts: qcom: msm8916: Use higher I2C drive-strength only on DB410c

In reply to Stephan Gerhold

Commit c240f29e75e6 ("arm64: dts: set the default i2c pin drive strength to 16mA") changed the default drive-strength for I2C pins in msm8916-pins.dtsi to the maximum possible (16 mA).

While this makes sense for apq8016-sbc (DB410c) where you can connect an arbitrary amount of I2C devices with level shifters etc, there is no need to use a higher drive strength for other MSM8916 devices. The minimum drive strength (2 mA) seems to be totally sufficient to have everything work there.

With the short pinctrl nodes introduced earlier we can easily override the drive-strength only for apq8016-sbc now. Use that and change the default back to 2 mA.

i2c1_default/i2c5_default are already using 2 mA because they were added separately later and are not used in apq8016-sbc.

Cc Srinivas Kandagatla <[email protected]>
---
 arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi  | 16 ++++++++++++++++
 arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |  6 +++---
 2 files changed, 19 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi +16 -0
index 6fff96a158e9..194343510dcb 100644
@@ -779,6 +779,22 @@ l18 {
 	};
 };
 
+/*
+ * 2mA drive strength is not enough when connecting multiple
+ * I2C devices with different pull up resistors.
+ */
+&i2c2_default {
+	drive-strength = <16>;
+};
+
+&i2c4_default {
+	drive-strength = <16>;
+};
+
+&i2c6_default {
+	drive-strength = <16>;
+};
+
 &msmgpio {
 	msmgpio_leds: msmgpio-leds {
 		pins = "gpio21", "gpio120";
arch/arm64/boot/dts/qcom/msm8916-pins.dtsi +3 -3
index e1d4f8df7e79..4dc437f13fa5 100644
@@ -208,7 +208,7 @@ i2c2_default: i2c2-default {
 		pins = "gpio6", "gpio7";
 		function = "blsp_i2c2";
 
-		drive-strength = <16>;
+		drive-strength = <2>;
 		bias-disable;
 	};
 
@@ -224,7 +224,7 @@ i2c4_default: i2c4-default {
 		pins = "gpio14", "gpio15";
 		function = "blsp_i2c4";
 
-		drive-strength = <16>;
+		drive-strength = <2>;
 		bias-disable;
 	};
 
@@ -256,7 +256,7 @@ i2c6_default: i2c6-default {
 		pins = "gpio22", "gpio23";
 		function = "blsp_i2c6";
 
-		drive-strength = <16>;
+		drive-strength = <2>;
 		bias-disable;
 	};
 
Signature · 1 line
2.27.0
#4 lore raw

PATCH 4/4 arm64: dts: qcom: msm8916-samsung-a2015: Add accelerometer/magnetometer

In reply to Stephan Gerhold

A3U/A5U both 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.

The only difference between A3U/A5U is the way the sensor is mounted on the mainboard - set the mount-matrix in the device-specific device tree part to handle that difference.

---
 .../qcom/msm8916-samsung-a2015-common.dtsi    | 27 +++++++++++++++++++
 .../boot/dts/qcom/msm8916-samsung-a3u-eur.dts |  6 +++++
 .../boot/dts/qcom/msm8916-samsung-a5u-eur.dts |  6 +++++
 3 files changed, 39 insertions(+)
arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi +27 -0
index 58485d055241..a0c00d9d62c4 100644
@@ -167,6 +167,25 @@ muic: sm5502@25 {
 	};
 };
 
+&blsp_i2c2 {
+	status = "okay";
+
+	accelerometer: accelerometer@10 {
+		compatible = "bosch,bmc150_accel";
+		reg = <0x10>;
+		interrupt-parent = <&msmgpio>;
+		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&accel_int_default>;
+	};
+
+	magnetometer@12 {
+		compatible = "bosch,bmc150_magn";
+		reg = <0x12>;
+	};
+};
+
 &spmi_bus {
 	pm8916@0 {
 		pon@800 {
@@ -294,6 +313,14 @@ l18 {
 };
 
 &msmgpio {
+	accel_int_default: accel-int-default {
+		pins = "gpio115";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	gpio_keys_default: gpio-keys-default {
 		pins = "gpio107", "gpio109";
 		function = "gpio";
arch/arm64/boot/dts/qcom/msm8916-samsung-a3u-eur.dts +6 -0
index 33160a3687ce..410c7d199f96 100644
@@ -22,6 +22,12 @@ reg_panel_vdd3: regulator-panel-vdd3 {
 	};
 };
 
+&accelerometer {
+	mount-matrix = "0", "1", "0",
+		       "1", "0", "0",
+		       "0", "0", "1";
+};
+
 &dsi0 {
 	panel@0 {
 		reg = <0>;
arch/arm64/boot/dts/qcom/msm8916-samsung-a5u-eur.dts +6 -0
index e4b6fa18ca25..e39c04d977c2 100644
@@ -9,6 +9,12 @@ / {
 	compatible = "samsung,a5u-eur", "qcom,msm8916";
 };
 
+&accelerometer {
+	mount-matrix = "-1", "0", "0",
+			"0", "1", "0",
+			"0", "0", "1";
+};
+
 &blsp_i2c5 {
 	status = "okay";
 
Signature · 1 line
2.27.0