From patchwork Mon Feb 14 18:43: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: 12746000 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 5D1CCC433EF for ; Mon, 14 Feb 2022 18:44:43 +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=onn4bbzsQH3KDgZgEJNtfsnCmKDskN18D936zHqIVvw=; b=qskubm/uJRAtds CHYkPSTlw+Yj034WIGE5skHOOd0Cn+D6+v8uT34gmFGQGnlm7SPD9FPNuzTH2lPIY7nPIXzC3c4Qv nKlyiXVFGEGEVTXDssufAflMIONpoycGRzGCvG1ssbpcEYgFcai7ELCp3WXCUCjHtUM4YBaX/ne4Z gvDujIIuCagzV1Kr2wL8xOwtpG4hN8hxMTxXcitHhJvgr+uLyGDf84Oy7tuT9uutEW89hjN8Krc8k eeArGSRERADxfWpNZh/+ixACaaXsp4yBm9hXiTQxy4wj7J8GScveVG/A9DcQaJondvAZA4skc/4rW OQNhB/2LJSQ4MqfAoigg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJgJy-00GZUl-JC; Mon, 14 Feb 2022 18:43:34 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJgJ6-00GZ1x-TU for linux-arm-kernel@lists.infradead.org; Mon, 14 Feb 2022 18:42:43 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 7E34A1C0008; Mon, 14 Feb 2022 18:42:35 +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 5/8] staging: media: imx: Use DUAL pixel mode if available Date: Mon, 14 Feb 2022 19:43:15 +0100 Message-Id: <20220214184318.409208-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220214184318.409208-1-jacopo@jmondi.org> References: <20220214184318.409208-1-jacopo@jmondi.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220214_104241_180145_68803572 X-CRM114-Status: GOOD ( 14.29 ) 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 pixel sampling mode controls the size of data sampled from the CSI Rx queue. The supported sample size depends on the configuration of the preceding block in the capture pipeline and is then dependent on the SoC version the CSI peripheral is integrated on. When capturing YUV422 data if dual sample mode is available use it. This change is particularly relevant for the IMX8MM SoC which uses the CSIS CSI-2 receiver which operates in dual pixel mode. Other SoCs should be unaffected by this change and should continue to operate as before. Signed-off-by: Xavier Roumegue Signed-off-by: Jacopo Mondi --- drivers/staging/media/imx/imx7-media-csi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 112096774961..a8bdfb0bb0ee 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -426,6 +426,7 @@ static void imx7_csi_configure(struct imx7_csi *csi) { struct imx_media_video_dev *vdev = csi->vdev; struct v4l2_pix_format *out_pix = &vdev->fmt; + struct imx_media_dev *imxmd = csi->imxmd; int width = out_pix->width; u32 stride = 0; u32 cr3 = BIT_FRMCNT_RST; @@ -436,7 +437,7 @@ static void imx7_csi_configure(struct imx7_csi *csi) cr18 &= ~(BIT_CSI_HW_ENABLE | BIT_MIPI_DATA_FORMAT_MASK | BIT_DATA_FROM_MIPI | BIT_BASEADDR_CHG_ERR_EN | BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL | - BIT_DEINTERLACE_EN); + BIT_DEINTERLACE_EN | BIT_MIPI_DOUBLE_CMPNT); if (out_pix->field == V4L2_FIELD_INTERLACED) { cr18 |= BIT_DEINTERLACE_EN; @@ -500,6 +501,13 @@ static void imx7_csi_configure(struct imx7_csi *csi) case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YUYV8_1X16: cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B; + + /* If dual mode is supported use it. */ + if (imxmd->info->sample_modes & MODE_DUAL) { + cr18 |= BIT_MIPI_DOUBLE_CMPNT; + cr3 |= BIT_TWO_8BIT_SENSOR; + } + break; } }