From patchwork Mon Jul 31 08:29:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 13334015 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 53B22C001DF for ; Mon, 31 Jul 2023 08:30:23 +0000 (UTC) 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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=8lAzo9LvpOAIEQKz5hklh7gy6X3nqz+s0fPUk88yxkA=; b=2o26Zi7wbIDbcN H5mowt7Bsmifxw93TCjFcY4cyIhZLX2EZZdo/F+ZMNDvldqH2PY/NBugktFdxmLwVQ5lvkw1YC4BP KRur5iULEF1Q9BIqBMCscvPn75wCYS/96UDChoC1plyllhdHLXNDJR+TLFM6pmSjVQRId2HEubvDI 0LlLfyv2EQZfOwbE015p8KXZFx+3R6T5E9AiDNS4mWV+4m7FP3FpBysjd5EQAKbcKKll7DA2E1kFM u/56rKULNpr7NTmIuPDnq7xhtJVU/bH8aFfIR6km/fpHztHoYRT4Xijlc9G6gyfUZv0/P6t3NUAES ljbyYsxrt1HxEL27gzFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQOHl-00EX6k-2x; Mon, 31 Jul 2023 08:29:49 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQOHg-00EX1K-0t for linux-arm-kernel@lists.infradead.org; Mon, 31 Jul 2023 08:29:47 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 36V8TWVV048149; Mon, 31 Jul 2023 03:29:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1690792172; bh=qe9LfvfFWShZ5aa9sG+qMWQHfXQ7cLIsXeOBSSXoZ4s=; h=From:To:CC:Subject:Date; b=kVLGa/ZZcqM56IXOasQwC/81wgqRUnnY6HBIZVmA451n1t339yWA5Vm+O4yqhMZLq zeZalrvlae4RtkR3HdWIks3AN6mvgi53YWtTHp8xW0sCHDUM3LcvW6sUNBuvmsWrIs xabzMwufR1997MKpRb92/YaMgMeEMYZMefxXt70U= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 36V8TWbK106629 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 31 Jul 2023 03:29:32 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 31 Jul 2023 03:29:31 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 31 Jul 2023 03:29:32 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 36V8TUFM041788; Mon, 31 Jul 2023 03:29:31 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Laurent Pinchart , Tomi Valkeinen CC: , , , , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , Subject: [PATCH v8 00/16] CSI2RX support on J721E and AM62 Date: Mon, 31 Jul 2023 13:59:18 +0530 Message-ID: <20230731-upstream_csi-v8-0-fb7d3661c2c9@ti.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230731_012944_414009_07FD35F8 X-CRM114-Status: GOOD ( 23.10 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This series adds support for CSI2 capture on J721E. It includes some fixes to the Cadence CSI2RX driver, and adds the TI CSI2RX wrapper driver. This is a V8 of the below V7 series, https://lore.kernel.org/all/20230314115516.667-1-vaishnav.a@ti.com/ Since Pratyush moved out of TI, Vaishnav & I have been working on this driver, and I will be maintaining it upstream. J721E CSI2RX driver can also be extended to support multi-stream capture, filtering different CSI Virtual Channels (VC) or Data Types (DT) to different DMA channels. A WIP series based on v7 is available for reference at https://github.com/jailuthra/linux/commits/csi_multi_wip I will rebase the multi-stream patches on the current series (v8) and post them as RFC in the coming weeks. Testing logs: https://gist.github.com/jailuthra/eaeb3af3c65b67e1bc0d5db28180131d Signed-off-by: Jai Luthra Reviewed-by: Maxime Ripard Tested-by: Vaishnav Achath --- Range-diff from v7 -> v8: http://0x0.st/H21u.diff New Patches: [01/16] Export v4l2_subdev_link_validate_get_format() helper [03-04/16] Add new compatible for TI-specific SoC intergration of the Cadence CSI2RX bridge IP [14/16] Add support for RAW8 and RAW10 formats in Cadence CSI2RX For [07/16] media: cadence: csi2rx: Add get_fmt and set_fmt pad ops: - Use active subdev state to use v4l2_subdev_get_fmt - Propagate formats from sink to source pads - Drop Laurent's R-by because of the above changes For [08/16] media: cadence: csi2rx: Configure DPHY using link freq: - Drop original patch in-lieu of already merged https://lore.kernel.org/linux-media/20230523085626.3295-5-jack.zhu@starfivetech.com/ - Add a new patch to configure DPHY using link_freq control from the source For [10/16] media: cadence: csi2rx: Set the STOP bit when stopping a stream: - Fix bug where intention was to wait till stream status is idle, i.e. STREAM_STATUS[31] -> 0 - but we were instead checking the opposite For [15/16] media: dt-bindings: Add DT bindings for TI J721E CSI2RX driver: - Drop "Device Tree Bindings" from title - Rename "Wrapper" to "Shim" in title as that is the name referred in the TRM and other places - Update maintainer to myself - Drop items from compatible as only a single element is present - Rename compatible to "ti,j721e-csi2rx-shim" to distinguish from the SoC-specific CSI2RX bridge compatible For [16/16] media: ti: Add CSI2RX support for J721E: - Move after dt-bindings to keep the series bisectable - Rename compatible to "ti,j721e-csi2rx-shim" to distinguish from the SoC-specific CSI2RX bridge compatible - Make myself the Maintainer - Support RAW8 and RAW10 formats, and setting the pixel-unwrap size on SHIM (RAW10 is stored in 16-bit containers, while RAW8 in 8-bit containers) - Fix enum_fmt_vid_cap() to respect CAP_IO_MC and only list pixelformats matching the mbus formats set on the subdev. - Fix enum_framesizes() to stop enumerating more than a single framesize (reject non-zero fsize->index) - Simplify notifier bound fucntion to use v4l2_create_fwnode_links_to_pad() and inline the video_register() method - Add support for draining the DMA with an extra buffer, to get rid of stale data in the pipeline on stream stop (or when frames start getting dropped due to load) - Queue all available buffers to DMAEngine in the callback, also use a separate "submitted" queue to track all buffers submitted to DMA - Use video_device_pipeline_start() instead of media_pipeline_start() - Drop support for VB_READ - Print issues in link validation as DEBUG instead of ERROR - s/async_subdev/async_connection For [v7 13/13] media: dt-bindings: Convert Cadence CSI2RX binding to YAML: - Drop patch in-lieu of https://lore.kernel.org/linux-media/20230523085626.3295-2-jack.zhu@starfivetech.com/ --- Jai Luthra (4): media: subdev: Export get_format helper for link validation media: dt-bindings: cadence-csi2rx: Add TI compatible string media: cadence: Add support for TI SoCs media: cadence: csi2rx: Support RAW8 and RAW10 formats Pratyush Yadav (12): media: dt-bindings: Make sure items in data-lanes are unique media: cadence: csi2rx: Unregister v4l2 async notifier media: cadence: csi2rx: Cleanup media entity properly media: cadence: csi2rx: Add get_fmt and set_fmt pad ops media: cadence: csi2rx: Configure DPHY using link freq media: cadence: csi2rx: Soft reset the streams before starting capture media: cadence: csi2rx: Set the STOP bit when stopping a stream media: cadence: csi2rx: Fix stream data configuration media: cadence: csi2rx: Populate subdev devnode media: cadence: csi2rx: Add link validation media: dt-bindings: Add TI J721E CSI2RX media: ti: Add CSI2RX support for J721E .../devicetree/bindings/media/cdns,csi2rx.yaml | 1 + .../bindings/media/ti,j721e-csi2rx-shim.yaml | 100 ++ .../bindings/media/video-interfaces.yaml | 1 + MAINTAINERS | 7 + drivers/media/platform/cadence/cdns-csi2rx.c | 217 +++- drivers/media/platform/ti/Kconfig | 12 + drivers/media/platform/ti/Makefile | 1 + drivers/media/platform/ti/j721e-csi2rx/Makefile | 2 + .../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 1127 ++++++++++++++++++++ drivers/media/v4l2-core/v4l2-subdev.c | 8 +- include/media/v4l2-subdev.h | 12 + 11 files changed, 1478 insertions(+), 10 deletions(-) --- base-commit: ec89391563792edd11d138a853901bce76d11f44 change-id: 20230727-upstream_csi-acbeabe038d8 Best regards,