From: Frank Li <Frank.li@nxp.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, Rui Miguel Silva <rmfrfs@gmail.com>,
Martin Kepplinger <martink@posteo.de>,
Purism Kernel Team <kernel@puri.sm>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
imx@lists.linux.dev, Stefan Klug <stefan.klug@ideasonboard.com>,
Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: [PATCH v1 3/6] media: imx-mipi-csis: Implement the .set_routing() operation
Date: Fri, 7 Nov 2025 15:38:53 -0500 [thread overview]
Message-ID: <aQ5Y3Qb/6OdQViOS@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20251107183014.GC5558@pendragon.ideasonboard.com>
On Fri, Nov 07, 2025 at 08:30:14PM +0200, Laurent Pinchart wrote:
> On Fri, Nov 07, 2025 at 11:36:18AM -0500, Frank Li wrote:
> > On Fri, Nov 07, 2025 at 03:58:10AM +0200, Laurent Pinchart wrote:
> > > To prepare for multi-stream support, implement the .set_routing()
> > > operation. The routing table is currently hardcoded to a single route.
> > >
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > ---
> > > drivers/media/platform/nxp/imx-mipi-csis.c | 73 ++++++++++++++++++----
> > > 1 file changed, 60 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> > > index f142e79acbcf..f4b19576a235 100644
> > > --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> > > +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> > > @@ -1154,6 +1154,52 @@ static int mipi_csis_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> > > return 0;
> > > }
> > >
> > > +static int __mipi_csis_set_routing(struct v4l2_subdev *sd,
> > > + struct v4l2_subdev_state *state,
> > > + struct v4l2_subdev_krouting *routing)
> > > +{
> > > + static const struct v4l2_mbus_framefmt format = {
> > > + .width = MIPI_CSIS_DEF_PIX_WIDTH,
> > > + .height = MIPI_CSIS_DEF_PIX_HEIGHT,
> > > + .code = mipi_csis_formats[0].code,
> > > + .field = V4L2_FIELD_NONE,
> > > + .colorspace = V4L2_XFER_FUNC_709,
> > > + .ycbcr_enc = V4L2_YCBCR_ENC_601,
> >
> > Is it same as V4L2_MAP_YCBCR_ENC_DEFAULT(fmt.format.colorspace)
> >
> > > + .quantization = V4L2_QUANTIZATION_LIM_RANGE,
> >
> > Is it same as
> > V4L2_MAP_QUANTIZATION_DEFAULT(false, fmt.format.colorspace,
> > fmt.format.ycbcr_enc);
> >
> > > + .xfer_func = V4L2_XFER_FUNC_SRGB,
> >
> > Is it same as
> > V4L2_MAP_XFER_FUNC_DEFAULT(fmt.format.colorspace);
>
> Yes, they're the same.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> > > + };
> > > + int ret;
> > > +
> > > + ret = v4l2_subdev_routing_validate(sd, routing,
> > > + V4L2_SUBDEV_ROUTING_NO_1_TO_N);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + /* Only a single route is supported for now. */
> > > + if (routing->num_routes != 1 ||
> > > + !(routing->routes[0].flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE))
> > > + return -EINVAL;
> > > +
> > > + ret = v4l2_subdev_set_routing_with_fmt(sd, state, routing, &format);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static int mipi_csis_set_routing(struct v4l2_subdev *sd,
> > > + struct v4l2_subdev_state *state,
> > > + enum v4l2_subdev_format_whence which,
> > > + struct v4l2_subdev_krouting *routing)
> > > +{
> > > + struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
> > > +
> > > + if (which == V4L2_SUBDEV_FORMAT_ACTIVE && csis->source.enabled_streams)
> > > + return -EBUSY;
> > > +
> > > + return __mipi_csis_set_routing(sd, state, routing);
> > > +}
> > > +
> > > static int mipi_csis_enable_streams(struct v4l2_subdev *sd,
> > > struct v4l2_subdev_state *state,
> > > u32 pad, u64 streams_mask)
> > > @@ -1240,22 +1286,22 @@ static int mipi_csis_disable_streams(struct v4l2_subdev *sd,
> > > static int mipi_csis_init_state(struct v4l2_subdev *sd,
> > > struct v4l2_subdev_state *state)
> > > {
> > > - struct v4l2_subdev_format fmt = {
> > > - .pad = CSIS_PAD_SINK,
> > > + struct v4l2_subdev_route routes[] = {
> > > + {
> > > + .sink_pad = CSIS_PAD_SINK,
> > > + .sink_stream = 0,
> > > + .source_pad = CSIS_PAD_SOURCE,
> > > + .source_stream = 0,
> > > + .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
> > > + },
> > > };
> > >
> > > - fmt.format.code = mipi_csis_formats[0].code;
> > > - fmt.format.width = MIPI_CSIS_DEF_PIX_WIDTH;
> > > - fmt.format.height = MIPI_CSIS_DEF_PIX_HEIGHT;
> > > + struct v4l2_subdev_krouting routing = {
> > > + .num_routes = ARRAY_SIZE(routes),
> > > + .routes = routes,
> > > + };
> > >
> > > - fmt.format.colorspace = V4L2_COLORSPACE_SMPTE170M;
> > > - fmt.format.xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt.format.colorspace);
> > > - fmt.format.ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt.format.colorspace);
> > > - fmt.format.quantization =
> > > - V4L2_MAP_QUANTIZATION_DEFAULT(false, fmt.format.colorspace,
> > > - fmt.format.ycbcr_enc);
> > > -
> > > - return mipi_csis_set_fmt(sd, state, &fmt);
> > > + return __mipi_csis_set_routing(sd, state, &routing);
> > > }
> > >
> > > static int mipi_csis_log_status(struct v4l2_subdev *sd)
> > > @@ -1297,6 +1343,7 @@ static const struct v4l2_subdev_pad_ops mipi_csis_pad_ops = {
> > > .get_fmt = v4l2_subdev_get_fmt,
> > > .set_fmt = mipi_csis_set_fmt,
> > > .get_frame_desc = mipi_csis_get_frame_desc,
> > > + .set_routing = mipi_csis_set_routing,
> > > .enable_streams = mipi_csis_enable_streams,
> > > .disable_streams = mipi_csis_disable_streams,
> > > };
>
> --
> Regards,
>
> Laurent Pinchart
next prev parent reply other threads:[~2025-11-07 20:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 1:58 [PATCH v1 0/6] media: imx-mipi-csis: Add streams support Laurent Pinchart
2025-11-07 1:58 ` [PATCH v1 1/6] media: imx-mipi-csis: Add VC-related register fields Laurent Pinchart
2025-11-07 16:19 ` Frank Li
2025-11-07 18:44 ` Laurent Pinchart
2025-11-07 20:37 ` Frank Li
2025-11-07 1:58 ` [PATCH v1 2/6] media: imx-mipi-csis: Switch to .enable_streams() Laurent Pinchart
2025-11-07 16:29 ` Frank Li
2025-11-07 18:32 ` Laurent Pinchart
2025-11-07 1:58 ` [PATCH v1 3/6] media: imx-mipi-csis: Implement the .set_routing() operation Laurent Pinchart
2025-11-07 16:36 ` Frank Li
2025-11-07 18:30 ` Laurent Pinchart
2025-11-07 20:38 ` Frank Li [this message]
2025-11-09 21:48 ` kernel test robot
2025-11-07 1:58 ` [PATCH v1 4/6] media: imx-mipi-csis: Group runtime parameters in structure Laurent Pinchart
2025-11-07 16:40 ` Frank Li
2025-11-07 1:58 ` [PATCH v1 5/6] media: imx-mipi-csis: Set all per-channel registers in one function Laurent Pinchart
2025-11-07 16:37 ` Frank Li
2025-11-07 1:58 ` [PATCH v1 6/6] media: imx-mipi-csis: Add multi-channel support Laurent Pinchart
2025-11-07 16:48 ` Frank Li
2025-11-07 18:43 ` Laurent Pinchart
2025-11-20 3:12 ` G.N. Zhou
2025-11-20 15:23 ` Frank Li
2025-11-20 16:22 ` Laurent Pinchart
2025-12-02 0:59 ` [EXT] " G.N. Zhou
2025-11-07 9:31 ` [PATCH v1 0/6] media: imx-mipi-csis: Add streams support Martin Kepplinger
2025-11-07 18:28 ` Laurent Pinchart
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=aQ5Y3Qb/6OdQViOS@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=kernel@puri.sm \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=martink@posteo.de \
--cc=rmfrfs@gmail.com \
--cc=sakari.ailus@iki.fi \
--cc=stefan.klug@ideasonboard.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