media: nxp: imx8-isi: Add virtual channel and frame descriptor support
Subsystems (3)
v5 cover media: nxp: imx8-isi: Add virtual channel and frame descriptor support
This patch series enhances the i.MX ISI driver's with virtual channel support and adds frame descriptor capabilities to the crossbar subdevice.
---
Changes in v5:
- Rebase to latest media/next
- Swap patch order
- Return -EPIPE instead of -EINVAL for stream configuration errors
- Clear VC_ID_1 after generic mask to follow generic-then-conditional order
- Pass vc as function parameter instead of storing in pipe structure.
- Drop get_frame_desc fallback as crossbar now implements the operation
- Remove redundant num_entries check in mxc_isi_get_vc().
- Set vc to 0 for M2M as it doesn't support virtual channels.
- Use v4l2_subdev_get_frame_desc_passthrough helper
- Rewrote commit message
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Rebase to latest media/next(previous dependency now in mainline)
- Fix VC boundary check: use num_vc (virtual channels count) instead of num_channels (ISI pipelines count)
- Set VC to 0 when frame descriptor has no entries
- Move platform-specific comments to block style to fix line length warnings
- Use %d instead of %u for ret variable in error messages
- Fix potential -ENOIOCTLCMD leak by resetting ret to 0 on continue
- See each patch's changelog for details
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Rebased on latest media/next
- Add num_vc field to platform data to indicate VC support
- Clear VC_ID_1 bit after reading CHNL_CTRL for proper VC switching
- Set VC_ID_1 only on platforms with num_vc > 4
- Improve mxc_isi_get_vc() error handling
- Add back CHNL_CTRL_BLANK_PXL and document platform-specific register fields
- Add xbar get_frame_desc() implementation (feedback from Laurent Pinchart)
- Link to v2: https://lore.kernel.org/r/[email protected]
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/[email protected]
Changes in v1:
- Depends on https://lore.kernel.org/linux-media/[email protected]/
---
Guoniu Zhou (1):
media: nxp: imx8-isi: Add virtual channel support
Guoniu.zhou (1):
media: imx8-isi: crossbar: Add get_frame_desc operation
.../media/platform/nxp/imx8-isi/imx8-isi-core.c | 3 ++ .../media/platform/nxp/imx8-isi/imx8-isi-core.h | 2 + .../platform/nxp/imx8-isi/imx8-isi-crossbar.c | 1 + drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c | 17 +++++++- drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 2 +- .../media/platform/nxp/imx8-isi/imx8-isi-pipe.c | 50 +++++++++++++++++++++- .../media/platform/nxp/imx8-isi/imx8-isi-regs.h | 12 ++++-- 7 files changed, 80 insertions(+), 7 deletions(-)
---
base-commit: 2c8fe1f14240d75f2002e16b2b69c5c2d27ed41c
change-id: 20260309-isi_vc-285fd815140e
Best regards,
Signature · 1 line
Guoniu Zhou <[email protected]>
PATCH v5 1/2 media: imx8-isi: crossbar: Add get_frame_desc operation
From: "Guoniu.zhou" <[email protected]>
Implement the get_frame_desc pad operation for the crossbar subdev using the v4l2_subdev_get_frame_desc_passthrough() helper. This allows the crossbar to properly propagate frame descriptors from its sink pads to its source pads, which is necessary for proper stream configuration in multiplexed streams scenarios.
---
Changes in v5:
- Use v4l2_subdev_get_frame_desc_passthrough helper
- Rewrote commit message
Changes in v4:
- Use %d instead of %u for ret variable in error messages
- Fix potential -ENOIOCTLCMD leak by resetting ret to 0 on continue
Changes in v3:
- New patch added based on feedback from Laurent Pinchart
--- drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c +1 -0
@@ -404,6 +404,7 @@ static const struct v4l2_subdev_pad_ops mxc_isi_crossbar_subdev_pad_ops = { .enum_mbus_code = mxc_isi_crossbar_enum_mbus_code, .get_fmt = v4l2_subdev_get_fmt, .set_fmt = mxc_isi_crossbar_set_fmt, + .get_frame_desc = v4l2_subdev_get_frame_desc_passthrough, .set_routing = mxc_isi_crossbar_set_routing, .enable_streams = mxc_isi_crossbar_enable_streams, .disable_streams = mxc_isi_crossbar_disable_streams,
Signature · 1 line
2.34.1
Re: [PATCH v5 1/2] media: imx8-isi: crossbar: Add get_frame_desc operation
Hi Guoniu,
Thank you for the patch.
Quoted 9 lines · Guoniu Zhou
From: "Guoniu.zhou" <[email protected]>
Implement the
get_frame_descpad operation for the crossbar subdev using thev4l2_subdev_get_frame_desc_passthrough()helper. This allows the crossbar to properly propagate frame descriptors from its sink pads to its source pads, which is necessary for proper stream configuration in multiplexed streams scenarios.Signed-off-by Guoniu.zhou <[email protected]>
Quoted 27 lines
---
Changes in v5:
- Usev4l2_subdev_get_frame_desc_passthroughhelper
- Rewrote commit messageChanges in v4:
- Use %d instead of %u for ret variable in error messages
- Fix potential-ENOIOCTLCMDleak by resetting ret to 0 on continueChanges in v3:
- New patch added based on feedback from Laurent Pinchart--- drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c | 1 + 1 file changed, 1 insertion(+)drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c +1
-0@@ -404,6 +404,7 @@ static const struct v4l2_subdev_pad_ops mxc_isi_crossbar_subdev_pad_ops = { .enum_mbus_code = mxc_isi_crossbar_enum_mbus_code, .get_fmt = v4l2_subdev_get_fmt, .set_fmt = mxc_isi_crossbar_set_fmt, + .get_frame_desc = v4l2_subdev_get_frame_desc_passthrough, .set_routing = mxc_isi_crossbar_set_routing, .enable_streams = mxc_isi_crossbar_enable_streams, .disable_streams = mxc_isi_crossbar_disable_streams,
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v5 2/2 media: nxp: imx8-isi: Add virtual channel support
In reply to Guoniu ZhouFrom: Guoniu Zhou <[email protected]>
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.MX8/MN/MP/ULP/91/93) don't support virtual channels, and the VC_ID bits are marked as read-only.
---
Changes in v5:
- Return -EPIPE instead of -EINVAL for stream configuration errors
- Clear VC_ID_1 after generic mask to follow generic-then-conditional order
- Pass vc as function parameter instead of storing in pipe structure.
- Drop get_frame_desc fallback as crossbar now implements the operation
- Remove redundant num_entries check in mxc_isi_get_vc().
- Set vc to 0 for M2M as it doesn't support virtual channels.
Changes in v4:
- Fix VC boundary check: use num_vc (virtual channels count) instead of num_channels (ISI pipelines count)
- Set VC to 0 when frame descriptor has no entries
- Move platform-specific comments to block style to fix line length warnings
Changes in v3:
- Add num_vc field to platform data to indicate VC support
- Clear VC_ID_1 bit after reading CHNL_CTRL for proper VC switching
- Set VC_ID_1 only on platforms with num_vc > 4
- Improve mxc_isi_get_vc() error handling
- Add back CHNL_CTRL_BLANK_PXL and document platform-specific register fields
--- .../media/platform/nxp/imx8-isi/imx8-isi-core.c | 3 ++ .../media/platform/nxp/imx8-isi/imx8-isi-core.h | 2 + drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c | 17 +++++++- drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 2 +- .../media/platform/nxp/imx8-isi/imx8-isi-pipe.c | 50 +++++++++++++++++++++- .../media/platform/nxp/imx8-isi/imx8-isi-regs.h | 12 ++++-- 6 files changed, 79 insertions(+), 7 deletions(-)
drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c +3 -0
@@ -318,6 +318,7 @@ static const struct mxc_isi_plat_data mxc_imx95_data = { .model = MXC_ISI_IMX95, .num_ports = 4, .num_channels = 8, + .num_vc = 8, .reg_offset = 0x10000, .ier_reg = &mxc_imx8_isi_ier_v2, .set_thd = &mxc_imx8_isi_thd_v1,
@@ -329,6 +330,7 @@ static const struct mxc_isi_plat_data mxc_imx8qm_data = { .model = MXC_ISI_IMX8QM, .num_ports = 5, .num_channels = 8, + .num_vc = 4, .reg_offset = 0x10000, .ier_reg = &mxc_imx8_isi_ier_qm, .set_thd = &mxc_imx8_isi_thd_v1,
@@ -340,6 +342,7 @@ static const struct mxc_isi_plat_data mxc_imx8qxp_data = { .model = MXC_ISI_IMX8QXP, .num_ports = 5, .num_channels = 6, + .num_vc = 4, .reg_offset = 0x10000, .ier_reg = &mxc_imx8_isi_ier_v2, .set_thd = &mxc_imx8_isi_thd_v1,
drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h +2 -0
@@ -169,6 +169,7 @@ struct mxc_isi_plat_data {enum model model;unsigned int num_ports;unsigned int num_channels; +unsigned int num_vc;/* Number of VCs, 0 = no VC support */ unsigned int reg_offset;const struct mxc_isi_ier_reg *ier_reg;const struct mxc_isi_set_thd *set_thd;
@@ -377,6 +378,7 @@ void mxc_isi_channel_unchain(struct mxc_isi_pipe *pipe); void mxc_isi_channel_config(struct mxc_isi_pipe *pipe, enum mxc_isi_input_id input, + unsigned int vc, const struct v4l2_area *in_size, const struct v4l2_area *scale, const struct v4l2_rect *crop,
drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c +15 -2
@@ -301,6 +301,7 @@ static void mxc_isi_channel_set_panic_threshold(struct mxc_isi_pipe *pipe)static void mxc_isi_channel_set_control (struct mxc_isi_pipe *pipe,enum mxc_isi_input_id input, +unsigned int vc,bool bypass) {u32 val;
@@ -312,6 +313,10 @@ static void mxc_isi_channel_set_control(struct mxc_isi_pipe *pipe,CHNL_CTRL_SRC_TYPE_MASK |CHNL_CTRL_MIPI_VC_ID_MASK | CHNL_CTRL_SRC_INPUT_MASK); +/* Clear the VC_ID_1 bit on platforms supporting more than 4 VCs. */ +if (pipe->isi->pdata->num_vc >4 ) + val &= ~CHNL_CTRL_VC_ID_1_MASK ; +/* * If no scaling or color space conversion is needed, bypass the * channel.
@@ -338,7 +343,14 @@ 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 (vc);/* FIXME: For CSI-2 only */ + +/* +* On platforms with more than 4 VCs (i.MX95), the VC ID is +* split across VC_ID_0 (bits 7:6) and VC_ID_1 (bit 16). +*/ +if (pipe->isi->pdata->num_vc >4 ) + val |=CHNL_CTRL_VC_ID_1 (vc >>2 ); }mxc_isi_write (pipe,CHNL_CTRL , val);
@@ -348,6 +360,7 @@ static void mxc_isi_channel_set_control(struct mxc_isi_pipe *pipe, void mxc_isi_channel_config(struct mxc_isi_pipe *pipe, enum mxc_isi_input_id input, + unsigned int vc, const struct v4l2_area *in_size, const struct v4l2_area *scale, const struct v4l2_rect *crop,
@@ -374,7 +387,7 @@ void mxc_isi_channel_config(struct mxc_isi_pipe *pipe,mxc_isi_channel_set_panic_threshold (pipe);/* Channel control */ -mxc_isi_channel_set_control (pipe, input, csc_bypass && scaler_bypass); +mxc_isi_channel_set_control (pipe, input, vc, csc_bypass && scaler_bypass); } void mxc_isi_channel_set_input_format(struct mxc_isi_pipe *pipe,
drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c +1 -1
@@ -144,7 +144,7 @@ static void mxc_isi_m2m_device_run(void *priv) .height = ctx->queues.cap.format.height, }; -mxc_isi_channel_config (m2m->pipe,MXC_ISI_INPUT_MEM , +mxc_isi_channel_config (m2m->pipe,MXC_ISI_INPUT_MEM ,0 , &in_size, &scale, &crop, ctx->queues.out.info->encoding, ctx->queues.cap.info->encoding);
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +49 -1
69 lines not on this page · raw message
drivers/media/platform/nxp/imx8-isi/imx8-isi-regs.h +9 -3
@@ -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,14 @@#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) -#define CHNL_CTRL_BLANK_PXL_MASK GENMASK(23, 16) -#define CHNL_CTRL_MIPI_VC_ID (n) ((n) << 6) +/* +* CHNL_CTRL_BLANK_PXL: i.MX8{QM,QXP} only +* CHNL_CTRL_VC_ID_1, CHNL_CTRL_VC_ID_1_MASK: i.MX95 only +*/ +#define CHNL_CTRL_BLANK_PXL (n) FIELD_PREP(GENMASK(23, 16), (n)) +#define CHNL_CTRL_VC_ID_1 (n) FIELD_PREP(BIT(16), (n)) +#define CHNL_CTRL_VC_ID_1_MASK BIT(16) +#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)
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v5 2/2] media: nxp: imx8-isi: Add virtual channel support
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Pipeline enablement unconditionally fails if the upstream subdevice does not implement the…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Pipeline enablement unconditionally fails if the upstream subdevice does not implement the get_frame_desc operation.
- [Medium] The driver unconditionally accesses CSI-2 specific fields in the frame descriptor without validating the frame descriptor type. --
commit 4d8a62dc345af085b3b0a217c07143648e85fd35
Author: Guoniu Zhou <[email protected]>
Subject: media: nxp: imx8-isi: Add virtual channel support
This commit introduces virtual channel (VC) support to the i.MX8 ISI driver. It retrieves the VC from the remote upstream subdevice's frame descriptor and applies the required register configurations based on the platform's maximum supported VCs.
Quoted 4 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +0
-0
[ ... ]
Quoted 7 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +7
-0+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 fd = { }; +unsigned int source_pad = xbar->num_sinks + pipe->id; +unsigned int max_vc;
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd) · line 251
Quoted 10 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +10
-0+unsigned int i; +int ret; + + ret =v4l2_subdev_call (&xbar->sd, pad, get_frame_desc, + source_pad, &fd); +if (ret <0 ) { +dev_err (dev,"Failed to get source frame desc from pad %u\n" , + source_pad); +return ret; + }
[Severity: High]
If the remote upstream subdevice does not implement the optional get_frame_desc operation, v4l2_subdev_call() will return -ENOIOCTLCMD.
Does this mean pipeline enablement will now unconditionally fail for any sensor lacking get_frame_desc support?
Prior to this patch, the VC was implicitly hardcoded to 0, which worked seamlessly for parallel and legacy CSI-2 sensors. Would it be better to explicitly check for -ENOIOCTLCMD (and potentially -EOPNOTSUPP) here and gracefully fallback to a default VC of 0 to prevent this regression?
Quoted 6 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +6
-0+ +/* Find stream 0 in the frame descriptor */ +for (i =0 ; i < fd.num_entries; i++) { +if (fd.entry[i].stream ==0 ) +break ; + }
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd) · line 267
Quoted 10 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +10
-0+ +if (i == fd.num_entries) { +dev_err (dev,"Failed to find stream from source frame desc\n" ); +return -EPIPE ; + } + + max_vc = pipe->isi->pdata->num_vc ? :1 ; + +/* Check virtual channel range */ +if (fd.entry[i].bus.csi2.vc >= max_vc) {
[Severity: Medium]
This code directly accesses fd.entry[i].bus.csi2.vc, but is it guaranteed that the frame descriptor type is V4L2_MBUS_FRAME_DESC_TYPE_CSI2?
Since the i.MX8 ISI also supports parallel cameras, fd.type could be V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL, making the access to bus.csi2 semantically invalid.
Should there be a check to validate fd.type before accessing the CSI-2 specific union members to avoid potential undefined behavior?
Quoted 7 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +7
-0+dev_err (dev,"Virtual channel %u exceeds maximum %u\n" , + fd.entry[i].bus.csi2.vc, max_vc -1 ); +return -EPIPE ; + } + +return fd.entry[i].bus.csi2.vc; +}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH v5 2/2] media: nxp: imx8-isi: Add virtual channel support
Quoted 72 lines · On Thu, May 21, 2026 at 10:06:31AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Pipeline enablement unconditionally fails if the upstream subdevice does not implement theget_frame_descoperation.
- [Medium] The driver unconditionally accesses CSI-2 specific fields in the frame descriptor without validating the frame descriptor type. --commit
4d8a62dc345af085b3b0a217c07143648e85fd35
Author: Guoniu Zhou <[email protected]>
Subject: media: nxp: imx8-isi: Add virtual channel supportThis commit introduces virtual channel (VC) support to the i.MX8 ISI driver. It retrieves the VC from the remote upstream subdevice's frame descriptor and applies the required register configurations based on the platform's maximum supported VCs.
Quoted 4 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +0
-0[ ... ]
Quoted 7 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +7
-0+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 fd = { }; +unsigned int source_pad = xbar->num_sinks + pipe->id; +unsigned int max_vc;drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd) · line 251
Quoted 10 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +10
-0+unsigned int i; +int ret; + + ret =v4l2_subdev_call (&xbar->sd, pad, get_frame_desc, + source_pad, &fd); +if (ret <0 ) { +dev_err (dev,"Failed to get source frame desc from pad %u\n" , + source_pad); +return ret; + }[Severity: High]
If the remote upstream subdevice does not implement the optionalget_frame_descoperation,v4l2_subdev_call()will return-ENOIOCTLCMD.Does this mean pipeline enablement will now unconditionally fail for any sensor lacking
get_frame_descsupport?Prior to this patch, the VC was implicitly hardcoded to 0, which worked seamlessly for parallel and legacy CSI-2 sensors. Would it be better to explicitly check for
-ENOIOCTLCMD(and potentially-EOPNOTSUPP) here and gracefully fallback to a default VC of 0 to prevent this regression?Quoted 6 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +6
-0+ +/* Find stream 0 in the frame descriptor */ +for (i =0 ; i < fd.num_entries; i++) { +if (fd.entry[i].stream ==0 ) +break ; + }drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd) · line 267
Quoted 10 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +10
-0+ +if (i == fd.num_entries) { +dev_err (dev,"Failed to find stream from source frame desc\n" ); +return -EPIPE ; + } + + max_vc = pipe->isi->pdata->num_vc ? :1 ; + +/* Check virtual channel range */ +if (fd.entry[i].bus.csi2.vc >= max_vc) {[Severity: Medium]
This code directly accesses fd.entry[i].bus.csi2.vc, but is it guaranteed that the frame descriptor type isV4L2_MBUS_FRAME_DESC_TYPE_CSI2?
Quoted 6 lines
Since the i.MX8 ISI also supports parallel cameras, fd.type could be
V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL, making the access to bus.csi2 semantically invalid.Should there be a check to validate fd.type before accessing the CSI-2 specific union members to avoid potential undefined behavior?
Look like make sense,
Can you double check it?
Frank
Quoted 11 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd) · line 274
Quoted 8 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +7
-0+dev_err (dev,"Virtual channel %u exceeds maximum %u\n" , + fd.entry[i].bus.csi2.vc, max_vc -1 ); +return -EPIPE ; + } + +return fd.entry[i].bus.csi2.vc; +}--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH v5 2/2] media: nxp: imx8-isi: Add virtual channel support
In reply to Guoniu ZhouHi Guoniu,
Thank you for the patch.
Quoted 174 lines · Guoniu Zhou
From: Guoniu Zhou <[email protected]>
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.MX8/MN/MP/ULP/91/93) don't support virtual channels, and the
VC_IDbits are marked as read-only.Reviewed-by Frank Li <[email protected]>Signed-off-by Guoniu Zhou <[email protected]>---
Changes in v5:
- Return-EPIPEinstead of-EINVALfor stream configuration errors
- ClearVC_ID_1after generic mask to follow generic-then-conditional order
- Pass vc as function parameter instead of storing in pipe structure.
- Dropget_frame_descfallback as crossbar now implements the operation
- Remove redundantnum_entriescheck inmxc_isi_get_vc().
- Set vc to 0 for M2M as it doesn't support virtual channels.Changes in v4:
- Fix VC boundary check: usenum_vc(virtual channels count) instead ofnum_channels(ISI pipelines count)
- Set VC to 0 when frame descriptor has no entries
- Move platform-specific comments to block style to fix line length warningsChanges in v3:
- Addnum_vcfield to platform data to indicate VC support
- ClearVC_ID_1bit after readingCHNL_CTRLfor proper VC switching
- SetVC_ID_1only on platforms withnum_vc> 4
- Improvemxc_isi_get_vc()error handling
- Add backCHNL_CTRL_BLANK_PXLand document platform-specific register fields--- .../media/platform/nxp/imx8-isi/imx8-isi-core.c | 3 ++ .../media/platform/nxp/imx8-isi/imx8-isi-core.h | 2 + drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c | 17 +++++++- drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 2 +- .../media/platform/nxp/imx8-isi/imx8-isi-pipe.c | 50 +++++++++++++++++++++- .../media/platform/nxp/imx8-isi/imx8-isi-regs.h | 12 ++++-- 6 files changed, 79 insertions(+), 7 deletions(-)drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c +3
-0@@ -318,6 +318,7 @@ static const struct mxc_isi_plat_data mxc_imx95_data = { .model = MXC_ISI_IMX95, .num_ports = 4, .num_channels = 8, + .num_vc = 8, .reg_offset = 0x10000, .ier_reg = &mxc_imx8_isi_ier_v2, .set_thd = &mxc_imx8_isi_thd_v1,@@ -329,6 +330,7 @@ static const struct mxc_isi_plat_data mxc_imx8qm_data = { .model = MXC_ISI_IMX8QM, .num_ports = 5, .num_channels = 8, + .num_vc = 4, .reg_offset = 0x10000, .ier_reg = &mxc_imx8_isi_ier_qm, .set_thd = &mxc_imx8_isi_thd_v1,@@ -340,6 +342,7 @@ static const struct mxc_isi_plat_data mxc_imx8qxp_data = { .model = MXC_ISI_IMX8QXP, .num_ports = 5, .num_channels = 6, + .num_vc = 4, .reg_offset = 0x10000, .ier_reg = &mxc_imx8_isi_ier_v2, .set_thd = &mxc_imx8_isi_thd_v1,drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h +2
-0@@ -169,6 +169,7 @@ struct mxc_isi_plat_data {enum model model;unsigned int num_ports;unsigned int num_channels; +unsigned int num_vc;/* Number of VCs, 0 = no VC support */ unsigned int reg_offset;const struct mxc_isi_ier_reg *ier_reg;const struct mxc_isi_set_thd *set_thd;@@ -377,6 +378,7 @@ void mxc_isi_channel_unchain(struct mxc_isi_pipe *pipe); void mxc_isi_channel_config(struct mxc_isi_pipe *pipe, enum mxc_isi_input_id input, + unsigned int vc, const struct v4l2_area *in_size, const struct v4l2_area *scale, const struct v4l2_rect *crop,drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c +15
-2@@ -301,6 +301,7 @@ static void mxc_isi_channel_set_panic_threshold(struct mxc_isi_pipe *pipe)static void mxc_isi_channel_set_control (struct mxc_isi_pipe *pipe,enum mxc_isi_input_id input, +unsigned int vc,bool bypass) {u32 val;@@ -312,6 +313,10 @@ static void mxc_isi_channel_set_control(struct mxc_isi_pipe *pipe,CHNL_CTRL_SRC_TYPE_MASK |CHNL_CTRL_MIPI_VC_ID_MASK | CHNL_CTRL_SRC_INPUT_MASK); +/* Clear the VC_ID_1 bit on platforms supporting more than 4 VCs. */ +if (pipe->isi->pdata->num_vc >4 ) + val &= ~CHNL_CTRL_VC_ID_1_MASK ; +/* * If no scaling or color space conversion is needed, bypass the * channel. @@ -338,7 +343,14 @@ 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 (vc);/* FIXME: For CSI-2 only */ + +/* +* On platforms with more than 4 VCs (i.MX95), the VC ID is +* split across VC_ID_0 (bits 7:6) and VC_ID_1 (bit 16). +*/ +if (pipe->isi->pdata->num_vc >4 ) + val |=CHNL_CTRL_VC_ID_1 (vc >>2 ); }mxc_isi_write (pipe,CHNL_CTRL , val);@@ -348,6 +360,7 @@ static void mxc_isi_channel_set_control(struct mxc_isi_pipe *pipe, void mxc_isi_channel_config(struct mxc_isi_pipe *pipe, enum mxc_isi_input_id input, + unsigned int vc, const struct v4l2_area *in_size, const struct v4l2_area *scale, const struct v4l2_rect *crop,@@ -374,7 +387,7 @@ void mxc_isi_channel_config(struct mxc_isi_pipe *pipe,mxc_isi_channel_set_panic_threshold (pipe);/* Channel control */ -mxc_isi_channel_set_control (pipe, input, csc_bypass && scaler_bypass); +mxc_isi_channel_set_control (pipe, input, vc, csc_bypass && scaler_bypass); } void mxc_isi_channel_set_input_format(struct mxc_isi_pipe *pipe,drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c +1
-1@@ -144,7 +144,7 @@ static void mxc_isi_m2m_device_run(void *priv) .height = ctx->queues.cap.format.height, }; -mxc_isi_channel_config (m2m->pipe,MXC_ISI_INPUT_MEM , +mxc_isi_channel_config (m2m->pipe,MXC_ISI_INPUT_MEM ,0 , &in_size, &scale, &crop, ctx->queues.out.info->encoding, ctx->queues.cap.info->encoding);drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +9
-0@@ -232,6 +232,47 @@ 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 fd = { }; +unsigned int source_pad = xbar->num_sinks + pipe->id; +unsigned int max_vc; +unsigned int i; +int ret;
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd) · line 253
Quoted 10 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +10
-0+ + ret =v4l2_subdev_call (&xbar->sd, pad, get_frame_desc, + source_pad, &fd); +if (ret <0 ) { +dev_err (dev,"Failed to get source frame desc from pad %u\n" , + source_pad); +return ret; + } + +/* Find stream 0 in the frame descriptor */
/* Find stream 0 in the frame descriptor. */
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd) · line 264
Quoted 11 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +11
-0+for (i =0 ; i < fd.num_entries; i++) { +if (fd.entry[i].stream ==0 ) +break ; + } + +if (i == fd.num_entries) { +dev_err (dev,"Failed to find stream from source frame desc\n" ); +return -EPIPE ; + } + + max_vc = pipe->isi->pdata->num_vc ? :1 ;
Let's name this num_vc, as it's the number of supported virtual channels, not the maximum VC identifier.
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c static inline struct mxc_isi_pipe *to_isi_pipe(struct v4l2_subdev *sd) · line 266
Quoted 2 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +2
-0+ +/* Check virtual channel range */
/* Check virtual channel range. */
Quoted 21 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +10
-0+if (fd.entry[i].bus.csi2.vc >= max_vc) { +dev_err (dev,"Virtual channel %u exceeds maximum %u\n" , + fd.entry[i].bus.csi2.vc, max_vc -1 ); +return -EPIPE ; + } + +return fd.entry[i].bus.csi2.vc; +} +int mxc_isi_pipe_enable (struct mxc_isi_pipe *pipe) {struct mxc_isi_crossbar *xbar = &pipe->isi->crossbar;@@ -244,6 +285,7 @@ int mxc_isi_pipe_enable(struct mxc_isi_pipe *pipe)struct v4l2_subdev *sd = &pipe->sd;struct v4l2_area in_size, scale;struct v4l2_rect crop; +unsigned int vc;u32 input;int ret;
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c int mxc_isi_pipe_enable(struct mxc_isi_pipe *pipe) · line 330
Quoted 9 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +6
-0@@ -280,8 +322,14 @@ int mxc_isi_pipe_enable(struct mxc_isi_pipe *pipe)v4l2_subdev_unlock_state (state); + ret =mxc_isi_get_vc (pipe); +if (ret <0 ) +return ret; + + vc = ret; +
As vc values are small, you make the variable an int, and write
vc = mxc_isi_get_vc(pipe); if (vc < 0) return vc;
There's no need to send a new version for this, I can handle it when applying your patches.
Quoted 36 lines
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +1
-1/* Configure the ISI channel. */ -mxc_isi_channel_config (pipe, input, &in_size, &scale, &crop, +mxc_isi_channel_config (pipe, input, vc, &in_size, &scale, &crop, sink_info->encoding, src_info->encoding);mxc_isi_channel_enable (pipe);drivers/media/platform/nxp/imx8-isi/imx8-isi-regs.h +9
-3@@ -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,14 @@#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) -#define CHNL_CTRL_BLANK_PXL_MASK GENMASK(23, 16) -#define CHNL_CTRL_MIPI_VC_ID (n) ((n) << 6) +/* +* CHNL_CTRL_BLANK_PXL: i.MX8{QM,QXP} only +* CHNL_CTRL_VC_ID_1, CHNL_CTRL_VC_ID_1_MASK: i.MX95 only +*/ +#define CHNL_CTRL_BLANK_PXL (n) FIELD_PREP(GENMASK(23, 16), (n)) +#define CHNL_CTRL_VC_ID_1 (n) FIELD_PREP(BIT(16), (n)) +#define CHNL_CTRL_VC_ID_1_MASK BIT(16) +#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)
Signature · 3 lines
Regards, Laurent Pinchart
[email protected]
AppliedRe: (subset) [PATCH v5 0/2] media: nxp: imx8-isi: Add virtual channel and frame descriptor support
In reply to Guoniu ZhouFrom: Frank Li <[email protected]>
Quoted 2 lines · Guoniu Zhou
This patch series enhances the i.MX ISI driver's with virtual channel support and adds frame descriptor capabilities to the crossbar subdevice.
Applied, thanks!
[1/2] media: imx8-isi: crossbar: Add get_frame_desc operation
commit: 3e15a3510908c990ee352aa206d5f9c23d4b216e
Best regards,
Signature · 1 line
Frank Li <[email protected]>
Laurent Pinchart
maintainerRe: (subset) [PATCH v5 0/2] media: nxp: imx8-isi: Add virtual channel and frame descriptor support
Quoted 11 lines · On Mon, Jun 29, 2026 at 03:42:31PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
Quoted 2 lines · Guoniu Zhou
This patch series enhances the i.MX ISI driver's with virtual channel support and adds frame descriptor capabilities to the crossbar subdevice.
Applied, thanks!
[1/2] media: imx8-isi: crossbar: Add
get_frame_descoperationcommit: 3e15a3510908c990ee352aa206d5f9c23d4b216e
Is this a mistake ? Patch 1/2 has no R-b tag, and you're not listed as maintainer for this driver.
Signature · 3 lines
Regards, Laurent Pinchart
Re: (subset) [PATCH v5 0/2] media: nxp: imx8-isi: Add virtual channel and frame descriptor support
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Mon, Jun 29, 2026 at 03:42:31PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
Quoted 2 lines · Guoniu Zhou
This patch series enhances the i.MX ISI driver's with virtual channel support and adds frame descriptor capabilities to the crossbar subdevice.
Quoted 7 lines
Quoted 4 lines
Applied, thanks!
[1/2] media: imx8-isi: crossbar: Add
get_frame_descoperationcommit: 3e15a3510908c990ee352aa206d5f9c23d4b216eIs this a mistake ? Patch 1/2 has no R-b tag, and you're not listed as maintainer for this driver.
Sorry, I missed checking Maintainer files, in media summit, agree on I pick imx's media drivers, but forget finalize the file\dir list. Can you help summery which files\dir I should take care?
If you have concern about this patch, I can drop it.
Frank
Quoted 5 lines
--
Regards,Laurent Pinchart
Re: (subset) [PATCH v5 0/2] media: nxp: imx8-isi: Add virtual channel and frame descriptor support
Quoted 17 lines · Frank Li
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Mon, Jun 29, 2026 at 03:42:31PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
Quoted 2 lines · Guoniu Zhou
This patch series enhances the i.MX ISI driver's with virtual channel support and adds frame descriptor capabilities to the crossbar subdevice.
Quoted 7 lines
Quoted 4 lines
Applied, thanks!
[1/2] media: imx8-isi: crossbar: Add
get_frame_descoperationcommit: 3e15a3510908c990ee352aa206d5f9c23d4b216eIs this a mistake ? Patch 1/2 has no R-b tag, and you're not listed as maintainer for this driver.
Quoted 7 lines
Sorry, I missed checking Maintainer files, in media summit, agree on I pick imx's media drivers, but forget finalize the file\dir list. Can you help summery which files\dir I should take care?
If you have concern about this patch, I can drop it.
Frank
You should set yourself up here: https://patchwork.linuxtv.org/project/linux-media/list/
That way you can coordinate with other maintainers on which files get reviewed by whom, see what the RB and ci status is.
Its pretty essential.
---
bod
Re: (subset) [PATCH v5 0/2] media: nxp: imx8-isi: Add virtual channel and frame descriptor support
Quoted 22 lines · Bryan O'Donoghue
Quoted 21 lines · Frank Li
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Mon, Jun 29, 2026 at 03:42:31PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
Quoted 2 lines · Guoniu Zhou
This patch series enhances the i.MX ISI driver's with virtual channel support and adds frame descriptor capabilities to the crossbar subdevice.
Quoted 7 lines
Quoted 4 lines
Applied, thanks!
[1/2] media: imx8-isi: crossbar: Add
get_frame_descoperationcommit: 3e15a3510908c990ee352aa206d5f9c23d4b216eIs this a mistake ? Patch 1/2 has no R-b tag, and you're not listed as maintainer for this driver.
Sorry, I missed checking Maintainer files, in media summit, agree on I pick imx's media drivers, but forget finalize the file\dir list. Can you help summery which files\dir I should take care?
Quoted 5 lines
Quoted 3 lines
If you have concern about this patch, I can drop it.
Frank
You should set yourself up here:
https://patchwork.linuxtv.org/project/linux-media/list/
I just register it.
"Registration successful!
A confirmation email has been sent to [email protected]. You'll need to visit the link provided in that email to confirm your registration."
I have not recieved such confirm email. Anything wrong?
Frank
Quoted 8 lines
That way you can coordinate with other maintainers on which files get reviewed by whom, see what the RB and ci status is.
Its pretty essential.
---
bod
Re: (subset) [PATCH v5 0/2] media: nxp: imx8-isi: Add virtual channel and frame descriptor support
Quoted 29 lines · Frank Li
Quoted 22 lines · Bryan O'Donoghue
Quoted 21 lines · Frank Li
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Mon, Jun 29, 2026 at 03:42:31PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
Quoted 2 lines · Guoniu Zhou
This patch series enhances the i.MX ISI driver's with virtual channel support and adds frame descriptor capabilities to the crossbar subdevice.
Quoted 7 lines
Quoted 4 lines
Applied, thanks!
[1/2] media: imx8-isi: crossbar: Add
get_frame_descoperationcommit: 3e15a3510908c990ee352aa206d5f9c23d4b216eIs this a mistake ? Patch 1/2 has no R-b tag, and you're not listed as maintainer for this driver.
Sorry, I missed checking Maintainer files, in media summit, agree on I pick imx's media drivers, but forget finalize the file\dir list. Can you help summery which files\dir I should take care?
Quoted 5 lines
Quoted 3 lines
If you have concern about this patch, I can drop it.
Frank
You should set yourself up here:
https://patchwork.linuxtv.org/project/linux-media/list/
Quoted 7 lines
I just register it.
"Registration successful!
A confirmation email has been sent to [email protected]. You'll need to visit the link provided in that email to confirm your registration."
I have not recieved such confirm email. Anything wrong?
I just got it. But I am not in delegate list yet.
Frank
Quoted 13 lines
Frank
Quoted 8 lines
That way you can coordinate with other maintainers on which files get reviewed by whom, see what the RB and ci status is.
Its pretty essential.
---
bod
Laurent Pinchart
maintainerRe: (subset) [PATCH v5 0/2] media: nxp: imx8-isi: Add virtual channel and frame descriptor support
In reply to Frank LiQuoted 14 lines · Frank Li
Quoted 13 lines · Laurent Pinchart
Quoted 11 lines · On Mon, Jun 29, 2026 at 03:42:31PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
Quoted 2 lines · Guoniu Zhou
This patch series enhances the i.MX ISI driver's with virtual channel support and adds frame descriptor capabilities to the crossbar subdevice.
Applied, thanks!
[1/2] media: imx8-isi: crossbar: Add
get_frame_descoperationcommit: 3e15a3510908c990ee352aa206d5f9c23d4b216e
Quoted 8 lines
Quoted 2 lines
Is this a mistake ? Patch 1/2 has no R-b tag, and you're not listed as maintainer for this driver.
Sorry, I missed checking Maintainer files, in media summit, agree on I pick imx's media drivers, but forget finalize the file\dir list. Can you help summery which files\dir I should take care?
If you have concern about this patch, I can drop it.
I would appreciate if you did. I'm collecting ISI patches for the next merge window, I'd like to avoid conflicts.
Signature · 3 lines
Regards, Laurent Pinchart