build/patch/kernel/archive/sunxi-5.10/megous/arm64-dts-sun50i-a64-pinephone-Add-front-back-camera.patch

145 lines
3.6 KiB
Diff
Raw Normal View History

From e5b86a9c2e8ead243b2f1cb29457d95e97f7bcce Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Wed, 8 Apr 2020 14:13:08 +0200
Subject: [PATCH 100/351] arm64: dts: sun50i-a64-pinephone: Add front/back
cameras
Pinephone has OV5640 back camera and GC2145 front camera. Add support
for both.
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
.../dts/allwinner/sun50i-a64-pinephone.dtsi | 95 ++++++++++++++++++-
1 file changed, 94 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index 9a924c9475fe..520faec5abd1 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -28,6 +28,15 @@ chosen {
stdout-path = "serial0:115200n8";
};
+ i2c_csi: i2c-csi {
+ compatible = "i2c-gpio";
+ sda-gpios = <&pio 4 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; /* PE13 */
+ scl-gpios = <&pio 4 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; /* PE12 */
+ i2c-gpio,delay-us = <3>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+
leds {
compatible = "gpio-leds";
@@ -95,6 +104,36 @@ &cpu3 {
cpu-supply = <&reg_dcdc2>;
};
+&csi {
+ pinctrl-0 = <&csi_pins>, <&csi_mclk_pin>;
+ status = "okay";
+
+ port {
+ #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 */
+ vsync-active = <0>; /* Active low */
+ 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>;
+ vsync-active = <1>;
+ data-active = <1>;
+ pclk-sample = <1>;
+ };
+ };
+};
+
&dai {
status = "okay";
};
@@ -129,6 +168,56 @@ &ehci1 {
status = "okay";
};
+&i2c_csi {
+ 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>;
+ };
+ };
+ };
+
+ ov5640: rear-camera@4c {
+ compatible = "ovti,ov5640";
+ reg = <0x4c>;
+ clocks = <&ccu CLK_CSI_MCLK>;
+ clock-names = "xclk";
+
+ AVDD-supply = <&reg_dldo3>;
+ DOVDD-supply = <&reg_aldo1>; /* shared with AFVCC */
+ DVDD-supply = <&reg_eldo3>;
+ reset-gpios = <&pio 3 3 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; /* PD3 */
+ powerdown-gpios = <&pio 2 0 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; /* PC0 */
+
+ port {
+ ov5640_ep: endpoint {
+ remote-endpoint = <&csi_ov5640_ep>;
+ bus-width = <8>;
+ hsync-active = <1>; /* Active high */
+ vsync-active = <0>; /* Active low */
+ data-active = <1>; /* Active high */
+ pclk-sample = <1>; /* Rising */
+ };
+ };
+ };
+};
+
&i2c0 {
status = "okay";
@@ -253,7 +342,11 @@ &pio {
vcc-pb-supply = <&reg_dcdc1>;
vcc-pc-supply = <&reg_dcdc1>;
vcc-pd-supply = <&reg_dcdc1>;
- vcc-pe-supply = <&reg_aldo1>;
+ /* pinctrl would enable this even if no camera is powered,
+ * which is wrong/not necessary
+ *
+ * vcc-pe-supply = <&reg_aldo1>; (also used by pogo pins i2c)
+ */
vcc-pf-supply = <&reg_dcdc1>;
vcc-pg-supply = <&reg_dldo4>;
vcc-ph-supply = <&reg_dcdc1>;
--
2.34.0