From: Guoniu Zhou <guoniu.zhou@nxp.com>
To: Rui Miguel Silva <rmfrfs@gmail.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Martin Kepplinger <martink@posteo.de>,
Purism Kernel Team <kernel@puri.sm>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>
Cc: linux-media@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Frank Li <Frank.Li@nxp.com>,
Guoniu Zhou <guoniu.zhou@nxp.com>
Subject: [PATCH v4 4/4] media: imx8mq-mipi-csi2: Implement .get_frame_desc subdev callback
Date: Tue, 19 Aug 2025 11:58:03 +0800 [thread overview]
Message-ID: <20250819-csi2_imx8mq-v4-4-c16b1d8f88a9@nxp.com> (raw)
In-Reply-To: <20250819-csi2_imx8mq-v4-0-c16b1d8f88a9@nxp.com>
Implement .get_frame_desc subdev callback since downstream subdev
need to get frame description.
Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
---
drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 32 +++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
index 79c8b56c051eb96cf45bff8803041b294b8c4f89..bc30ba83fc97ee79e8fe87b58bf443e8aa4801fb 100644
--- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
+++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
@@ -670,6 +670,37 @@ static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
return 0;
}
+static int imx8mq_mipi_csi_get_frame_desc(struct v4l2_subdev *sd,
+ unsigned int pad,
+ struct v4l2_mbus_frame_desc *fd)
+{
+ struct v4l2_mbus_frame_desc_entry *entry = &fd->entry[0];
+ const struct csi2_pix_format *csi2_fmt;
+ const struct v4l2_mbus_framefmt *fmt;
+ struct v4l2_subdev_state *state;
+
+ if (pad != MIPI_CSI2_PAD_SOURCE)
+ return -EINVAL;
+
+ state = v4l2_subdev_lock_and_get_active_state(sd);
+ fmt = v4l2_subdev_state_get_format(state, MIPI_CSI2_PAD_SOURCE);
+ csi2_fmt = find_csi2_format(fmt->code);
+ v4l2_subdev_unlock_state(state);
+
+ if (!csi2_fmt)
+ return -EPIPE;
+
+ fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
+ fd->num_entries = 1;
+
+ entry->flags = 0;
+ entry->pixelcode = csi2_fmt->code;
+ entry->bus.csi2.vc = 0;
+ entry->bus.csi2.dt = media_bus_fmt_to_csi2_dt(csi2_fmt->code);
+
+ return 0;
+}
+
static const struct v4l2_subdev_video_ops imx8mq_mipi_csi_video_ops = {
.s_stream = imx8mq_mipi_csi_s_stream,
};
@@ -678,6 +709,7 @@ static const struct v4l2_subdev_pad_ops imx8mq_mipi_csi_pad_ops = {
.enum_mbus_code = imx8mq_mipi_csi_enum_mbus_code,
.get_fmt = v4l2_subdev_get_fmt,
.set_fmt = imx8mq_mipi_csi_set_fmt,
+ .get_frame_desc = imx8mq_mipi_csi_get_frame_desc,
};
static const struct v4l2_subdev_ops imx8mq_mipi_csi_subdev_ops = {
--
2.34.1
next prev parent reply other threads:[~2025-08-19 4:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 3:57 [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Guoniu Zhou
2025-08-19 3:58 ` [PATCH v4 1/4] media: imx8mq-mipi-csi2: Remove width field in csi2_pix_format Guoniu Zhou
2025-08-19 3:58 ` [PATCH v4 2/4] media: imx8mq-mipi-csi2: Add output filed " Guoniu Zhou
2025-08-19 15:41 ` Frank Li
2025-08-19 3:58 ` [PATCH v4 3/4] media: imx8mq-mipi-csi2: Add RGB format support Guoniu Zhou
2025-08-19 3:58 ` Guoniu Zhou [this message]
2025-08-19 15:45 ` [PATCH v4 0/4] media: imx8mq-mipi-csi2: Enhance the driver to meet more usage case Frank Li
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=20250819-csi2_imx8mq-v4-4-c16b1d8f88a9@nxp.com \
--to=guoniu.zhou@nxp.com \
--cc=Frank.Li@nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=kernel@puri.sm \
--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=martink@posteo.de \
--cc=mchehab@kernel.org \
--cc=rmfrfs@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/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).