From: Frank Li <Frank.li@nxp.com>
To: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
Cc: Michael Riesch <michael.riesch@collabora.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Mehdi Djait <mehdi.djait@linux.intel.com>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v2 4/7] media: synopsys: Add support for multiple streams
Date: Fri, 24 Apr 2026 00:01:10 -0400 [thread overview]
Message-ID: <aerrBngobmHHktNU@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260423-csi2_imx95-v2-4-934c02f3422a@oss.nxp.com>
On Thu, Apr 23, 2026 at 04:22:59PM +0800, Guoniu Zhou wrote:
> The current driver only supports single stream operation. Add support
> for multiple concurrent streams by tracking enabled streams with a
> bitmask and only initializing the hardware once for the first stream.
>
> This enables use cases such as surround view systems where multiple
> camera streams need to be processed simultaneously through the same
> CSI-2 receiver interface.
>
> Signed-off-by: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Changes in v2:
> - Simplify error handling by keeping goto labels instead of early returns
> ---
> drivers/media/platform/synopsys/dw-mipi-csi2rx.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
> index d572d2eb3bcb..5a2e74d055c0 100644
> --- a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
> +++ b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
> @@ -113,6 +113,7 @@ struct dw_mipi_csi2rx_device {
>
> enum v4l2_mbus_type bus_type;
> u32 lanes_num;
> + u64 enabled_streams;
>
> const struct dw_mipi_csi2rx_drvdata *drvdata;
> };
> @@ -537,20 +538,26 @@ static int dw_mipi_csi2rx_enable_streams(struct v4l2_subdev *sd,
> if (ret)
> goto err;
>
> - ret = dw_mipi_csi2rx_start(csi2);
> - if (ret) {
> - dev_err(dev, "failed to enable CSI hardware\n");
> - goto err_pm_runtime_put;
> + if (!csi2->enabled_streams) {
> + ret = dw_mipi_csi2rx_start(csi2);
> + if (ret) {
> + dev_err(dev, "failed to enable CSI hardware\n");
> + goto err_pm_runtime_put;
> + }
> }
>
> ret = v4l2_subdev_enable_streams(remote_sd, remote_pad->index, mask);
> if (ret)
> goto err_csi_stop;
>
> + csi2->enabled_streams |= streams_mask;
> +
> return 0;
>
> err_csi_stop:
> - dw_mipi_csi2rx_stop(csi2);
> + /* Stop CSI hardware if no streams are enabled */
> + if (!csi2->enabled_streams)
> + dw_mipi_csi2rx_stop(csi2);
> err_pm_runtime_put:
> pm_runtime_put(dev);
> err:
> @@ -577,11 +584,16 @@ static int dw_mipi_csi2rx_disable_streams(struct v4l2_subdev *sd,
> &streams_mask);
>
> ret = v4l2_subdev_disable_streams(remote_sd, remote_pad->index, mask);
> + if (ret)
> + dev_err(dev, "failed to disable streams on remote subdev: %d\n", ret);
>
> - dw_mipi_csi2rx_stop(csi2);
> + csi2->enabled_streams &= ~streams_mask;
>
> pm_runtime_put(dev);
>
> + if (!csi2->enabled_streams)
> + dw_mipi_csi2rx_stop(csi2);
> +
> return ret;
> }
>
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-04-24 4:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 8:22 [PATCH v2 0/7] media: synopsys: enhancements and i.MX95 support Guoniu Zhou
2026-04-23 8:22 ` [PATCH v2 1/7] media: synopsys: Fix out-of-bounds check in enum_mbus_code Guoniu Zhou
2026-04-24 3:57 ` Frank Li
2026-04-23 8:22 ` [PATCH v2 2/7] media: synopsys: Fix IPI using hardcoded datatype Guoniu Zhou
2026-04-24 3:58 ` Frank Li
2026-04-23 8:22 ` [PATCH v2 3/7] media: synopsys: Add support for RAW16 Bayer formats Guoniu Zhou
2026-04-24 3:59 ` Frank Li
2026-04-23 8:22 ` [PATCH v2 4/7] media: synopsys: Add support for multiple streams Guoniu Zhou
2026-04-24 4:01 ` Frank Li [this message]
2026-04-23 8:23 ` [PATCH v2 5/7] media: synopsys: Add PHY stopstate wait for i.MX93 Guoniu Zhou
2026-04-24 4:02 ` Frank Li
2026-04-23 8:23 ` [PATCH v2 6/7] media: dt-bindings: add NXP i.MX95 compatible string Guoniu Zhou
2026-04-24 4:05 ` Frank Li
2026-04-25 9:50 ` Krzysztof Kozlowski
2026-04-23 8:23 ` [PATCH v2 7/7] media: synopsys: Add support for i.MX95 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=aerrBngobmHHktNU@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=bryan.odonoghue@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=guoniu.zhou@oss.nxp.com \
--cc=heiko@sntech.de \
--cc=hverkuil+cisco@kernel.org \
--cc=imx@lists.linux.dev \
--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=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@linux.intel.com \
--cc=michael.riesch@collabora.com \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.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