From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
linux-media@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Guoniu Zhou <guoniu.zhou@nxp.com>
Subject: Re: [PATCH v2] media: nxp: imx8-isi: Add virtual channel support
Date: Fri, 20 Mar 2026 00:46:41 +0200 [thread overview]
Message-ID: <20260319224641.GA962817@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260310-isi_vc-v2-1-acbf77db8e6f@nxp.com>
Hi Guoniu,
Thank you for the patch.
On Tue, Mar 10, 2026 at 02:53:10PM +0800, Guoniu Zhou wrote:
> From: Guoniu Zhou <guoniu.zhou@nxp.com>
>
> Add virtual channel support for ISI driver.
You can drop this line, it duplicates the subject line.
> The ISI supports different numbers of virtual channels depending on the
> platform. i.MX95 supports 8 virtual channels, and i.MX8QXP/QM support 4
> virtual channels. They are used in multiple camera use cases, such as
> surround view. Other platforms (such as i.MX8MN/8MP/8ULP/93/91) don't
> support virtual channels, and the VC_ID bits are marked as read-only.
>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
> ---
> Changes in v2:
> - Add Rb tag from Frank Li
> - Fix typo in comment(s/support/supports/)
> - Update commit log to include more details about ISI virtual channel support
> on different platform
> - Include bitfield.h file to fix following build error
> drivers/media/platform/nxp/imx8-isi/imx8-isi-regs.h:23:65: error: implicit declaration of function ‘FIELD_PREP’ [-Wimplicit-function-declaration]
> - Link to v1: https://lore.kernel.org/r/20260309-isi_vc-v1-1-fd0b8035d1cd@nxp.com
>
> Changes in v1:
> - Depends on https://lore.kernel.org/linux-media/20251105-isi_imx95-v3-2-3987533cca1c@nxp.com/
> ---
> .../media/platform/nxp/imx8-isi/imx8-isi-core.h | 3 ++
> drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c | 4 +-
> .../media/platform/nxp/imx8-isi/imx8-isi-pipe.c | 43 ++++++++++++++++++++++
> .../media/platform/nxp/imx8-isi/imx8-isi-regs.h | 6 +--
> 4 files changed, 52 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> index 3cbd35305af0f8026c4f76b5eb5d0864f8e36dc3..11a5e395792f11752c44d73818c825f2f175aa1d 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> @@ -256,6 +256,9 @@ struct mxc_isi_pipe {
> u8 acquired_res;
> u8 chained_res;
> bool chained;
> +
> + /* Virtual channel ID for the ISI channel */
> + u8 vc;
> };
>
> struct mxc_isi_m2m {
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> index 0187d4ab97e8e28fca9013f6864a094e08f2c570..2babb8573227de9e1aa36d9a39be41b286cf0c57 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> @@ -338,7 +338,9 @@ static void mxc_isi_channel_set_control(struct mxc_isi_pipe *pipe,
> } else {
> val |= CHNL_CTRL_SRC_TYPE(CHNL_CTRL_SRC_TYPE_DEVICE);
> val |= CHNL_CTRL_SRC_INPUT(input);
> - val |= CHNL_CTRL_MIPI_VC_ID(0); /* FIXME: For CSI-2 only */
> + val |= CHNL_CTRL_MIPI_VC_ID(pipe->vc);
You're not addressing the FIXME comment, so it should be kept (or
ideally addressed :-)).
> + /* Platform like i.MX95, ISI supports 8 virtual channels */
> + val |= CHNL_CTRL_VC_ID_1(pipe->vc >> 2);
This should be done for i.MX95 only. You also need to clear the bit
above in the function just after reading CHNL_CTRL (for i.MX95 only as
well), otherwise switching between different virtual channels won't
work.
> }
>
> mxc_isi_write(pipe, CHNL_CTRL, val);
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
> index a41c51dd9ce0f2eeb779e9aa2461593b0d635f41..cc4348ea6006ee19243aae3abceb235d00beea4d 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
> @@ -232,6 +232,45 @@ static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd)
> return container_of(sd, struct mxc_isi_pipe, sd);
> }
>
> +static int mxc_isi_get_vc(struct mxc_isi_pipe *pipe)
> +{
> + struct mxc_isi_crossbar *xbar = &pipe->isi->crossbar;
> + struct device *dev = pipe->isi->dev;
> + struct v4l2_mbus_frame_desc source_fd;
> + struct v4l2_mbus_frame_desc_entry *entry = NULL;
> + unsigned int i;
> + int ret;
> +
> + ret = v4l2_subdev_call(&xbar->sd, pad, get_frame_desc,
> + xbar->num_sinks + pipe->id, &source_fd);
I don't see the xbar implementing get_frame_desc(). Am I missing a
dependency ?
> + if (ret < 0) {
> + dev_err(dev, "Failed to get source frame desc from pad %u\n",
> + xbar->num_sinks + pipe->id);
> + return ret;
> + }
> +
> + for (i = 0; i < source_fd.num_entries; i++) {
> + if (source_fd.entry[i].stream == 0) {
> + entry = &source_fd.entry[i];
> + break;
> + }
> + }
> +
> + if (!entry) {
> + dev_err(dev, "Failed to find stream from source frame desc\n");
> + return -EPIPE;
> + }
> +
> + if (entry->bus.csi2.vc >= pipe->isi->pdata->num_channels) {
> + dev_err(dev, "Virtual channel(%d) out of range\n",
> + entry->bus.csi2.vc);
> + return -EINVAL;
> + }
> +
> + pipe->vc = entry->bus.csi2.vc;
> + return 0;
> +}
> +
> int mxc_isi_pipe_enable(struct mxc_isi_pipe *pipe)
> {
> struct mxc_isi_crossbar *xbar = &pipe->isi->crossbar;
> @@ -280,6 +319,10 @@ int mxc_isi_pipe_enable(struct mxc_isi_pipe *pipe)
>
> v4l2_subdev_unlock_state(state);
>
> + ret = mxc_isi_get_vc(pipe);
> + if (ret)
> + return ret;
> +
> /* Configure the ISI channel. */
> mxc_isi_channel_config(pipe, input, &in_size, &scale, &crop,
> sink_info->encoding, src_info->encoding);
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-regs.h b/drivers/media/platform/nxp/imx8-isi/imx8-isi-regs.h
> index 1b65eccdf0da4bbc3a77c91e06fccc35d6c7e022..a4036da72f0057265e991087f21bc079bd6c6573 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-regs.h
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-regs.h
> @@ -6,6 +6,7 @@
> #ifndef __IMX8_ISI_REGS_H__
> #define __IMX8_ISI_REGS_H__
>
> +#include <linux/bitfield.h>
> #include <linux/bits.h>
>
> /* ISI Registers Define */
> @@ -19,9 +20,8 @@
> #define CHNL_CTRL_CHAIN_BUF_NO_CHAIN 0
> #define CHNL_CTRL_CHAIN_BUF_2_CHAIN 1
> #define CHNL_CTRL_SW_RST BIT(24)
> -#define CHNL_CTRL_BLANK_PXL(n) ((n) << 16)
I'm tempted to keep this, in case we'll need to set it later. We can add
a comment to indicate the field is only valid on i.MX8QM and i.MX8QXP:
#define CHNL_CTRL_BLANK_PXL(n) ((n) << 16) /* i.MX8{QM,QXP} */
or
#define CHNL_CTRL_BLANK_PXL(n) FIELD_PREP(GENMASK(23, 16), (n)) /* i.MX8{QM,QXP} */
> -#define CHNL_CTRL_BLANK_PXL_MASK GENMASK(23, 16)
> -#define CHNL_CTRL_MIPI_VC_ID(n) ((n) << 6)
> +#define CHNL_CTRL_VC_ID_1(n) FIELD_PREP(BIT(16), (n))
Please also add a comment to indicate the field is valid on i.MX95 only.
#define CHNL_CTRL_VC_ID_1(n) FIELD_PREP(BIT(16), (n)) /* i.MX95 */
> +#define CHNL_CTRL_MIPI_VC_ID(n) FIELD_PREP(GENMASK(7, 6), (n))
> #define CHNL_CTRL_MIPI_VC_ID_MASK GENMASK(7, 6)
> #define CHNL_CTRL_SRC_TYPE(n) ((n) << 4)
> #define CHNL_CTRL_SRC_TYPE_MASK BIT(4)
>
> ---
> base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
> change-id: 20260309-isi_vc-285fd815140e
> prerequisite-patch-id: 6f139a1d54fa3e0632db9b8a736ae27037c5f45a
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-03-19 22:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 6:53 [PATCH v2] media: nxp: imx8-isi: Add virtual channel support Guoniu Zhou
2026-03-19 22:46 ` Laurent Pinchart [this message]
2026-03-25 5:51 ` G.N. Zhou (OSS)
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=20260319224641.GA962817@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=Frank.Li@nxp.com \
--cc=festevam@gmail.com \
--cc=guoniu.zhou@nxp.com \
--cc=guoniu.zhou@oss.nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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