From a3fca0f5ebf4d1bb928b4bcde0b92d85137a0f43 Mon Sep 17 00:00:00 2001
From: NXF77484 <juliopablo.meza@nxp.com>
Date: Mon, 17 Jan 2022 14:54:12 -0700
Subject: [PATCH] Enable RGB LED's and push buttons on 8MIC-RPI-MX8 board

---
 .../dts/freescale/imx8mm-evk-8mic-revE.dts    | 124 +++++++++++++++++-
 1 file changed, 120 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk-8mic-revE.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk-8mic-revE.dts
index ec4108c4c217..a1f2d5de0608 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-evk-8mic-revE.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mm-evk-8mic-revE.dts
@@ -52,29 +52,38 @@ mic7 {
 
 	sw_keys {
 		compatible = "gpio-keys";
+                pinctrl-names = "default";
 
 		sw4: volume_down {
 			label = "Volume Down";
-			gpios = <&pca9555 14 GPIO_ACTIVE_LOW>;
+			gpios = <&pca9555 15 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_VOLUMEDOWN>;
+                        interrupt-parent = <&pca9555>;
+                        interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
 		};
 
 		sw3: volume_up {
 			label = "Volume Up";
-			gpios = <&pca9555 15 GPIO_ACTIVE_LOW>;
+			gpios = <&pca9555 14 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_VOLUMEUP>;
+                        interrupt-parent = <&pca9555>;
+                        interrupts = <14 IRQ_TYPE_LEVEL_LOW>;
 		};
 
 		sw2: volume_mute {
 			label = "Volume Mute";
-			gpios = <&pca9555 16 GPIO_ACTIVE_LOW>;
+			gpios = <&pca9555 13 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_MUTE>;
+                        interrupt-parent = <&pca9555>;
+                        interrupts = <13 IRQ_TYPE_LEVEL_LOW>;
 		};
 
 		sw1: key_act {
 			label = "Key Act";
-			gpios = <&pca9555 17 GPIO_ACTIVE_LOW>;
+			gpios = <&pca9555 12 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_F9>;
+                        interrupt-parent = <&pca9555>;
+                        interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
 		};
 	};
 
@@ -108,11 +117,118 @@ pca9555: gpio@21 {
 		reg = <0x21>;
 		gpio-controller;
 		#gpio-cells = <2>;
+                interrupt-controller;
+                #interrupt-cells = <2>;
 		interrupt-parent = <&gpio5>;
 		interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
 		vcc-supply = <&reg_vddext_3v3>;
 		status = "okay";
 	};
+
+        /* PCA9955 - 16-bit RGB LED */
+        pca9955: pca9955@7 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                compatible = "nxp,pca9955";
+                reg = <0x07>;
+                led0 {
+                        label = "green0";
+                        linux,default-trigger = "none";
+                        reg = <0>;
+                };
+
+                led1 {
+                        label = "blue0";
+                        linux,default-trigger = "none";
+                        reg = <1>;
+                };
+
+                led2 {
+                        label = "red0";
+                        linux,default-trigger = "none";
+                        reg = <2>;
+                };
+
+                led3 {
+                        label = "green1";
+                        linux,default-trigger = "none";
+                        reg = <3>;
+                };
+
+                led4 {
+                        label = "blue1";
+                        linux,default-trigger = "none";
+                        reg = <4>;
+                };
+
+                led5 {
+                        label = "red1";
+                        linux,default-trigger = "none";
+                        reg = <5>;
+                };
+
+                led6 {
+                        label = "green2";
+                        linux,default-trigger = "none";
+                        reg = <6>;
+                };
+
+                led7 {
+                        label = "blue2";
+                        linux,default-trigger = "none";
+                        reg = <7>;
+                };
+
+                led8 {
+                        label = "red2";
+                        linux,default-trigger = "none";
+                        reg = <8>;
+                };
+
+                led9 {
+                        label = "green3";
+                        linux,default-trigger = "none";
+                        reg = <9>;
+                };
+
+                led10 {
+                        label = "blue3";
+                        linux,default-trigger = "none";
+                        reg = <10>;
+                };
+
+                led11 {
+                        label = "red3";
+                        linux,default-trigger = "none";
+                        reg = <11>;
+                };
+
+                led12 {
+                        label = "green4";
+                        linux,default-trigger = "none";
+                        reg = <12>;
+                };
+
+                led13 {
+                        label = "blue4";
+                        linux,default-trigger = "none";
+                        reg = <13>;
+                };
+
+                led14 {
+                        label = "red4";
+                        linux,default-trigger = "none";
+                        reg = <14>;
+                };
+
+                led15 {
+                        label = "blue5";
+                        linux,default-trigger = "none";
+                        reg = <15>;
+                };
+       }; 
+
+
 };
 
 &uart3 {
-- 
2.25.1

