2023-01-06 15:07:50

by Lin, Meng-Bo

[permalink] [raw]
Subject: [PATCH v6 0/5] arm64: dts: qcom: msm8916-samsung-j5: Use common device tree

v6: Rebase on linux-next and reword. Add MUIC. Drop WIP J3 device tree
v5: Fix address typo tz-apps@85a00000 in msm8916-samsung-j3.dts
v4: Try "git format-patch -B -C -M -D" to fix errors.
v3: Drop msm8916-samsung-j5.dts temporarily before moving it.
Minor rewords.
v2: Reword and resend. Split common dtsi patch.
Add missing suffix state in pinctrl.

The smartphones below are using the MSM8916 SoC,
which are released in 2015-2016:

Samsung Galaxy J5 2015 (SM-J500*)
Samsung Galaxy J5 2016 (SM-J510*)

Add a common device tree for with initial support for:

- GPIO keys
- GPIO Hall sensor
- SDHCI (internal and external storage)
- USB Device Mode
- UART (on USB connector via the SM5703 MUIC)
- WCNSS (WiFi/BT)
- Regulators

The two devices (all other variants of J5 released in 2015 and J5X
released in 2016) are very similar, with some differences in display and
GPIO pins. The common parts are shared in msm8916-samsung-j5-common.dtsi
to reduce duplication.


2023-01-06 15:08:16

by Lin, Meng-Bo

[permalink] [raw]
Subject: [PATCH v6 5/5] arm64: dts: qcom: msm8916-samsung-j5-common: Add MUIC support

From: Markuss Broks <[email protected]>

The MUIC installed is a part of SM5703 MFD, and it seems to work
the same as the SM5502 MUIC unit.

Signed-off-by: Markuss Broks <[email protected]>
[Apply for msm8916-samsung-j5x]
Signed-off-by: Lin, Meng-Bo <[email protected]>
---
.../dts/qcom/msm8916-samsung-j5-common.dtsi | 50 ++++++++++++++++---
.../boot/dts/qcom/msm8916-samsung-j5x.dts | 8 +++
2 files changed, 50 insertions(+), 8 deletions(-)

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 5755b360c6ed..f3b81b6f0a2f 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
@@ -3,6 +3,7 @@
#include "msm8916-pm8916.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>

/ {
aliases {
@@ -58,6 +59,29 @@ button-home {
linux,code = <KEY_HOMEPAGE>;
};
};
+
+ i2c_muic: i2c-muic {
+ compatible = "i2c-gpio";
+ sda-gpios = <&msmgpio 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+ scl-gpios = <&msmgpio 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&muic_i2c_default>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ muic: extcon@25 {
+ compatible = "siliconmitus,sm5703-muic";
+ reg = <0x25>;
+
+ interrupt-parent = <&msmgpio>;
+ interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&muic_int_default>;
+ };
+ };
};

&blsp1_uart2 {
@@ -69,11 +93,6 @@ &pm8916_resin {
linux,code = <KEY_VOLUMEDOWN>;
};

-/* FIXME: Replace with SM5703 MUIC when driver is available */
-&pm8916_usbin {
- status = "okay";
-};
-
&pronto {
status = "okay";
};
@@ -97,13 +116,12 @@ &sdhc_2 {
};

&usb {
+ extcon = <&muic>, <&muic>;
status = "okay";
- dr_mode = "peripheral";
- extcon = <&pm8916_usbin>;
};

&usb_hs_phy {
- extcon = <&pm8916_usbin>;
+ extcon = <&muic>;
};

&smd_rpm_regulators {
@@ -225,4 +243,20 @@ gpio_keys_default: gpio-keys-default-state {
drive-strength = <2>;
bias-pull-up;
};
+
+ muic_i2c_default: muic-i2c-default-state {
+ pins = "gpio105", "gpio106";
+ function = "gpio";
+
+ drive-strength = <2>;
+ bias-disable;
+ };
+
+ muic_int_default: muic-int-default-state {
+ pins = "gpio12";
+ function = "gpio";
+
+ drive-strength = <2>;
+ bias-disable;
+ };
};
diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5x.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5x.dts
index 7656ac4508cf..7e1326cc13c5 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5x.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5x.dts
@@ -9,3 +9,11 @@ / {
compatible = "samsung,j5x", "qcom,msm8916";
chassis-type = "handset";
};
+
+&muic {
+ interrupts = <121 IRQ_TYPE_EDGE_FALLING>;
+};
+
+&muic_int_default {
+ pins = "gpio121";
+};
--
2.30.2


2023-01-06 15:08:59

by Lin, Meng-Bo

[permalink] [raw]
Subject: [PATCH v6 4/5] arm64: dts: qcom: msm8916-samsung-j5-common: Add Hall sensor

Samsung Galaxy J5 2015 and 2016 have a Hall sensor on GPIO pin 52.
Add GPIO Hall sensor for them.

Signed-off-by: Lin, Meng-Bo <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
---
.../dts/qcom/msm8916-samsung-j5-common.dtsi | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)

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 502b38d4a61e..5755b360c6ed 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
@@ -2,6 +2,7 @@

#include "msm8916-pm8916.dtsi"
#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>

/ {
aliases {
@@ -20,6 +21,23 @@ tz-apps@85500000 {
};
};

+ gpio_hall_sensor: gpio-hall-sensor {
+ compatible = "gpio-keys";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&gpio_hall_sensor_default>;
+
+ label = "GPIO Hall Effect Sensor";
+
+ event-hall-sensor {
+ label = "Hall Effect Sensor";
+ gpios = <&msmgpio 52 GPIO_ACTIVE_LOW>;
+ linux,input-type = <EV_SW>;
+ linux,code = <SW_LID>;
+ linux,can-disable;
+ };
+ };
+
gpio-keys {
compatible = "gpio-keys";

@@ -192,6 +210,14 @@ l18 {
};

&msmgpio {
+ gpio_hall_sensor_default: gpio-hall-sensor-default-state {
+ pins = "gpio52";
+ function = "gpio";
+
+ drive-strength = <2>;
+ bias-disable;
+ };
+
gpio_keys_default: gpio-keys-default-state {
pins = "gpio107", "gpio109";
function = "gpio";
--
2.30.2


2023-01-18 23:59:59

by Bjorn Andersson

[permalink] [raw]
Subject: Re: (subset) [PATCH v6 0/5] arm64: dts: qcom: msm8916-samsung-j5: Use common device tree

On Fri, 06 Jan 2023 14:28:38 +0000, Lin, Meng-Bo wrote:
> v6: Rebase on linux-next and reword. Add MUIC. Drop WIP J3 device tree
> v5: Fix address typo tz-apps@85a00000 in msm8916-samsung-j3.dts
> v4: Try "git format-patch -B -C -M -D" to fix errors.
> v3: Drop msm8916-samsung-j5.dts temporarily before moving it.
> Minor rewords.
> v2: Reword and resend. Split common dtsi patch.
> Add missing suffix state in pinctrl.
>
> [...]

Applied, thanks!

[2/5] arm64: dts: qcom: msm8916-samsung-j5-common: Add initial common device tree
commit: 66e9ba516be3c165b1adf86ed2bd7e2ec4a3b578
[3/5] arm64: dts: qcom: msm8916-samsung-j5-common: Add new device trees
commit: 4414bdf9c56513f6f706bc936cb9e35126ac8773
[4/5] arm64: dts: qcom: msm8916-samsung-j5-common: Add Hall sensor
commit: 027523b77c0cecf4e4afbb7c587aaa10fd33b510
[5/5] arm64: dts: qcom: msm8916-samsung-j5-common: Add MUIC support
commit: 83a54e61b2bdfd81865bee12033b1d9d5af0016f

Best regards,
--
Bjorn Andersson <[email protected]>