[PATCH v1 3/4] arm64: dts: freescale: imx8mp-toradex-smarc: add gpio expander

Francesco Dolcini posted 4 patches 9 months, 2 weeks ago
There is a newer version of this series
[PATCH v1 3/4] arm64: dts: freescale: imx8mp-toradex-smarc: add gpio expander
Posted by Francesco Dolcini 9 months, 2 weeks ago
From: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

Add gpio expander node to the device tree and the related nodes.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
 .../dts/freescale/imx8mp-toradex-smarc.dtsi   | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi
index c4ca01ce60d0..de84e7e52efd 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi
@@ -54,6 +54,13 @@ smarc_key_sleep: key-sleep {
 			wakeup-source;
 			linux,code = <KEY_SLEEP>;
 		};
+
+		smarc_switch_lid: switch-lid {
+			gpios = <&som_ec_gpio_expander 2 GPIO_ACTIVE_LOW>;
+			label = "SMARC_LID#";
+			linux,code = <SW_LID>;
+			linux,input-type = <EV_SW>;
+		};
 	};
 
 	reg_usb0_vbus: regulator-usb0-vbus {
@@ -539,6 +546,24 @@ embedded-controller@28 {
 		reg = <0x28>;
 	};
 
+	som_ec_gpio_expander: gpio-expander@29 {
+		compatible = "toradex,ecgpiol16", "nxp,pcal6416";
+		reg = <0x29>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_mcu_int>;
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		interrupt-parent = <&gpio3>;
+		interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-line-names =
+			"SMARC_CHARGER_PRSNT#",
+			"SMARC_CHARGING#",
+			"SMARC_LID#",
+			"SMARC_BATLOW#";
+	};
+
 	rtc_i2c: rtc@32 {
 		compatible = "epson,rx8130";
 		reg = <0x32>;
-- 
2.39.5
Re: [PATCH v1 3/4] arm64: dts: freescale: imx8mp-toradex-smarc: add gpio expander
Posted by Peng Fan 9 months, 2 weeks ago
On Tue, Apr 29, 2025 at 01:31:18PM +0200, Francesco Dolcini wrote:
>From: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
>
>Add gpio expander node to the device tree and the related nodes.
>
>Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
>Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
>---
> .../dts/freescale/imx8mp-toradex-smarc.dtsi   | 25 +++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
>diff --git a/arch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi
>index c4ca01ce60d0..de84e7e52efd 100644
>--- a/arch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi
>+++ b/arch/arm64/boot/dts/freescale/imx8mp-toradex-smarc.dtsi
>@@ -54,6 +54,13 @@ smarc_key_sleep: key-sleep {
> 			wakeup-source;
> 			linux,code = <KEY_SLEEP>;
> 		};
>+
>+		smarc_switch_lid: switch-lid {
>+			gpios = <&som_ec_gpio_expander 2 GPIO_ACTIVE_LOW>;
>+			label = "SMARC_LID#";
>+			linux,code = <SW_LID>;
>+			linux,input-type = <EV_SW>;
>+		};
> 	};
> 
> 	reg_usb0_vbus: regulator-usb0-vbus {
>@@ -539,6 +546,24 @@ embedded-controller@28 {
> 		reg = <0x28>;
> 	};
> 
>+	som_ec_gpio_expander: gpio-expander@29 {

Use "gpio@29" ?

Regards,
Peng