mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 Frank Li <Frank.Li@nxp.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Loic Poulain <loic.poulain@oss.qualcomm.com>
Cc: linux-media@vger.kernel.org, imx@lists.linux.dev,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,  devicetree@vger.kernel.org,
	Guoniu Zhou <guoniu.zhou@oss.nxp.com>
Subject: [PATCH v4 04/11] media: imx8-isi: Reuse mxc_isi_format_enum() in capture format enumeration
Date: Tue, 29 Sep 2026 16:52:25 +0800	[thread overview]
Message-ID: <20260929-isi_imx952-v4-4-e69f89c7c651@oss.nxp.com> (raw)
In-Reply-To: <20260929-isi_imx952-v4-0-e69f89c7c651@oss.nxp.com>

Simplify mxc_isi_video_enum_fmt() by reusing mxc_isi_format_enum()
instead of open-coding the same format table traversal.

Signed-off-by: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
---
Changes in v4:
- New patch
---
 .../media/platform/nxp/imx8-isi/imx8-isi-video.c   | 30 +++-------------------
 1 file changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
index 0d87a1082727..21849af3121b 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
@@ -1231,34 +1231,10 @@ static int mxc_isi_video_enum_fmt(struct file *file, void *priv,
 				  struct v4l2_fmtdesc *f)
 {
 	const struct mxc_isi_format_info *fmt;
-	unsigned int index = f->index;
-	unsigned int i;
-
-	if (f->mbus_code) {
-		/*
-		 * If a media bus code is specified, only enumerate formats
-		 * compatible with it.
-		 */
-		for (i = 0; i < ARRAY_SIZE(mxc_isi_formats); i++) {
-			fmt = &mxc_isi_formats[i];
-			if (fmt->mbus_code != f->mbus_code)
-				continue;
-
-			if (index == 0)
-				break;
-
-			index--;
-		}
 
-		if (i == ARRAY_SIZE(mxc_isi_formats))
-			return -EINVAL;
-	} else {
-		/* Otherwise, enumerate all formatS. */
-		if (f->index >= ARRAY_SIZE(mxc_isi_formats))
-			return -EINVAL;
-
-		fmt = &mxc_isi_formats[f->index];
-	}
+	fmt = mxc_isi_format_enum(f, MXC_ISI_VIDEO_CAP);
+	if (!fmt)
+		return -EINVAL;
 
 	f->pixelformat = fmt->fourcc;
 	f->flags |= V4L2_FMT_FLAG_CSC_COLORSPACE | V4L2_FMT_FLAG_CSC_YCBCR_ENC

-- 
2.34.1


  parent reply	other threads:[~2026-09-29  8:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  8:52 [PATCH v4 00/11] media: imx8-isi: Add i.MX952 ISI support Guoniu Zhou
2026-09-29  8:52 ` [PATCH v4 01/11] media: imx8-isi: Reorder mxc_imx95_data to follow mxc_imx93_data Guoniu Zhou
2026-09-29  8:52 ` [PATCH v4 02/11] media: imx8-isi: Extend output format mask to 7 bits Guoniu Zhou
2026-09-29 14:20   ` Frank Li
2026-09-29  8:52 ` [PATCH v4 03/11] media: imx8-isi: Support mbus_code filtering in format enumeration Guoniu Zhou
2026-09-29 14:22   ` Frank Li
2026-09-29  8:52 ` Guoniu Zhou [this message]
2026-09-29 14:23   ` [PATCH v4 04/11] media: imx8-isi: Reuse mxc_isi_format_enum() in capture " Frank Li
2026-09-29  8:52 ` [PATCH v4 05/11] media: imx8-isi: Apply RAW output format workaround at runtime Guoniu Zhou
2026-09-29 14:26   ` Frank Li
2026-09-29  8:52 ` [PATCH v4 06/11] media: imx8-isi: Add RAW14 output format support Guoniu Zhou
2026-09-29 14:28   ` Frank Li
2026-09-29  8:52 ` [PATCH v4 07/11] media: imx8-isi: Select MSB-aligned RAW input from pixel link on i.MX95 Guoniu Zhou
2026-09-29 14:31   ` Frank Li
2026-09-30  2:39     ` G.N. Zhou (OSS)
2026-09-29  8:52 ` [PATCH v4 08/11] media: imx8-isi: Exclude RAW10/12/14 output formats " Guoniu Zhou
2026-09-29 14:33   ` Frank Li
2026-09-29  8:52 ` [PATCH v4 09/11] media: dt-bindings: nxp,imx8-isi: Add i.MX952 ISI compatible string Guoniu Zhou
2026-09-29  8:52 ` [PATCH v4 10/11] media: imx8-isi: Add i.MX952 ISI support Guoniu Zhou
2026-09-29  8:52 ` [PATCH v4 11/11] media: imx8-isi: Enable RAW10/12/14 output LSB alignment on i.MX952 Guoniu Zhou

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=20260929-isi_imx952-v4-4-e69f89c7c651@oss.nxp.com \
    --to=guoniu.zhou@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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

all inboxes | Powered by JetHome®