From f02d1093380829a87e2391c2f0fe80f2802796e9 Mon Sep 17 00:00:00 2001
From: Dongjin Kim <tobetter@gmail.com>
Date: Fri, 29 Jan 2021 04:52:14 +0000
Subject: [PATCH 082/109] ODROID-N2/C4: arm64/dts: add device tree overlay for
 HKTFT35 LCD

Change-Id: Iee351b10593e8fc9e778f47b72482a44722c0dad
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
 .../dts/amlogic/overlays/odroidc4/Makefile    |  3 +-
 .../dts/amlogic/overlays/odroidc4/hktft35.dts | 53 +++++++++++++++++++
 .../dts/amlogic/overlays/odroidn2/Makefile    |  1 +
 .../dts/amlogic/overlays/odroidn2/hktft35.dts | 53 +++++++++++++++++++
 4 files changed, 109 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft35.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/overlays/odroidn2/hktft35.dts

diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
index fc1a76db000d..31b06704004e 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
@@ -1,5 +1,6 @@
 dtbo-y += \
-	spi0.dtbo
+	spi0.dtbo \
+	hktft35.dtbo
 
 targets += $(dtbo-y)
 always-y := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft35.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft35.dts
new file mode 100644
index 000000000000..0fb34f609c79
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/hktft35.dts
@@ -0,0 +1,53 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	fragment@0 {
+		target-path = "/";
+
+		__overlay__ {
+			backlight: backlight {
+				compatible = "gpio-backlight";
+				gpios = <&gpio GPIOX_6 GPIO_ACTIVE_HIGH>;
+			};
+
+			display: display {
+				#address-cells = <2>;
+				#size-cells = <1>;
+
+				status = "okay";
+				compatible = "hardkernel,ili9488";
+				reg = <0x0 0xff63445c 0x0 0x04>;
+
+				rotate = <270>;
+				backlight = <&backlight>;
+
+				db-bits-0 = <0x00000002>;
+				db-bits-1 = <0x00000004>;
+				db-bits-2 = <0x00000001>;
+				db-bits-3 = <0x00000800>;
+				db-bits-4 = <0x00000200>;
+				db-bits-5 = <0x00000100>;
+				db-bits-6 = <0x00000080>;
+				db-bits-7 = <0x00000010>;
+				db-bits-wr = <0x00000400>;
+
+				reset-gpios = <&gpio GPIOX_3 GPIO_ACTIVE_HIGH>;
+				dc-gpios = <&gpio GPIOX_14 GPIO_ACTIVE_HIGH>;
+				wr-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_HIGH>;
+				cs-gpios = <&gpio GPIOX_16 GPIO_ACTIVE_HIGH>;
+				db-gpios = <&gpio GPIOX_1 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_2 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_0 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_11 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_9 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_8 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_7 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_4 GPIO_ACTIVE_HIGH>;
+			};
+		};
+	};
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
index fc1a76db000d..64462609b8c7 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
@@ -1,4 +1,5 @@
 dtbo-y += \
+	hktft35.dtbo \
 	spi0.dtbo
 
 targets += $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hktft35.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hktft35.dts
new file mode 100644
index 000000000000..3dfc3c8e5eb2
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/hktft35.dts
@@ -0,0 +1,53 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	fragment@0 {
+		target-path = "/";
+
+		__overlay__ {
+			backlight: backlight {
+				compatible = "gpio-backlight";
+				gpios = <&gpio GPIOX_5 GPIO_ACTIVE_HIGH>;
+			};
+
+			display: display {
+				#address-cells = <2>;
+				#size-cells = <1>;
+
+				status = "okay";
+				compatible = "hardkernel,ili9488";
+				reg = <0x0 0xff63445c 0x0 0x04>;
+
+				rotate = <270>;
+				backlight = <&backlight>;
+
+				db-bits-0 = <0x00000002>;
+				db-bits-1 = <0x00000004>;
+				db-bits-2 = <0x00000001>;
+				db-bits-3 = <0x00000800>;
+				db-bits-4 = <0x00000200>;
+				db-bits-5 = <0x00000100>;
+				db-bits-6 = <0x00000080>;
+				db-bits-7 = <0x00000010>;
+				db-bits-wr = <0x00000400>;
+
+				reset-gpios = <&gpio GPIOX_3 GPIO_ACTIVE_HIGH>;
+				dc-gpios = <&gpio GPIOX_14 GPIO_ACTIVE_HIGH>;
+				wr-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_HIGH>;
+				cs-gpios = <&gpio GPIOX_16 GPIO_ACTIVE_HIGH>;
+				db-gpios = <&gpio GPIOX_1 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_2 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_0 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_11 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_9 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_8 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_7 GPIO_ACTIVE_HIGH>,
+					<&gpio GPIOX_4 GPIO_ACTIVE_HIGH>;
+			};
+		};
+	};
+};
-- 
2.25.1

