From patchwork Sat Jul 15 23:02:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 13316317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qKoHI-009dT2-2p for linux-arm-kernel@lists.infradead.org; Sat, 15 Jul 2023 23:02:18 +0000 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5671db01ee0so226448eaf.1 for ; Sat, 15 Jul 2023 16:02:16 -0700 (PDT) From: Fabio Estevam Subject: [PATCH 2/2] arm64: dts: imx8mn-evk: Add camera support Date: Sat, 15 Jul 2023 20:02:09 -0300 Message-Id: <20230715230209.221504-2-festevam@gmail.com> In-Reply-To: <20230715230209.221504-1-festevam@gmail.com> References: <20230715230209.221504-1-festevam@gmail.com> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+lwn-linux-arm-kernel=archive.lwn.net@lists.infradead.org List-Archive: To: shawnguo@kernel.org Cc: linux-arm-kernel@lists.infradead.org, Fabio Estevam From: Fabio Estevam Add support for the OV5640 camera. Tested with the following commands: media-ctl -l "'ov5640 2-003c':0 -> 'csis-32e30000.mipi-csi':0 [1]" media-ctl -V "'ov5640 2-003c':0 [fmt:UYVY8_1X16/640x480 field:none]" media-ctl -V "'crossbar':0 [fmt:UYVY8_1X16/640x480 field:none]" media-ctl -V "'mxc_isi.0':0 [fmt:UYVY8_1X16/640x480 field:none]" v4l2-ctl --device /dev/video0 --set-fmt-video=width=640,height=480,pixelformat=YUYV v4l2-ctl --stream-mmap -d /dev/video0; gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480 ! waylandsink Signed-off-by: Fabio Estevam --- arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi index c374cb4f6f7b..d09d0879dfe2 100644 --- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi @@ -259,6 +259,45 @@ pca6416: gpio@20 { gpio-controller; #gpio-cells = <2>; }; + + camera@3c { + compatible = "ovti,ov5640"; + reg = <0x3c>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_camera>; + clocks = <&clk IMX8MN_CLK_CLKO1>; + clock-names = "xclk"; + assigned-clocks = <&clk IMX8MN_CLK_CLKO1>; + assigned-clock-parents = <&clk IMX8MN_CLK_24M>; + assigned-clock-rates = <24000000>; + powerdown-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + + port { + ov5640_to_mipi_csi2: endpoint { + remote-endpoint = <&imx8mn_mipi_csi_in>; + clock-lanes = <0>; + data-lanes = <1 2>; + }; + }; + }; +}; + +&isi { + status = "okay"; +}; + +&mipi_csi { + status = "okay"; + + ports { + port@0 { + imx8mn_mipi_csi_in: endpoint { + remote-endpoint = <&ov5640_to_mipi_csi2>; + data-lanes = <1 2>; + }; + }; + }; }; &lcdif { @@ -393,6 +432,14 @@ &wdog1 { }; &iomuxc { + pinctrl_camera: cameragrp { + fsl,pins = < + MX8MN_IOMUXC_GPIO1_IO06_GPIO1_IO6 0x19 + MX8MN_IOMUXC_GPIO1_IO07_GPIO1_IO7 0x19 + MX8MN_IOMUXC_GPIO1_IO14_CCMSRCGPCMIX_CLKO1 0x59 + >; + }; + pinctrl_fec1: fec1grp { fsl,pins = < MX8MN_IOMUXC_ENET_MDC_ENET1_MDC 0x3