From patchwork Wed Mar 9 10:04:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12774885 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 10052C433F5 for ; Wed, 9 Mar 2022 10:06:33 +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=eTUbHe3OlKABmxCf/B/4q+UDKxz3JMIUyUHHVNJEoEA=; b=RwukNcGd/nEsma W6gF6ZhjzQZng9CjS1DuOkwj2bLCvtxE1WH5pW+jPsmO7/GH4vbE8wyXw96zwusnBw2947oiw3CLK yRu5FDkx9l29ukTswfx1Z24LRNyUDjY3c/O6kdJdgqKabvxdVmPVqi8wFqLBsRrk5TMxUDqAago8c Jhzq9OSmRDWi3IeyEY2wnlYtYMKCZz+jzgvtXsxeYxAXFl1WHfURzRC/r+tNRHtgVAUHcCsYZH0hM JJ9lxWPIacT4nXneWbHG2UeF83S844Q3QSrGbm7rFaIHh8avrLpjgvORk7J6OcZdBcgmzw1q0aod0 fdRgtrb6IKCZ2a2x35qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRtC1-008450-Gv; Wed, 09 Mar 2022 10:05:18 +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 1nRtBq-00840f-PD for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 10:05:08 +0000 Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 97CE840003; Wed, 9 Mar 2022 10:04:59 +0000 (UTC) From: Jacopo Mondi To: Hans Verkuil , Laurent Pinchart , Rui Miguel Silva Cc: Jacopo Mondi , "Xavier Roumegue (OSS)" , Sakari Ailus , Mauro Carvalho Chehab , Pengutronix Kernel Team , NXP Linux Team , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH] media: imx: imx-mipi-csis: Add support for JPEG_1X8 Date: Wed, 9 Mar 2022 11:04:48 +0100 Message-Id: <20220309100448.9749-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_020507_029106_6DBC868C X-CRM114-Status: GOOD ( 15.49 ) 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 MEDIA_BUS_FMT_JPEG_1X8 media bus code to the CSIS driver. The MEDIA_BUS_FMT_JPEG_1X8 code is mapped tot the RAW8 CSI-2 Data Type, while the CSI-2 specification suggests to use User Defined Data Type 1. As reported in the comment, the CSIS interface captures arbitrary Data Types by using a pixel sampling mode not supported by the IP core connected to it on i.MX SoCs. As some sensors, such as OV5640, support sending JPEG data on the RAW8 Data Type and capture operations work correcty with such configuration, map MEDIA_BUS_FMT_JPEG_1X8 to Data Type 0x2a. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- Based on Hans' br-v5.18s where the CSIS patches have been collected --- drivers/media/platform/imx/imx-mipi-csis.c | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 2.35.1 diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c index 0a72734db55e..3731748de18b 100644 --- a/drivers/media/platform/imx/imx-mipi-csis.c +++ b/drivers/media/platform/imx/imx-mipi-csis.c @@ -470,6 +470,34 @@ static const struct csis_pix_format mipi_csis_formats[] = { .output = MEDIA_BUS_FMT_SRGGB14_1X14, .data_type = MIPI_CSI2_DATA_TYPE_RAW14, .width = 14, + }, + /* JPEG */ + { + .code = MEDIA_BUS_FMT_JPEG_1X8, + .output = MEDIA_BUS_FMT_JPEG_1X8, + /* + * Map JPEG_1X8 on the RAW8 datatype. + * + * The CSI-2 specification suggests in Annex A "JPEG8 Data + * Format (informative)" to transmit JPEG data using one of the + * Data Types aimed to represent arbitrary data, such as the + * "User Defined Data Type 1" (0x30). + * + * However, when configured with a User Defined Data Type, the + * CSIS outputs data in quad pixel mode regardless of the mode + * selected in the MIPI_CSIS_ISP_CONFIG_CH register. Neither of + * the IP cores connected to the CSIS in i.MX SoCs (CSI bridge + * or ISI) support quad pixel mode, so this will never work in + * practice. + * + * Some sensors (such as the OV5640) send JPEG data using the + * RAW8 data type. This is usable and works, so map the JPEG + * format to RAW8. If the CSIS ends up being integrated in an + * SoC that can support quad pixel mode, this will have to be + * revisited. + */ + .data_type = MIPI_CSI2_DATA_TYPE_RAW8, + .width = 8, } };