From 572548e1235cc21b5be242b267fdc66984d6d3f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Tue, 17 Nov 2020 01:06:30 +0100
Subject: arm64: dts: allwinner: a64: pinetab: add front camera

---
 .../boot/dts/allwinner/sun50i-a64-pinetab.dts | 50 ++++++++++++++++---
 1 file changed, 44 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts
index f5fb1ee32dad..50a0e1916743 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts
@@ -55,12 +55,35 @@ i2c-csi {
 		#address-cells = <1>;
 		#size-cells = <0>;
 
+		/* Front camera */
+		gc2145: front-camera@3c {
+			compatible = "galaxycore,gc2145";
+			reg = <0x3c>;
+			clocks = <&ccu CLK_CSI_MCLK>;
+			clock-names = "xclk";
+
+			AVDD-supply = <&reg_dldo3>;
+			DVDD-supply = <&reg_aldo1>;
+			IOVDD-supply = <&reg_eldo3>;
+			reset-gpios = <&pio 4 16 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; /* PE16 */
+			enable-gpios = <&pio 4 17 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; /* PE17 */
+
+			port {
+				gc2145_ep: endpoint {
+					remote-endpoint = <&csi_gc2145_ep>;
+					bus-width = <8>;
+					hsync-active = <1>;
+					vsync-active = <1>;
+					data-active = <1>;
+					pclk-sample = <1>;
+				};
+			};
+		};
+
 		/* Rear camera */
-		ov5640: camera@3c {
+		ov5640: rear-camera@4c {
 			compatible = "ovti,ov5640";
-			reg = <0x3c>;
-			pinctrl-names = "default";
-			pinctrl-0 = <&csi_mclk_pin>;
+			reg = <0x4c>;
 			clocks = <&ccu CLK_CSI_MCLK>;
 			clock-names = "xclk";
 
@@ -72,7 +95,7 @@ ov5640: camera@3c {
 
 			port {
 				ov5640_ep: endpoint {
-					remote-endpoint = <&csi_ep>;
+					remote-endpoint = <&csi_ov5640_ep>;
 					bus-width = <8>;
 					hsync-active = <1>; /* Active high */
 					vsync-active = <0>; /* Active low */
@@ -131,10 +154,15 @@ &cpu3 {
 };
 
 &csi {
+	pinctrl-0 = <&csi_pins>, <&csi_mclk_pin>;
 	status = "okay";
 
 	port {
-		csi_ep: endpoint {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		csi_ov5640_ep: endpoint@0 {
+			reg = <0>;
 			remote-endpoint = <&ov5640_ep>;
 			bus-width = <8>;
 			hsync-active = <1>; /* Active high */
@@ -142,6 +170,16 @@ csi_ep: endpoint {
 			data-active = <1>;  /* Active high */
 			pclk-sample = <1>;  /* Rising */
 		};
+
+		csi_gc2145_ep: endpoint@1 {
+			reg = <1>;
+			remote-endpoint = <&gc2145_ep>;
+			bus-width=<8>;
+			hsync-active = <1>; /* Active high */
+			vsync-active = <1>; /* Active high */
+			data-active = <1>;  /* Active high */
+			pclk-sample = <1>;  /* Rising */
+		};
 	};
 };
 
-- 
2.35.3

