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; } }