linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: Rui Miguel Silva <rmfrfs@gmail.com>,
	Steve Longerbeam <slongerbeam@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Jacopo Mondi <jacopo@jmondi.org>,
	Martin Kepplinger <martin.kepplinger@puri.sm>,
	Alexander Stein <alexander.stein@ew.tq-group.com>,
	Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>,
	kernel@pengutronix.de
Subject: [PATCH 36/50] staging: media: imx: imx7-media-csi: Drop IPU-only formats
Date: Tue, 10 May 2022 14:58:45 +0300	[thread overview]
Message-ID: <20220510115859.19777-37-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20220510115859.19777-1-laurent.pinchart@ideasonboard.com>

The formats specific to the IPUv3 are not supported by the CSI bridge.
Drop them, along with the related code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx7-media-csi.c | 98 ++--------------------
 1 file changed, 6 insertions(+), 92 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index c8ff259452b1..17259922a082 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -188,7 +188,6 @@ struct imx7_csi_pixfmt {
 	bool	yuv;
 	bool    planar;  /* is a planar format */
 	bool    bayer;   /* is a raw bayer format */
-	bool    ipufmt;  /* is one of the IPU internal formats */
 };
 
 struct imx7_csi_vb2_buffer {
@@ -811,7 +810,6 @@ enum imx7_csi_pixfmt_sel {
 	IMX7_CSI_PIXFMT_SEL_YUV   = BIT(0), /* select YUV formats */
 	IMX7_CSI_PIXFMT_SEL_RGB   = BIT(1), /* select RGB formats */
 	IMX7_CSI_PIXFMT_SEL_BAYER = BIT(2), /* select BAYER formats */
-	IMX7_CSI_PIXFMT_SEL_IPU   = BIT(3), /* select IPU-internal formats */
 	IMX7_CSI_PIXFMT_SEL_YUV_RGB = IMX7_CSI_PIXFMT_SEL_YUV
 				    | IMX7_CSI_PIXFMT_SEL_RGB,
 	IMX7_CSI_PIXFMT_SEL_ANY = IMX7_CSI_PIXFMT_SEL_YUV
@@ -865,12 +863,6 @@ static const struct imx7_csi_pixfmt pixel_formats[] = {
 		.yuv	= true,
 		.bpp    = 16,
 		.planar = true,
-	}, {
-		.fourcc = V4L2_PIX_FMT_YUV32,
-		.codes  = IMX_BUS_FMTS(MEDIA_BUS_FMT_AYUV8_1X32),
-		.yuv	= true,
-		.bpp    = 32,
-		.ipufmt = true,
 	},
 	/*** RGB formats start here ***/
 	{
@@ -892,11 +884,6 @@ static const struct imx7_csi_pixfmt pixel_formats[] = {
 		.fourcc	= V4L2_PIX_FMT_XRGB32,
 		.codes  = IMX_BUS_FMTS(MEDIA_BUS_FMT_ARGB8888_1X32),
 		.bpp    = 32,
-	}, {
-		.fourcc	= V4L2_PIX_FMT_XRGB32,
-		.codes  = IMX_BUS_FMTS(MEDIA_BUS_FMT_ARGB8888_1X32),
-		.bpp    = 32,
-		.ipufmt = true,
 	}, {
 		.fourcc	= V4L2_PIX_FMT_XBGR32,
 		.bpp    = 32,
@@ -1000,18 +987,12 @@ static const struct imx7_csi_pixfmt pixel_formats[] = {
 static const struct imx7_csi_pixfmt *
 imx7_csi_find_pixel_format(u32 fourcc, enum imx7_csi_pixfmt_sel fmt_sel)
 {
-	bool sel_ipu = fmt_sel & IMX7_CSI_PIXFMT_SEL_IPU;
 	unsigned int i;
 
-	fmt_sel &= ~IMX7_CSI_PIXFMT_SEL_IPU;
-
 	for (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {
 		const struct imx7_csi_pixfmt *fmt = &pixel_formats[i];
 		enum imx7_csi_pixfmt_sel sel;
 
-		if (sel_ipu != fmt->ipufmt)
-			continue;
-
 		sel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER
 		    : (fmt->yuv ? IMX7_CSI_PIXFMT_SEL_YUV :
 		       IMX7_CSI_PIXFMT_SEL_RGB);
@@ -1033,19 +1014,13 @@ imx7_csi_find_pixel_format(u32 fourcc, enum imx7_csi_pixfmt_sel fmt_sel)
 static const struct imx7_csi_pixfmt *
 imx7_csi_find_mbus_format(u32 code, enum imx7_csi_pixfmt_sel fmt_sel)
 {
-	bool sel_ipu = fmt_sel & IMX7_CSI_PIXFMT_SEL_IPU;
 	unsigned int i;
 
-	fmt_sel &= ~IMX7_CSI_PIXFMT_SEL_IPU;
-
 	for (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {
 		const struct imx7_csi_pixfmt *fmt = &pixel_formats[i];
 		enum imx7_csi_pixfmt_sel sel;
 		unsigned int j;
 
-		if (sel_ipu != fmt->ipufmt)
-			continue;
-
 		sel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER
 		    : (fmt->yuv ? IMX7_CSI_PIXFMT_SEL_YUV :
 		       IMX7_CSI_PIXFMT_SEL_RGB);
@@ -1062,12 +1037,6 @@ imx7_csi_find_mbus_format(u32 code, enum imx7_csi_pixfmt_sel fmt_sel)
 	return NULL;
 }
 
-static inline const struct imx7_csi_pixfmt *
-imx7_csi_find_ipu_format(u32 code, enum imx7_csi_pixfmt_sel fmt_sel)
-{
-	return imx7_csi_find_mbus_format(code, fmt_sel | IMX7_CSI_PIXFMT_SEL_IPU);
-}
-
 /*
  * Enumerate entries in the pixel_formats[] array that match the
  * requested selection criteria. Return the fourcc that matches the
@@ -1085,18 +1054,12 @@ static int imx7_csi_enum_pixel_formats(u32 *fourcc, u32 index,
 				       enum imx7_csi_pixfmt_sel fmt_sel,
 				       u32 code)
 {
-	bool sel_ipu = fmt_sel & IMX7_CSI_PIXFMT_SEL_IPU;
 	unsigned int i;
 
-	fmt_sel &= ~IMX7_CSI_PIXFMT_SEL_IPU;
-
 	for (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {
 		const struct imx7_csi_pixfmt *fmt = &pixel_formats[i];
 		enum imx7_csi_pixfmt_sel sel;
 
-		if (sel_ipu != fmt->ipufmt)
-			continue;
-
 		sel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER
 		    : (fmt->yuv ? IMX7_CSI_PIXFMT_SEL_YUV :
 		       IMX7_CSI_PIXFMT_SEL_RGB);
@@ -1148,19 +1111,13 @@ static int imx7_csi_enum_pixel_formats(u32 *fourcc, u32 index,
 static int imx7_csi_enum_mbus_formats(u32 *code, u32 index,
 				      enum imx7_csi_pixfmt_sel fmt_sel)
 {
-	bool sel_ipu = fmt_sel & IMX7_CSI_PIXFMT_SEL_IPU;
 	unsigned int i;
 
-	fmt_sel &= ~IMX7_CSI_PIXFMT_SEL_IPU;
-
 	for (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {
 		const struct imx7_csi_pixfmt *fmt = &pixel_formats[i];
 		enum imx7_csi_pixfmt_sel sel;
 		unsigned int j;
 
-		if (sel_ipu != fmt->ipufmt)
-			continue;
-
 		sel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER
 		    : (fmt->yuv ? IMX7_CSI_PIXFMT_SEL_YUV :
 		       IMX7_CSI_PIXFMT_SEL_RGB);
@@ -1195,11 +1152,8 @@ static int imx7_csi_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus,
 		imx7_csi_enum_mbus_formats(&code, 0, IMX7_CSI_PIXFMT_SEL_YUV);
 
 	lcc = imx7_csi_find_mbus_format(code, IMX7_CSI_PIXFMT_SEL_ANY);
-	if (!lcc) {
-		lcc = imx7_csi_find_ipu_format(code, IMX7_CSI_PIXFMT_SEL_YUV_RGB);
-		if (!lcc)
-			return -EINVAL;
-	}
+	if (!lcc)
+		return -EINVAL;
 
 	mbus->code = code;
 
@@ -1225,26 +1179,12 @@ static int imx7_csi_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
 	u32 stride;
 
 	if (!cc) {
-		cc = imx7_csi_find_ipu_format(mbus->code,
-					      IMX7_CSI_PIXFMT_SEL_YUV_RGB);
-		if (!cc)
-			cc = imx7_csi_find_mbus_format(mbus->code,
-						       IMX7_CSI_PIXFMT_SEL_ANY);
+		cc = imx7_csi_find_mbus_format(mbus->code,
+					       IMX7_CSI_PIXFMT_SEL_ANY);
 		if (!cc)
 			return -EINVAL;
 	}
 
-	/*
-	 * TODO: the IPU currently does not support the AYUV32 format,
-	 * so until it does convert to a supported YUV format.
-	 */
-	if (cc->ipufmt && cc->yuv) {
-		u32 code;
-
-		imx7_csi_enum_mbus_formats(&code, 0, IMX7_CSI_PIXFMT_SEL_YUV);
-		cc = imx7_csi_find_mbus_format(code, IMX7_CSI_PIXFMT_SEL_YUV);
-	}
-
 	/* Round up width for minimum burst size */
 	width = round_up(mbus->width, 8);
 
@@ -1273,29 +1213,6 @@ static int imx7_csi_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
  * Video Capture Device - IOCTLs
  */
 
-static const struct imx7_csi_pixfmt *
-imx7_csi_video_find_format(u32 code, u32 fourcc)
-{
-	const struct imx7_csi_pixfmt *cc;
-
-	cc = imx7_csi_find_ipu_format(code, IMX7_CSI_PIXFMT_SEL_YUV_RGB);
-	if (cc) {
-		enum imx7_csi_pixfmt_sel fmt_sel = cc->yuv
-						 ? IMX7_CSI_PIXFMT_SEL_YUV
-						 : IMX7_CSI_PIXFMT_SEL_RGB;
-
-		cc = imx7_csi_find_pixel_format(fourcc, fmt_sel);
-		if (!cc) {
-			imx7_csi_enum_pixel_formats(&fourcc, 0, fmt_sel, 0);
-			cc = imx7_csi_find_pixel_format(fourcc, fmt_sel);
-		}
-
-		return cc;
-	}
-
-	return imx7_csi_find_mbus_format(code, IMX7_CSI_PIXFMT_SEL_ANY);
-}
-
 static int imx7_csi_video_querycap(struct file *file, void *fh,
 				   struct v4l2_capability *cap)
 {
@@ -1598,7 +1515,8 @@ static int imx7_csi_video_validate_fmt(struct imx7_csi *csi)
 	 * Verify that the media bus code is compatible with the pixel format
 	 * set on the video node.
 	 */
-	cc = imx7_csi_video_find_format(fmt_src.format.code, 0);
+	cc = imx7_csi_find_mbus_format(fmt_src.format.code,
+				       IMX7_CSI_PIXFMT_SEL_ANY);
 	if (!cc || csi->vdev_cc->yuv != cc->yuv)
 		return -EPIPE;
 
@@ -2038,10 +1956,6 @@ static void imx7_csi_try_colorimetry(struct v4l2_mbus_framefmt *tryfmt)
 	bool is_rgb = false;
 
 	cc = imx7_csi_find_mbus_format(tryfmt->code, IMX7_CSI_PIXFMT_SEL_ANY);
-	if (!cc)
-		cc = imx7_csi_find_ipu_format(tryfmt->code,
-					      IMX7_CSI_PIXFMT_SEL_YUV_RGB);
-
 	if (cc && !cc->yuv)
 		is_rgb = true;
 
-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2022-05-10 12:00 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 11:58 [PATCH 00/50] staging: media: imx: Prepare destaging of imx7-media-csi Laurent Pinchart
2022-05-10 11:58 ` [PATCH 01/50] staging: media: imx: imx7-media-csi: Initialize locks early on Laurent Pinchart
2022-05-10 11:58 ` [PATCH 02/50] staging: media: imx: imx7-media-csi: Split imx_media_dev from probe() Laurent Pinchart
2022-05-10 14:09   ` Rui Miguel Silva
2022-05-10 14:42     ` Laurent Pinchart
2022-05-10 15:25   ` [PATCH v1.1 " Laurent Pinchart
2022-05-10 15:49     ` Rui Miguel Silva
2022-05-10 11:58 ` [PATCH 03/50] staging: media: imx: imx7-media-csi: Import notifier helpers Laurent Pinchart
2022-05-10 11:58 ` [PATCH 04/50] staging: media: imx: imx7-media-csi: Drop duplicate link creation Laurent Pinchart
2022-05-10 11:58 ` [PATCH 05/50] staging: media: imx: imx7-media-csi: Drop the imx_media notifier Laurent Pinchart
2022-05-10 11:58 ` [PATCH 06/50] staging: media: imx: imx7-media-csi: Move misc init out of probe() Laurent Pinchart
2022-05-10 15:26   ` [PATCH v1.1 " Laurent Pinchart
2022-05-10 11:58 ` [PATCH 07/50] staging: media: imx: imx7-media-csi: Don't populate vdev lists Laurent Pinchart
2022-05-10 11:58 ` [PATCH 08/50] staging: media: imx: imx7-media-csi: Drop unused frame_interval Laurent Pinchart
2022-05-10 11:58 ` [PATCH 09/50] staging: media: imx: imx7-media-csi: Move format init to probe time Laurent Pinchart
2022-05-10 11:58 ` [PATCH 10/50] staging: media: imx: imx7-media-csi: Remove imx_media_of_add_csi Laurent Pinchart
2022-05-10 11:58 ` [PATCH 11/50] staging: media: imx: imx7-media-csi: Import video device helpers Laurent Pinchart
2022-05-10 11:58 ` [PATCH 12/50] staging: media: imx: imx7-media-csi: Drop legacy video device support Laurent Pinchart
2022-05-10 11:58 ` [PATCH 13/50] staging: media: imx: imx7-media-csi: Drop unused controls support Laurent Pinchart
2022-05-10 11:58 ` [PATCH 14/50] staging: media: imx: imx7-media-csi: Reorganize imx7_csi structure Laurent Pinchart
2022-05-10 11:58 ` [PATCH 15/50] staging: media: imx: imx7-media-csi: Fold capture_priv into imx7_csi Laurent Pinchart
2022-05-10 11:58 ` [PATCH 16/50] staging: media: imx: imx7-media-csi: Ensure consistent function prefix Laurent Pinchart
2022-05-10 11:58 ` [PATCH 17/50] staging: media: imx: imx7-media-csi: Don't set subdev group id Laurent Pinchart
2022-05-10 11:58 ` [PATCH 18/50] staging: media: imx: imx7-media-csi: Import imx_media_dev_init() helper Laurent Pinchart
2022-05-10 11:58 ` [PATCH 19/50] staging: media: imx: imx7-media-csi: Embed imx_media_dev in imx7_csi Laurent Pinchart
2022-05-10 11:58 ` [PATCH 20/50] staging: media: imx: imx7-media-csi: Drop imx_media_add_video_device call Laurent Pinchart
2022-05-10 11:58 ` [PATCH 21/50] staging: media: imx: imx7-media-csi: Don't initialize unused fields Laurent Pinchart
2022-05-10 11:58 ` [PATCH 22/50] staging: media: imx: imx7-media-csi: Inline imx_media_pipeline_pad() Laurent Pinchart
2022-05-10 11:58 ` [PATCH 23/50] staging: media: imx: imx7-media-csi: Import imx_media_pipeline_set_stream() Laurent Pinchart
2022-05-10 11:58 ` [PATCH 24/50] staging: media: imx: imx7-media-csi: Avoid unnecessary casts Laurent Pinchart
2022-05-10 11:58 ` [PATCH 25/50] staging: media: imx: imx7-media-csi: Inline pipeline start/stop Laurent Pinchart
2022-05-10 11:58 ` [PATCH 26/50] staging: media: imx: imx7-media-csi: Fold imx_media_dev into imx7_csi Laurent Pinchart
2022-05-10 11:58 ` [PATCH 27/50] staging: media: imx: imx7-media-csi: Decouple from imx_media_buffer Laurent Pinchart
2022-05-10 11:58 ` [PATCH 28/50] staging: media: imx: imx7-media-csi: Fold imx_media_video_dev into imx7_csi Laurent Pinchart
2022-05-10 11:58 ` [PATCH 29/50] staging: media: imx: imx7-media-csi: Store imx7_csi in drv data Laurent Pinchart
2022-05-10 11:58 ` [PATCH 30/50] staging: media: imx: imx7-media-csi: Decouple from imx_media_dma_buf Laurent Pinchart
2022-05-10 11:58 ` [PATCH 31/50] staging: media: imx: imx7-media-csi: Decouple from shared macros Laurent Pinchart
2022-05-10 11:58 ` [PATCH 32/50] staging: media: imx: imx7-media-csi: Drop error message on alloc failure Laurent Pinchart
2022-05-10 11:58 ` [PATCH 33/50] staging: media: imx: imx7-media-csi: Import format helpers Laurent Pinchart
2022-05-10 11:58 ` [PATCH 34/50] staging: media: imx: imx7-media-csi: Replace ipu_color_space with bool yuv field Laurent Pinchart
2022-05-10 11:58 ` [PATCH 35/50] staging: media: imx: imx7-media-csi: Drop IC support from imx7_csi_try_colorimetry() Laurent Pinchart
2022-05-10 11:58 ` Laurent Pinchart [this message]
2022-05-10 11:58 ` [PATCH 37/50] staging: media: imx: imx7-media-csi: Drop unsupported YUV and RGB formats Laurent Pinchart
2022-05-10 11:58 ` [PATCH 38/50] staging: media: imx: imx7-media-csi: Make default formats consistent Laurent Pinchart
2022-05-10 11:58 ` [PATCH 39/50] staging: media: imx: imx7-media-csi: Define macro for default mbus code Laurent Pinchart
2022-05-11 13:22   ` Alexander Stein
2022-05-11 20:20     ` Laurent Pinchart
2022-07-07  0:19   ` [PATCH v1.1 " Laurent Pinchart
2022-05-10 11:58 ` [PATCH 40/50] staging: media: imx: imx7-media-csi: Simplify default mbus code in try_fmt Laurent Pinchart
2022-05-10 11:58 ` [PATCH 41/50] staging: media: imx: imx7-media-csi: Drop YUV/RGB/BAYER format selectors Laurent Pinchart
2022-05-10 11:58 ` [PATCH 42/50] staging: media: imx: imx7-media-csi: Drop unneeded imx7_csi_pixfmt fields Laurent Pinchart
2022-05-10 11:58 ` [PATCH 43/50] staging: media: imx: imx7-media-csi: Inline imx7_csi_init_mbus_fmt() Laurent Pinchart
2022-05-10 11:58 ` [PATCH 44/50] staging: media: imx: imx7-media-csi: Simplify default format in try_fmt Laurent Pinchart
2022-05-11 13:27   ` Alexander Stein
2022-07-07  0:20   ` [PATCH v1.1 " Laurent Pinchart
2022-05-10 11:58 ` [PATCH 45/50] staging: media: imx: imx7-media-csi: Fix list of supported formats Laurent Pinchart
2022-05-10 11:58 ` [PATCH 46/50] staging: media: imx: imx7-media-csi: Add V4L2_PIX_FMT_Y14 support Laurent Pinchart
2022-05-10 11:58 ` [PATCH 47/50] staging: media: imx: imx7-media-csi: Drop unneeded pixel format validation Laurent Pinchart
2022-05-10 11:58 ` [PATCH 48/50] staging: media: imx: imx7-media-csi: Inline imx7_csi_enum_pixel_formats() Laurent Pinchart
2022-05-10 11:58 ` [PATCH 49/50] staging: media: imx: imx7-media-csi: Drop V4L2 events support Laurent Pinchart
2022-05-10 11:58 ` [PATCH 50/50] staging: media: imx: imx7-media-csi: Drop usage of shared helpers Laurent Pinchart
2022-05-10 14:04 ` [PATCH 00/50] staging: media: imx: Prepare destaging of imx7-media-csi Rui Miguel Silva
2022-05-10 14:18   ` Laurent Pinchart
2022-05-11 13:36 ` (EXT) " Alexander Stein
2022-07-07  0:23   ` Laurent Pinchart
2022-07-07 10:45     ` Alexander Stein
2022-07-07 11:34       ` Laurent Pinchart
2022-07-07 11:52         ` Alexander Stein
2022-05-16  7:59 ` Alexander Stein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220510115859.19777-37-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=dorota.czaplejewicz@puri.sm \
    --cc=jacopo@jmondi.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=martin.kepplinger@puri.sm \
    --cc=p.zabel@pengutronix.de \
    --cc=rmfrfs@gmail.com \
    --cc=slongerbeam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).