[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251216-rcar-streams-v4-7-f28b4831cc67@ideasonboard.com>
Date: Tue, 16 Dec 2025 17:18:24 +0200
From: Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
To: Niklas Söderlund <niklas.soderlund@...natech.se>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: linux-media@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Niklas Söderlund <niklas.soderlund+renesas@...natech.se>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Jacopo Mondi <jacopo.mondi@...asonboard.com>,
Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
Subject: [PATCH v4 07/15] media: rcar-isp: Move {enable|disable}_streams()
calls
With multiple streams the operation to enable the ISP hardware and to
call {enable|disable}_streams() on upstream subdev will need to be
handled separately.
Prepare for that by moving {enable|disable}_streams() calls out from
risp_start() and risp_stop().
On Gen4, a side effect of this change is that if the sink side devices
call .enable_streams() on rcar-isp multiple times, the second call will
fail. This is because we always use stream ID 0, so the second call
would attempt to enable the same stream again, leading to an error. In
other words, a normal single-stream setup continues to work, but trying
to use the current driver's custom VC based routing will fail.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
---
drivers/media/platform/renesas/rcar-isp/csisp.c | 27 ++++++++++++++++---------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/media/platform/renesas/rcar-isp/csisp.c b/drivers/media/platform/renesas/rcar-isp/csisp.c
index 8fb2cc3b5650..58a9a3bd9f75 100644
--- a/drivers/media/platform/renesas/rcar-isp/csisp.c
+++ b/drivers/media/platform/renesas/rcar-isp/csisp.c
@@ -268,18 +268,11 @@ static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state)
/* Start ISP. */
risp_write_cs(isp, ISPSTART_REG, ISPSTART_START);
- ret = v4l2_subdev_enable_streams(isp->remote, isp->remote_pad,
- BIT_ULL(0));
- if (ret)
- risp_power_off(isp);
-
- return ret;
+ return 0;
}
static void risp_stop(struct rcar_isp *isp)
{
- v4l2_subdev_disable_streams(isp->remote, isp->remote_pad, BIT_ULL(0));
-
/* Stop ISP. */
risp_write_cs(isp, ISPSTART_REG, ISPSTART_STOP);
@@ -291,7 +284,7 @@ static int risp_enable_streams(struct v4l2_subdev *sd,
u64 source_streams_mask)
{
struct rcar_isp *isp = sd_to_isp(sd);
- int ret = 0;
+ int ret;
if (source_streams_mask != 1)
return -EINVAL;
@@ -305,9 +298,17 @@ static int risp_enable_streams(struct v4l2_subdev *sd,
return ret;
}
+ ret = v4l2_subdev_enable_streams(isp->remote, isp->remote_pad,
+ BIT_ULL(0));
+ if (ret) {
+ if (isp->stream_count == 0)
+ risp_stop(isp);
+ return ret;
+ }
+
isp->stream_count += 1;
- return ret;
+ return 0;
}
static int risp_disable_streams(struct v4l2_subdev *sd,
@@ -315,6 +316,7 @@ static int risp_disable_streams(struct v4l2_subdev *sd,
u64 source_streams_mask)
{
struct rcar_isp *isp = sd_to_isp(sd);
+ int ret;
if (source_streams_mask != 1)
return -EINVAL;
@@ -322,6 +324,11 @@ static int risp_disable_streams(struct v4l2_subdev *sd,
if (!isp->remote)
return -ENODEV;
+ ret = v4l2_subdev_disable_streams(isp->remote, isp->remote_pad,
+ BIT_ULL(0));
+ if (ret)
+ return ret;
+
if (isp->stream_count == 1)
risp_stop(isp);
--
2.43.0
Powered by blists - more mailing lists