sunxi: add OV5640 dtsi camera module for H2/H3 SoCs
authorZoltan HERPAI <wigyori@uid0.hu>
Sun, 29 Oct 2023 17:55:22 +0000 (18:55 +0100)
committerZoltan HERPAI <wigyori@uid0.hu>
Sun, 29 Oct 2023 17:59:21 +0000 (18:59 +0100)
Create a dtsi with an OV5640 camera definition that can be used
as an include in H2/H3 boards.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
target/linux/sunxi/patches-6.1/900-dts-sunxi-h2-h3-add-OV5640-dtsi.patch [new file with mode: 0644]

diff --git a/target/linux/sunxi/patches-6.1/900-dts-sunxi-h2-h3-add-OV5640-dtsi.patch b/target/linux/sunxi/patches-6.1/900-dts-sunxi-h2-h3-add-OV5640-dtsi.patch
new file mode 100644 (file)
index 0000000..793c10a
--- /dev/null
@@ -0,0 +1,124 @@
+diff -ruN a/arch/arm/boot/dts/sunxi-h2-h3-ov5640.dtsi b/arch/arm/boot/dts/sunxi-h2-h3-ov5640.dtsi
+--- a/arch/arm/boot/dts/sunxi-h2-h3-ov5640.dtsi        1970-01-01 01:00:00.000000000 +0100
++++ b/arch/arm/boot/dts/sunxi-h2-h3-ov5640.dtsi        2023-10-29 17:41:49.626274400 +0100
+@@ -0,0 +1,120 @@
++/ {
++      cam_xclk: cam-xclk {
++              #clock-cells = <0>;
++              compatible = "fixed-clock";
++              clock-frequency = <24000000>;
++              clock-output-names = "cam-xclk";
++      };
++
++      reg_cam_avdd: cam-avdd {
++              compatible = "regulator-fixed";
++              regulator-name = "csi-avdd";
++              regulator-min-microvolt = <2800000>;
++              regulator-max-microvolt = <2800000>;
++              startup-delay-us = <200>; /* 50 us + board delays */
++              enable-active-high;
++              gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
++      };
++
++      reg_cam_dovdd: cam-dovdd {
++              compatible = "regulator-fixed";
++              regulator-name = "csi-dovdd";
++              regulator-min-microvolt = <2800000>;
++              regulator-max-microvolt = <2800000>;
++              startup-delay-us = <200>; /* 50 us + board delays */
++              regulator-always-on;
++              enable-active-high;
++              gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
++      };
++
++      reg_cam_dvdd: cam-dvdd {
++              compatible = "regulator-fixed";
++              regulator-name = "csi-dvdd";
++              regulator-min-microvolt = <1500000>;
++              regulator-max-microvolt = <1500000>;
++              startup-delay-us = <200>; /* 50 us + board delays */
++              enable-active-high;
++              gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
++      };
++};
++
++&de {
++      status = "okay";
++};
++
++&pio {
++      csi_mclk_pin: csi-mclk-pin {
++              pins = "PE1";
++              function = "csi";
++      };
++};
++
++&de {
++      status = "okay";
++};
++
++&csi {
++      status = "okay";
++
++      port {
++              #address-cells = <1>;
++              #size-cells = <0>;
++
++              // Parallel bus endpoint
++              csi_from_ov5640: endpoint {
++                      remote-endpoint = <&ov5640_to_csi>;
++                      bus-width = <8>;
++                      data-shift = <2>;
++                      hsync-active = <1>; // Active high
++                      vsync-active = <0>; // Active low
++                      data-active = <1>;  // Active high
++                      pclk-sample = <1>;  // Rising
++              };
++      };
++};
++
++&i2c0 {
++      status = "okay";
++};
++
++&i2c1 {
++      status = "okay";
++};
++
++&i2c2_pins {
++      bias-pull-up;
++};
++
++&i2c2 {
++      status = "okay";
++
++      ov5640: camera@3c {
++              compatible = "ovti,ov5640";
++              reg = <0x3c>;
++
++              clocks = <&ccu CLK_CSI_MCLK>;
++              clock-names = "xclk";
++
++              pinctrl-names = "default";
++              pinctrl-0 = <&csi_mclk_pin>;
++              
++              reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>;
++              powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>;
++
++              AVDD-supply = <&reg_cam_avdd>;
++              DOVDD-supply = <&reg_cam_dovdd>;
++              DVDD-supply = <&reg_cam_dvdd>;
++
++              port {
++                      ov5640_to_csi: endpoint {
++                              remote-endpoint = <&csi_from_ov5640>;
++                              bus-width = <8>;
++                              data-shift = <2>;
++                              hsync-active = <1>; // Active high
++                              vsync-active = <0>; // Active low
++                              data-active = <1>;  // Active high
++                              pclk-sample = <1>;  // Rising
++                      };
++              };
++      };
++};