From patchwork Fri Feb 18 18:34:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12751739 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 1D21CC433F5 for ; Fri, 18 Feb 2022 18:36:55 +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:References:In-Reply-To: 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: List-Owner; bh=wfycVKcOouMYoerRS/1CoucLWneFJAyR+N2WiL4+uBI=; b=sQsq972Sn1CaSE PiF6jc67+av7GJMBzwfoAg2wIBd6WW8XaEPUC4rz7hejk7VzkaKu54EpTeaTV2xI1Tmdpe6cd1bR6 84KoDJG6CzBs2UcX2tsXt5gab/g8BNoi07SEc5db4ob3q1B2XUGzPl4RiaEglTqc3I7MMjme27DfY 76PTBUfgRcGaIECRkLDTCi/dynvBcXsK4oaPr1AaCj/D8PHwkGy/pTaMO6JSXeUvm25l0tN4VhkeJ AtM6CfXni4eQUX35tHowvpCkES5H++PQciqdADMmoUmTiGVF4Dz6v3XqClRfNPhmPIdEKWQI871hI 4TrbaJLHN5l6ouBTEzFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86Z-00FVwe-GA; Fri, 18 Feb 2022 18:35:43 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86V-00FVvD-Us for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 18:35:41 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 75D6440002; Fri, 18 Feb 2022 18:35:34 +0000 (UTC) From: Jacopo Mondi To: slongerbeam@gmail.com, p.zabel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, martin.kepplinger@puri.sm, rmfrfs@gmail.com, xavier.roumegue@oss.nxp.com, alexander.stein@ew.tq-group.com, dorota.czaplejewicz@puri.sm Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Jacopo Mondi Subject: [PATCH v2 1/7] media: imx: De-stage imx7-mipi-csis Date: Fri, 18 Feb 2022 19:34:15 +0100 Message-Id: <20220218183421.583874-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220218183421.583874-1-jacopo@jmondi.org> References: <20220218183421.583874-1-jacopo@jmondi.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_103540_304999_EA648670 X-CRM114-Status: GOOD ( 16.04 ) 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 The imx7-mipi-csis driver is in a good state and can be destaged. Move the imx7-mipi-csis.c driver to the newly created drivers/media/platform/imx directory and plumb the related options in Kconfig and in Makefile. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- MAINTAINERS | 2 +- drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/imx/Kconfig | 24 +++++++++++++++++++ drivers/media/platform/imx/Makefile | 1 + .../platform}/imx/imx7-mipi-csis.c | 0 drivers/staging/media/imx/Makefile | 1 - 7 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 drivers/media/platform/imx/Kconfig create mode 100644 drivers/media/platform/imx/Makefile rename drivers/{staging/media => media/platform}/imx/imx7-mipi-csis.c (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 83d27b57016f..5bdb8c881b0b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11891,8 +11891,8 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/admin-guide/media/imx7.rst F: Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml F: Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml +F: drivers/media/platform/imx/imx7-mipi-csis.c F: drivers/staging/media/imx/imx7-media-csi.c -F: drivers/staging/media/imx/imx7-mipi-csis.c MEDIA DRIVERS FOR HELENE M: Abylay Ospan diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 9fbdba0fd1e7..d9eeccffea69 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -171,6 +171,7 @@ source "drivers/media/platform/xilinx/Kconfig" source "drivers/media/platform/rcar-vin/Kconfig" source "drivers/media/platform/atmel/Kconfig" source "drivers/media/platform/sunxi/Kconfig" +source "drivers/media/platform/imx/Kconfig" config VIDEO_TI_CAL tristate "TI CAL (Camera Adaptation Layer) driver" diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 28eb4aadbf45..a9466c854610 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -20,6 +20,7 @@ obj-y += ti-vpe/ obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o obj-$(CONFIG_VIDEO_CODA) += coda/ +obj-$(CONFIG_VIDEO_IMX) += imx/ obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o obj-$(CONFIG_VIDEO_IMX8_JPEG) += imx-jpeg/ diff --git a/drivers/media/platform/imx/Kconfig b/drivers/media/platform/imx/Kconfig new file mode 100644 index 000000000000..683863572c20 --- /dev/null +++ b/drivers/media/platform/imx/Kconfig @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-only + +menuconfig VIDEO_IMX + bool "V4L2 capture drivers for NXP i.MX devices" + depends on ARCH_MXC || COMPILE_TEST + depends on VIDEO_DEV && VIDEO_V4L2 + help + Say yes here to enable support for capture drivers on i.MX SoCs. + Support for the single SoC features are selectable in the sub-menu + options. + +if VIDEO_IMX + +config VIDEO_IMX_MIPI_CSIS + tristate "MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8 models" + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + default n + help + Video4Linux2 sub-device driver for the MIPI CSI-2 CSIS receiver + v3.3/v3.6.3 found on some i.MX7 and i.MX8 SoCs. + +endif # VIDEO_IMX diff --git a/drivers/media/platform/imx/Makefile b/drivers/media/platform/imx/Makefile new file mode 100644 index 000000000000..ee272234c8d7 --- /dev/null +++ b/drivers/media/platform/imx/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx7-mipi-csis.o diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/media/platform/imx/imx7-mipi-csis.c similarity index 100% rename from drivers/staging/media/imx/imx7-mipi-csis.c rename to drivers/media/platform/imx/imx7-mipi-csis.c diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile index 19c2fc54d424..d82be898145b 100644 --- a/drivers/staging/media/imx/Makefile +++ b/drivers/staging/media/imx/Makefile @@ -15,5 +15,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-mipi-csis.o obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o From patchwork Fri Feb 18 18:34:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12751740 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 712A2C433F5 for ; Fri, 18 Feb 2022 18:37:07 +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:References:In-Reply-To: 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: List-Owner; bh=Y0YpywW0JazD28Actofxx81nqEjwZOZcqva0rgVutNk=; b=OwfROSg4JPGppE P+OBIsRRYlLEw8FzGkMrg7lL/QZ5ULwjq8dwG3abQ0qx40vpVxMIVZZ2/+PbsHDEIlgmJU4s2rJx+ ND4Bzr3/gsWfpJRbdRaNCburdE0geUKxe/8xudRXpG7gbmn5G5yrhKeaDAchWhuR/Hbzyc1BmTn5g xxsVBvpj5EzgyTBCHik/VBaLN4WvoqX0oxkOi/oi2hPRHfLs+i2I3PWG5LC1OyDQnzZwMJf8Y8kSV l00++Co8fnEgxM1LAsj1QQlFemPR+YJfuIasxxsS0MIArrhyZpTihtHDUp/twxbEngXBVqFEam6lp wJ07SCdvdHllmln99eAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86l-00FW4r-Qb; Fri, 18 Feb 2022 18:35:55 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86Y-00FVvx-E2 for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 18:35:44 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 93DB340009; Fri, 18 Feb 2022 18:35:37 +0000 (UTC) From: Jacopo Mondi To: slongerbeam@gmail.com, p.zabel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, martin.kepplinger@puri.sm, rmfrfs@gmail.com, xavier.roumegue@oss.nxp.com, alexander.stein@ew.tq-group.com, dorota.czaplejewicz@puri.sm Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Jacopo Mondi Subject: [PATCH v2 2/7] media: imx: Rename imx7-mipi-csis.c to imx-mipi-csis.c Date: Fri, 18 Feb 2022 19:34:16 +0100 Message-Id: <20220218183421.583874-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220218183421.583874-1-jacopo@jmondi.org> References: <20220218183421.583874-1-jacopo@jmondi.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_103542_769251_5B7B3E7B X-CRM114-Status: GOOD ( 13.83 ) 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 Rename the imx7-mipi-csis.c driver to remove the reference to i.MX7. The driver is for an IP core found on i.MX7 and i.MX8 SoC, so do not specify a SoC version number in the driver name. Remove the references to the i.MX7 SoC in the driver symbols and expand the driver's header with more information about the IP core the driver controls. Also rename the associated bindings documentation. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- Documentation/admin-guide/media/imx7.rst | 2 +- ...{nxp,imx7-mipi-csi2.yaml => nxp,imx-mipi-csi2.yaml} | 2 +- MAINTAINERS | 4 ++-- drivers/media/platform/imx/Makefile | 2 +- .../platform/imx/{imx7-mipi-csis.c => imx-mipi-csis.c} | 10 +++++++--- 5 files changed, 12 insertions(+), 8 deletions(-) rename Documentation/devicetree/bindings/media/{nxp,imx7-mipi-csi2.yaml => nxp,imx-mipi-csi2.yaml} (98%) rename drivers/media/platform/imx/{imx7-mipi-csis.c => imx-mipi-csis.c} (99%) diff --git a/Documentation/admin-guide/media/imx7.rst b/Documentation/admin-guide/media/imx7.rst index 4785ae8ac978..2fa27718f52a 100644 --- a/Documentation/admin-guide/media/imx7.rst +++ b/Documentation/admin-guide/media/imx7.rst @@ -33,7 +33,7 @@ reference manual [#f1]_. Entities -------- -imx7-mipi-csi2 +imx-mipi-csi2 -------------- This is the MIPI CSI-2 receiver entity. It has one sink pad to receive the pixel diff --git a/Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml b/Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml similarity index 98% rename from Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml rename to Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml index e2e6e9aa0fe6..36b135bf9f2a 100644 --- a/Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml +++ b/Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/media/nxp,imx7-mipi-csi2.yaml# +$id: http://devicetree.org/schemas/media/nxp,imx-mipi-csi2.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: NXP i.MX7 and i.MX8 MIPI CSI-2 receiver diff --git a/MAINTAINERS b/MAINTAINERS index 5bdb8c881b0b..d919ea3ed250 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11889,9 +11889,9 @@ L: linux-media@vger.kernel.org S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/admin-guide/media/imx7.rst +F: Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml F: Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml -F: Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml -F: drivers/media/platform/imx/imx7-mipi-csis.c +F: drivers/media/platform/imx/imx-mipi-csis.c F: drivers/staging/media/imx/imx7-media-csi.c MEDIA DRIVERS FOR HELENE diff --git a/drivers/media/platform/imx/Makefile b/drivers/media/platform/imx/Makefile index ee272234c8d7..f72bdbe8e6ef 100644 --- a/drivers/media/platform/imx/Makefile +++ b/drivers/media/platform/imx/Makefile @@ -1 +1 @@ -obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx7-mipi-csis.o +obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o diff --git a/drivers/media/platform/imx/imx7-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c similarity index 99% rename from drivers/media/platform/imx/imx7-mipi-csis.c rename to drivers/media/platform/imx/imx-mipi-csis.c index a22d0e6b3d44..3e7efcf43a5f 100644 --- a/drivers/media/platform/imx/imx7-mipi-csis.c +++ b/drivers/media/platform/imx/imx-mipi-csis.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Freescale i.MX7 SoC series MIPI-CSI V3.3 receiver driver + * Samsung CSIS MIPI CSI-2 receiver driver. + * + * The Samsung CSIS IP is a MIPI CSI-2 receiver found in various NXP i.MX7 and + * i.MX8 SoCs. The i.MX7 features version 3.3 of the IP, while i.MX8 features + * version 3.6.3. * * Copyright (C) 2019 Linaro Ltd * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. All Rights Reserved. @@ -31,7 +35,7 @@ #include #include -#define CSIS_DRIVER_NAME "imx7-mipi-csis" +#define CSIS_DRIVER_NAME "imx-mipi-csis" #define CSIS_PAD_SINK 0 #define CSIS_PAD_SOURCE 1 @@ -1515,4 +1519,4 @@ module_platform_driver(mipi_csis_driver); MODULE_DESCRIPTION("i.MX7 & i.MX8 MIPI CSI-2 receiver driver"); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:imx7-mipi-csi2"); +MODULE_ALIAS("platform:imx-mipi-csi2"); From patchwork Fri Feb 18 18:34:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12751741 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 A9A20C433EF for ; Fri, 18 Feb 2022 18:37:15 +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:References:In-Reply-To: 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: List-Owner; bh=tHzC5p4rEsYXkUUmcufCgHr0YSuMg7UkNZKd0CqmZj8=; b=aMKWLbaf7cjudn FFLhItLQXTulIc9t/4uY1GY2bCiXJL1hV3DY0FRD4oWpAnQ3WSI9KbP2dEvX+ZWfeSCau+FSErXte lKnqzuhGi5PIDia7VL/jh/swbJitrRKGzzYlkOD8Ezariuw2iM6eMQZWY0GM+wQNxKb62clujAj/I tsSjakxUZ3CFpYTl7ZnSqZ19adQ9tYAYuonrXiOW0MHrrCYq9mN/eC72CnKUtHlKTMugxNoLBoHLH eqHDHWnVPkpuHsSn2qYKTbBpfLxAL2bB4ePygS18zra6zgioR3QcD7l7krxvJ8sHFuigwo0ql9YDG bqWkjDTjG+ykwxz0zRGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86y-00FWBM-Mo; Fri, 18 Feb 2022 18:36:08 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86b-00FVxR-71 for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 18:35:48 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id A321D40005; Fri, 18 Feb 2022 18:35:40 +0000 (UTC) From: Jacopo Mondi To: slongerbeam@gmail.com, p.zabel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, martin.kepplinger@puri.sm, rmfrfs@gmail.com, xavier.roumegue@oss.nxp.com, alexander.stein@ew.tq-group.com, dorota.czaplejewicz@puri.sm Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Jacopo Mondi Subject: [PATCH v2 3/7] media: imx: imx7-media-csi: Use dual sampling for YUV 1X16 Date: Fri, 18 Feb 2022 19:34:17 +0100 Message-Id: <20220218183421.583874-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220218183421.583874-1-jacopo@jmondi.org> References: <20220218183421.583874-1-jacopo@jmondi.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_103545_619601_DEE90C37 X-CRM114-Status: GOOD ( 16.96 ) 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 The CSI bridge should operate in dual pixel sampling mode when it is connected to a pixel transmitter that transfers two pixel samples (16 bits) at the time in YUYV formats. Use the image format variants to determine if single or dual pixel mode should be used. Add a note to the TODO file to record that the list of supported formats should be restricted to the SoC model the CSI bridge is integrated on to avoid potential pipeline mis-configurations. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/staging/media/imx/TODO | 26 ++++++++++++++++++++++ drivers/staging/media/imx/imx7-media-csi.c | 8 +++++-- 2 files changed, 32 insertions(+), 2 deletions(-) -- 2.35.0 diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO index 06c94f20ecf8..e15eba32cc94 100644 --- a/drivers/staging/media/imx/TODO +++ b/drivers/staging/media/imx/TODO @@ -27,3 +27,29 @@ - i.MX7: all of the above, since it uses the imx media core - i.MX7: use Frame Interval Monitor + +- imx7-media-csi: Restrict the supported formats list to the SoC version. + + The imx7 CSI bridge can be configured to sample pixel components from the Rx + queue in single (8bpp) or double (16bpp) modes. Image format variations with + different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the sampling size + (see imx7_csi_configure()). + + As the imx7 CSI bridge can be interfaced with different IP blocks depending on + the SoC model it is integrated on, the Rx queue sampling size should match + the size of samples transferred by the transmitting IP block. + + To avoid mis-configurations of the capture pipeline, the enumeration of the + supported formats should be restricted to match the pixel source + transmitting mode. + + Examples: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2 + receiver which operates in dual pixel sampling mode. The CSI bridge should + only expose the 1X16 formats variant which instructs it to operate in dual + pixel sampling mode. When the CSI bridge is instead integrated on an i.MX8MQ + SoC, which features a CSI-2 receiver that operates in single sampling mode, it + should only expose the 2X8 formats variant which instruct it to operate in + single sampling mode. + + This currently only applies to YUYV formats, but other formats might need + to be treated in the same way. diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 32311fc0e2a4..108360ae3710 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -503,11 +503,15 @@ static void imx7_csi_configure(struct imx7_csi *csi) * all of them comply. Support both variants. */ case MEDIA_BUS_FMT_UYVY8_2X8: - case MEDIA_BUS_FMT_UYVY8_1X16: case MEDIA_BUS_FMT_YUYV8_2X8: - case MEDIA_BUS_FMT_YUYV8_1X16: cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B; break; + case MEDIA_BUS_FMT_UYVY8_1X16: + case MEDIA_BUS_FMT_YUYV8_1X16: + cr3 |= BIT_TWO_8BIT_SENSOR; + cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B | + BIT_MIPI_DOUBLE_CMPNT; + break; } } From patchwork Fri Feb 18 18:34:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12751742 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 EA4F6C433F5 for ; Fri, 18 Feb 2022 18:37:27 +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:References:In-Reply-To: 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: List-Owner; bh=r3mK5RjHeLsB/H7NI6P+NloPAlpuN/gSfxiSoyBEKkY=; b=gT0OH/VuMZJdTx 8U14pC6m9pSO+wjQIGUcvpEUcxvzo1mtYEyMiMhfQ8tSU9ixiII4Dr4pS3EzeMNVVoY653h6kJV1p SBYGdZzBHVlz6/K1a43YGa5Wy0W8y6v5phq0D9XmJIXzdvT//zsdg8oOMEK1XKDOAzn8QUcMK/dtg ADC9TpVpO6YTjXMzwEUFyABDjJGiXMGiuyGaGOYn6ZOPAnIMjqFJrXFqx+jRwRgQARtFJ6OlnwBB5 lsT5PnltRQSd7SAHR4YBX3zvEfhJtCz84EkTUIX5547j/wzlPY5Sdg+hvqFVETebouj+cCpPO/wwJ F/7WGBmZYjOgiEctEmHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL879-00FWEP-7Z; Fri, 18 Feb 2022 18:36:19 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86e-00FVzl-8Q for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 18:35:49 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id BC0EB40002; Fri, 18 Feb 2022 18:35:43 +0000 (UTC) From: Jacopo Mondi To: slongerbeam@gmail.com, p.zabel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, martin.kepplinger@puri.sm, rmfrfs@gmail.com, xavier.roumegue@oss.nxp.com, alexander.stein@ew.tq-group.com, dorota.czaplejewicz@puri.sm Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Jacopo Mondi Subject: [PATCH v2 4/7] media: imx: imx-mipi-csis: Set PIXEL_MODE for YUV422 Date: Fri, 18 Feb 2022 19:34:18 +0100 Message-Id: <20220218183421.583874-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220218183421.583874-1-jacopo@jmondi.org> References: <20220218183421.583874-1-jacopo@jmondi.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_103548_517200_E334CDE2 X-CRM114-Status: GOOD ( 10.87 ) 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 Bits 13 and 12 of the ISP_CONFIGn register configure the PIXEL_MODE which specifies the sampling size, in pixel component units, on the CSI-2 output data interface when data are transferred to memory. The register description in the chip manual specifies that DUAL mode should be used for YUV422 data. Signed-off-by: Jacopo Mondi Signed-off-by: Xavier Roumegue Reviewed-by: Laurent Pinchart --- drivers/media/platform/imx/imx-mipi-csis.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c index 3e7efcf43a5f..86e7ea3713d9 100644 --- a/drivers/media/platform/imx/imx-mipi-csis.c +++ b/drivers/media/platform/imx/imx-mipi-csis.c @@ -173,6 +173,7 @@ #define MIPI_CSIS_ISPCFG_PIXEL_MODE_SINGLE (0 << 12) #define MIPI_CSIS_ISPCFG_PIXEL_MODE_DUAL (1 << 12) #define MIPI_CSIS_ISPCFG_PIXEL_MODE_QUAD (2 << 12) /* i.MX8M[MNP] only */ +#define MIPI_CSIS_ISPCFG_PIXEL_MASK (3 << 12) #define MIPI_CSIS_ISPCFG_ALIGN_32BIT BIT(11) #define MIPI_CSIS_ISPCFG_FMT(fmt) ((fmt) << 2) #define MIPI_CSIS_ISPCFG_FMT_MASK (0x3f << 2) @@ -506,7 +507,13 @@ static void __mipi_csis_set_format(struct csi_state *state) /* Color format */ val = mipi_csis_read(state, MIPI_CSIS_ISP_CONFIG_CH(0)); - val &= ~(MIPI_CSIS_ISPCFG_ALIGN_32BIT | MIPI_CSIS_ISPCFG_FMT_MASK); + val &= ~(MIPI_CSIS_ISPCFG_ALIGN_32BIT | MIPI_CSIS_ISPCFG_FMT_MASK + | MIPI_CSIS_ISPCFG_PIXEL_MASK); + + /* TODO: Verify which other formats require DUAL (or QUAD) modes. */ + if (state->csis_fmt->data_type == MIPI_CSI2_DATA_TYPE_YUV422_8) + val |= MIPI_CSIS_ISPCFG_PIXEL_MODE_DUAL; + val |= MIPI_CSIS_ISPCFG_FMT(state->csis_fmt->data_type); mipi_csis_write(state, MIPI_CSIS_ISP_CONFIG_CH(0), val); From patchwork Fri Feb 18 18:34:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12751743 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 77EA8C433F5 for ; Fri, 18 Feb 2022 18:37:35 +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:References:In-Reply-To: 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: List-Owner; bh=hHe34sNm5I3dyyRracCnPQNH7ds6IIQanDdyyv2BCOE=; b=ccMdEk91epYLwf So6WsQcvVskh4VjBR3D8GIsOQMWrD4GF+SWwWsw+mDLJcsidltQGAZfRgs8mjAm7hUnp4Je8DQZoG 9zP3CXa3FLqucnfNyEyqSYlnaoSOpUUXL1KWwkkuIX1LKnmMHVz1j4NMKKR32+NKr4dfo/xh/85kd ZVdBXUA9ycOaFymBCFt4fFW1hFDtpxjpptExw1Ui6WvvmhYAs6syVoANlZ5U/zi+/VFexNporyDUC aEq0funUhVvWT5aVAz0qaNAcATFV+XVCakjmBNl2x/wDYjUXzb8ziomZobZXhxZXVuCAAxx1ugzTk Xh/SYefyekUliSBk6bTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL87K-00FWIn-J3; Fri, 18 Feb 2022 18:36:30 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86h-00FW22-4Z for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 18:35:52 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id C9B9840008; Fri, 18 Feb 2022 18:35:46 +0000 (UTC) From: Jacopo Mondi To: slongerbeam@gmail.com, p.zabel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, martin.kepplinger@puri.sm, rmfrfs@gmail.com, xavier.roumegue@oss.nxp.com, alexander.stein@ew.tq-group.com, dorota.czaplejewicz@puri.sm Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Jacopo Mondi Subject: [PATCH v2 5/7] media: imx: imx-mipi-csis: Add RGB565_1X16 Date: Fri, 18 Feb 2022 19:34:19 +0100 Message-Id: <20220218183421.583874-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220218183421.583874-1-jacopo@jmondi.org> References: <20220218183421.583874-1-jacopo@jmondi.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_103551_381236_22CAC6C3 X-CRM114-Status: UNSURE ( 7.79 ) X-CRM114-Notice: Please train this message. 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 Add RGB565_1X16 to the enumeration of supported image formats. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/platform/imx/imx-mipi-csis.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c index 86e7ea3713d9..c7a771e3fdf3 100644 --- a/drivers/media/platform/imx/imx-mipi-csis.c +++ b/drivers/media/platform/imx/imx-mipi-csis.c @@ -360,6 +360,12 @@ static const struct csis_pix_format mipi_csis_formats[] = { .data_type = MIPI_CSI2_DATA_TYPE_YUV422_8, .width = 16, }, + /* RGB formats. */ + { + .code = MEDIA_BUS_FMT_RGB565_1X16, + .data_type = MIPI_CSI2_DATA_TYPE_RGB565, + .width = 16, + }, /* RAW (Bayer and greyscale) formats. */ { .code = MEDIA_BUS_FMT_SBGGR8_1X8, From patchwork Fri Feb 18 18:34:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12751744 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 84862C433FE for ; Fri, 18 Feb 2022 18:37:49 +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:References:In-Reply-To: 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: List-Owner; bh=WjkhDqnSusc39fp8qPhNXdZM4zwpomv4ilZquKmosfM=; b=Zz4xnc7j/CFk4X cykZmhkGbOBg5HG1NL5+w/W964M6OYP0uiP73o4QKXdxfyiXJdqCbrshH4tHuzhlra3rC/Enig7pO MB/2HwzEh3kC2vse8B0Do+Gr+VG1Qg9O9GyRVMV29erMpOtQA3esQuOxFXeiwdTE3lePeV+9gL4c4 wXzqzLCQfyrrRqfQReLBVls4m2rPrrobCweqCXF46f6Xq1XHJ9SvhpY6iPJV8kdy/PfhFQo2X3WYh 5k/IwwUZwI/bnAFMePLZbgptb3n0dseSz0L2sovmXyFSeYqJ35XGGY33ctqBE/PPHNy0tXkYccFdi SYdHDDfl/PHEbEloa3uQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL87W-00FWO0-EC; Fri, 18 Feb 2022 18:36:42 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86m-00FW55-9t for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 18:35:57 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id CCF7840005; Fri, 18 Feb 2022 18:35:49 +0000 (UTC) From: Jacopo Mondi To: slongerbeam@gmail.com, p.zabel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, martin.kepplinger@puri.sm, rmfrfs@gmail.com, xavier.roumegue@oss.nxp.com, alexander.stein@ew.tq-group.com, dorota.czaplejewicz@puri.sm Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Jacopo Mondi Subject: [PATCH v2 6/7] media: imx: imx-mipi-csis: Add BGR888 Date: Fri, 18 Feb 2022 19:34:20 +0100 Message-Id: <20220218183421.583874-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220218183421.583874-1-jacopo@jmondi.org> References: <20220218183421.583874-1-jacopo@jmondi.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_103556_544016_17B2074B X-CRM114-Status: UNSURE ( 8.87 ) X-CRM114-Notice: Please train this message. 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 Add support for the BGR888_1X24 image formats. The BGR888 format definition matches how pixel components are sent on the wire according to the CSI-2 specification. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/platform/imx/imx-mipi-csis.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c index c7a771e3fdf3..fdf133f81c5b 100644 --- a/drivers/media/platform/imx/imx-mipi-csis.c +++ b/drivers/media/platform/imx/imx-mipi-csis.c @@ -366,6 +366,11 @@ static const struct csis_pix_format mipi_csis_formats[] = { .data_type = MIPI_CSI2_DATA_TYPE_RGB565, .width = 16, }, + { + .code = MEDIA_BUS_FMT_BGR888_1X24, + .data_type = MIPI_CSI2_DATA_TYPE_RGB888, + .width = 24, + }, /* RAW (Bayer and greyscale) formats. */ { .code = MEDIA_BUS_FMT_SBGGR8_1X8, From patchwork Fri Feb 18 18:34:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12751745 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 1ACF9C433EF for ; Fri, 18 Feb 2022 18:38:05 +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:References:In-Reply-To: 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: List-Owner; bh=QOxUV/PPA5BD02enSCro9EZwcybJoB0bjJx3i4D6zA8=; b=b/LLX9AbVRdnWU QHeHS+i3Y+qwmfsIZUkO+vLcupUbPRo9hrqYOcXIz6zS/KPXofQkrQHhRJFzPR2Ve6OtIKM4DTmLB I76p9iRkH1CnQRCZbA/t0F4r4dCAzNojfYHxC3VGV2W9Dpd+DaJ+gFqeC3XuhBJuGoXXDpyO0c5S/ LGSCCALflIePeTrd2bx45cMJ5auwegG8/SY48z4WZLyf4GV4/6S9sCdPQ91fhZapLelTWQM+1GpRM fKiIt63zMOPZjeLCjhP3cjFbtrsaezJHpcE1LgXXBTm6ofUhmy8RYri3rcedeMGz7nOqp2jXzCF3X viein1kMUiqan0FdSMqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL87k-00FWVj-Au; Fri, 18 Feb 2022 18:36:56 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL86p-00FW6k-8k for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 18:36:01 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 0106540002; Fri, 18 Feb 2022 18:35:54 +0000 (UTC) From: Jacopo Mondi To: slongerbeam@gmail.com, p.zabel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, martin.kepplinger@puri.sm, rmfrfs@gmail.com, xavier.roumegue@oss.nxp.com, alexander.stein@ew.tq-group.com, dorota.czaplejewicz@puri.sm Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Jacopo Mondi Subject: [PATCH v2 7/7] media: imx: imx-mipi-csis: Add output format Date: Fri, 18 Feb 2022 19:34:21 +0100 Message-Id: <20220218183421.583874-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220218183421.583874-1-jacopo@jmondi.org> References: <20220218183421.583874-1-jacopo@jmondi.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_103559_639455_05C7634B X-CRM114-Status: GOOD ( 14.46 ) 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 Due to how pixel components are transmitted on the CSI-2 serial bus and how they are stored in memory by the CSI-2 receiver, the component ordering might change and the image formats on the sink and source pads of the receiver should reflect it. For RGB24, in example, the component ordering on the wire as described by the CSI-2 specification matches the BGR888 format, while once stored in in memory by the CSIS receiver they match the RGB888 format. Add an additional .output field to struct csis_pix_format to allow propagating the correct format to the source pad after a format configuration on the sink. The change is only relevant for RGB24 but paves the way for further format translations in future. Signed-off-by: Jacopo Mondi --- drivers/media/platform/imx/imx-mipi-csis.c | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c index fdf133f81c5b..128f4180d1e9 100644 --- a/drivers/media/platform/imx/imx-mipi-csis.c +++ b/drivers/media/platform/imx/imx-mipi-csis.c @@ -351,6 +351,7 @@ struct csis_pix_format { u32 code; u32 data_type; u8 width; + u32 output; }; static const struct csis_pix_format mipi_csis_formats[] = { @@ -359,95 +360,117 @@ static const struct csis_pix_format mipi_csis_formats[] = { .code = MEDIA_BUS_FMT_UYVY8_1X16, .data_type = MIPI_CSI2_DATA_TYPE_YUV422_8, .width = 16, + .output = MEDIA_BUS_FMT_UYVY8_1X16, }, /* RGB formats. */ { .code = MEDIA_BUS_FMT_RGB565_1X16, .data_type = MIPI_CSI2_DATA_TYPE_RGB565, .width = 16, + .output = MEDIA_BUS_FMT_RGB565_1X16, }, { .code = MEDIA_BUS_FMT_BGR888_1X24, .data_type = MIPI_CSI2_DATA_TYPE_RGB888, .width = 24, + .output = MEDIA_BUS_FMT_RGB888_1X24, }, /* RAW (Bayer and greyscale) formats. */ { .code = MEDIA_BUS_FMT_SBGGR8_1X8, .data_type = MIPI_CSI2_DATA_TYPE_RAW8, .width = 8, + .output = MEDIA_BUS_FMT_SBGGR8_1X8, }, { .code = MEDIA_BUS_FMT_SGBRG8_1X8, .data_type = MIPI_CSI2_DATA_TYPE_RAW8, .width = 8, + .output = MEDIA_BUS_FMT_SGBRG8_1X8, }, { .code = MEDIA_BUS_FMT_SGRBG8_1X8, .data_type = MIPI_CSI2_DATA_TYPE_RAW8, .width = 8, + .output = MEDIA_BUS_FMT_SGRBG8_1X8, }, { .code = MEDIA_BUS_FMT_SRGGB8_1X8, .data_type = MIPI_CSI2_DATA_TYPE_RAW8, .width = 8, + .output = MEDIA_BUS_FMT_SRGGB8_1X8, }, { .code = MEDIA_BUS_FMT_Y8_1X8, .data_type = MIPI_CSI2_DATA_TYPE_RAW8, .width = 8, + .output = MEDIA_BUS_FMT_Y8_1X8, }, { .code = MEDIA_BUS_FMT_SBGGR10_1X10, .data_type = MIPI_CSI2_DATA_TYPE_RAW10, .width = 10, + .output = MEDIA_BUS_FMT_SBGGR10_1X10, }, { .code = MEDIA_BUS_FMT_SGBRG10_1X10, .data_type = MIPI_CSI2_DATA_TYPE_RAW10, .width = 10, + .output = MEDIA_BUS_FMT_SGBRG10_1X10, }, { .code = MEDIA_BUS_FMT_SGRBG10_1X10, .data_type = MIPI_CSI2_DATA_TYPE_RAW10, .width = 10, + .output = MEDIA_BUS_FMT_SGRBG10_1X10, }, { .code = MEDIA_BUS_FMT_SRGGB10_1X10, .data_type = MIPI_CSI2_DATA_TYPE_RAW10, .width = 10, + .output = MEDIA_BUS_FMT_SRGGB10_1X10, }, { .code = MEDIA_BUS_FMT_Y10_1X10, .data_type = MIPI_CSI2_DATA_TYPE_RAW10, .width = 10, + .output = MEDIA_BUS_FMT_Y10_1X10, }, { .code = MEDIA_BUS_FMT_SBGGR12_1X12, .data_type = MIPI_CSI2_DATA_TYPE_RAW12, .width = 12, + .output = MEDIA_BUS_FMT_SBGGR12_1X12, }, { .code = MEDIA_BUS_FMT_SGBRG12_1X12, .data_type = MIPI_CSI2_DATA_TYPE_RAW12, .width = 12, + .output = MEDIA_BUS_FMT_SGBRG12_1X12, }, { .code = MEDIA_BUS_FMT_SGRBG12_1X12, .data_type = MIPI_CSI2_DATA_TYPE_RAW12, .width = 12, + .output = MEDIA_BUS_FMT_SGRBG12_1X12, }, { .code = MEDIA_BUS_FMT_SRGGB12_1X12, .data_type = MIPI_CSI2_DATA_TYPE_RAW12, .width = 12, + .output = MEDIA_BUS_FMT_SRGGB12_1X12, }, { .code = MEDIA_BUS_FMT_Y12_1X12, .data_type = MIPI_CSI2_DATA_TYPE_RAW12, .width = 12, + .output = MEDIA_BUS_FMT_Y12_1X12, }, { .code = MEDIA_BUS_FMT_SBGGR14_1X14, .data_type = MIPI_CSI2_DATA_TYPE_RAW14, .width = 14, + .output = MEDIA_BUS_FMT_SBGGR14_1X14, }, { .code = MEDIA_BUS_FMT_SGBRG14_1X14, .data_type = MIPI_CSI2_DATA_TYPE_RAW14, .width = 14, + .output = MEDIA_BUS_FMT_SGBRG14_1X14, }, { .code = MEDIA_BUS_FMT_SGRBG14_1X14, .data_type = MIPI_CSI2_DATA_TYPE_RAW14, .width = 14, + .output = MEDIA_BUS_FMT_SGRBG14_1X14, }, { .code = MEDIA_BUS_FMT_SRGGB14_1X14, .data_type = MIPI_CSI2_DATA_TYPE_RAW14, .width = 14, + .output = MEDIA_BUS_FMT_SRGGB14_1X14, } }; @@ -1090,7 +1113,11 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd, /* Propagate the format from sink to source. */ fmt = mipi_csis_get_format(state, sd_state, sdformat->which, CSIS_PAD_SOURCE); - *fmt = sdformat->format; + + /* The format on the source pad might change due to unpacking. */ + fmt->code = csis_fmt->output; + fmt->width = sdformat->format.width; + fmt->height = sdformat->format.height; /* Store the CSIS format descriptor for active formats. */ if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE)