From patchwork Fri Nov 12 18:33:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 12692435 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.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42262C433F5 for ; Fri, 12 Nov 2021 18:34:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0882F60F5B for ; Fri, 12 Nov 2021 18:34:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0882F60F5B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=fsKwTnoESMA73vV64WXny4inwCGt5GtdZaoikUCExhE=; b=zgQu8ik9GURC35 hShReXJ98O6aOf0+A1fB1oyYuDya9mtR407nyVL8XaaaC8Hl7OPpk22aH1q5WRFxKKI4tAdsNhDUB og0hnd/8Da6VZKPdr+Yd/DK4yv0m7CKEcLydYEfkyfTXxVaBG+ge7FVKh8slW3VM2kbdYqFoKSoAR z51DizojJCni9eAzuwwuWmedDSqxOJQsipJjzDwF389mpgTQKB0AOVIFL1HmX9++XeQDNao1IRfr3 ZNgpUeoVkslpMeF4I6qfAhibr20H02rJLcvZ/2U7zSEEe/nGr18uyPG16oJpVBRnUO0k7rf+wuI+j tgsGgcZAcabJkZBZNzFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlbMe-00BO5E-I4; Fri, 12 Nov 2021 18:33:28 +0000 Received: from finn.gateworks.com ([108.161.129.64] helo=finn.localdomain) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlbMa-00BO4H-5A for linux-arm-kernel@lists.infradead.org; Fri, 12 Nov 2021 18:33:25 +0000 Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1mlbMP-008C7N-Kc; Fri, 12 Nov 2021 18:33:13 +0000 From: Tim Harvey To: devicetree@vger.kernel.org, Rob Herring , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Laurent Pinchart Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Adam Ford , Tim Harvey Subject: [RFC] arm64: dts: imx8mm: add imx8mm-venice-gw73xx-0x-imx219 overlay Date: Fri, 12 Nov 2021 10:33:11 -0800 Message-Id: <20211112183311.9556-1-tharvey@gateworks.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211112_103324_226834_B7406C92 X-CRM114-Status: GOOD ( 15.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for the RaspberryPi Camera v2 module attached to an imx8mm-venice-gw73xx-0x. This camera is an IMX219 8MP module: - https://datasheets.raspberrypi.com/camera/camera-v2-schematics.pdf - has its own on-board 24MHz osc so no clock required from baseboard - pin 11 enables 1.8V and 2.8V LDO which is connected to GW73xx MIPI_GPIO4 (IMX8MM GPIO1_IO1). The imx219 driver does not support powerdown-gpios therefore we use gpio1 via reset-gpios Support is added via a device-tree overlay. The IMX219 supports RAW8/RAW10 image formats. Example usage: media-ctl --links "'imx219 2-0010':0->'imx7-mipi-csis.0':0[1]" media-ctl -v -V "'imx219 2-0010':0 [fmt:SRGGB8/640x480 field:none]" media-ctl -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]" gst-launch-1.0 -v v4l2src num-buffers=1 ! \ video/x-bayer,format=rggb,width=640,height=480,framerate=30/1 ! \ bayer2rgb ! jpegenc ! filesink location=test.jpg gst-launch-1.0 -v v4l2src num-buffers=300 ! \ video/x-bayer,format=rggb,width=640,height=480,framerate=30/1 ! \ bayer2rgb ! jpegenc ! avimux ! filesink location=test.avi This patch depends on 'arm64: dts: imx8mm: Add CSI nodes' at: https://lore.kernel.org/all/20211106155427.753197-2-aford173@gmail.com/ This is an RFC as I am not aware of other dt fragments/overlays being added to the kernel yet. I do get a few warnings but I believe they are because this is a fragment: $ make DTC_FLAGS="-@" dtbs W=1 DTC arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtb arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts:33.3-16: Warning (reg_format): /fragment@2/__overlay__/sensor@10:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts:52.10-57.5: Warning (unit_address_vs_reg): /fragment@3/__overlay__/ports/port@0: node has a unit name, but no reg or ranges property arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format' arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format' arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format' arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format' arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format' arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts:29.20-46.4: Warning (avoid_default_addr_size): /fragment@2/__overlay__/sensor@10: Relying on default #address-cells value arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts:29.20-46.4: Warning (avoid_default_addr_size): /fragment@2/__overlay__/sensor@10: Relying on default #size-cells value arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtb: Warning (avoid_unnecessary_addr_size): Failed prerequisite 'avoid_default_addr_size' arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtb: Warning (unique_unit_address): Failed prerequisite 'avoid_default_addr_size' The intended use of a dt fragement like this is to apply it in boot firmware before booting the kernel such as: u-boot=> load mmc 0:1 $fdt_addr_r imx8mm-venice-gw73xx-0x.dtb u-boot=> fdt addr $fdt_addr_r u-boot=> fdt resize u-boot=> load mmc 0:1 $loadaddr imx8mm-venice-gw73xx-0x-imx219.dtb u-boot=> fdt appply $loadaddr u-boot=> load mmc 0:1 $kernel_addr_r Image u-boot=> booti $kernel_addr_r - $fdt_addr_r Signed-off-by: Tim Harvey --- arch/arm64/boot/dts/freescale/Makefile | 1 + .../imx8mm-venice-gw73xx-0x-imx219.dts | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts diff --git a/arch/arm64/boot/dts/freescale/Makefile b/arch/arm64/boot/dts/freescale/Makefile index db9e36ebe932..cc00ac78dbc6 100644 --- a/arch/arm64/boot/dts/freescale/Makefile +++ b/arch/arm64/boot/dts/freescale/Makefile @@ -42,6 +42,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mm-var-som-symphony.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw71xx-0x.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw72xx-0x.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw73xx-0x.dtb +dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw73xx-0x-imx219.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw7901.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw7902.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mn-beacon-kit.dtb diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts new file mode 100644 index 000000000000..6f692ba24a31 --- /dev/null +++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright 2021 Gateworks Corporation + */ + +#include + +#include "imx8mm-pinfunc.h" + +/dts-v1/; +/plugin/; + +&{/} { + compatible = "gw,imx8mm-gw73xx-0x", "fsl,imx8mm"; + + cam24m: cam24m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-output-names = "cam24m"; + }; +}; + +&csi { + status = "okay"; +}; + +&i2c3 { + imx219: sensor@10 { + compatible = "sony,imx219"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_imx219>; + reg = <0x10>; + clocks = <&cam24m>; + reset-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + + port { + /* MIPI CSI-2 bus endpoint */ + imx219_to_mipi_csi2: endpoint { + remote-endpoint = <&imx8mm_mipi_csi_in>; + clock-lanes = <0>; + data-lanes = <1 2>; + link-frequencies = /bits/ 64 <456000000>; + }; + }; + }; +}; + +&mipi_csi { + status = "okay"; + ports { + port@0 { + imx8mm_mipi_csi_in: endpoint { + remote-endpoint = <&imx219_to_mipi_csi2>; + data-lanes = <1 2>; + }; + }; + }; +}; + +&iomuxc { + pinctrl_imx219: imx219grp { + fsl,pins = < + MX8MM_IOMUXC_GPIO1_IO01_GPIO1_IO1 0x41 + >; + }; +};