From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7139E36B056; Wed, 18 Mar 2026 21:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773868343; cv=none; b=PDSPg2EIJ3nle7yE1WoP1fTsGGPD3JXydc5V3jiqxMxQCammotAP/4fGUZLRtJj34zUEG1u0YAzgUU1TUQNwEAZ7N8gJOJg62nZ83h3w3A5aDOvPFvYJ5gdlAsoqFo8CbdaUu/jBNJ0X47IbtAjUxtx7NvsviI+SW39O/uiFYXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773868343; c=relaxed/simple; bh=zg/3t0qp8+ciCvlKuslm/cMGKcZ+aYB36gIJbtqY+1E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IlhOQq2jWSkqCDNmfNnu56jVZL9hDnz8jg+9OlhoPwUQS2XAOJLrPVw7CNpnzCy57vuFYbRXs1msPHOK1p+OK0IdZb9i7+GYumj2QeEooqrJNny4ZY2Wab9LlowGmq/cbXScj5BS+3qKp1Tc9qoW45NkyqSAz2f4ppRBXuX8AcA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=AJM0GXe2; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AJM0GXe2" Received: from killaraus.ideasonboard.com (2001-14ba-703d-e500--2a1.rev.dnainternet.fi [IPv6:2001:14ba:703d:e500::2a1]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 60448379; Wed, 18 Mar 2026 22:11:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1773868267; bh=zg/3t0qp8+ciCvlKuslm/cMGKcZ+aYB36gIJbtqY+1E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AJM0GXe2sxbzyKf3zm0E51gupyQzyALgDSOkYVgwS2sNp8ByoFnfAhmTGbpdSBwRt KWtSEWp+kwnI4TksZ9/B4fJOGpIzN4EiV8IpU1tdE5CSK9KGCk/DyfCcueCPYyahFT loxI/Oi7BuovJTCSeTqcasfJk4uWFyfZguQGG4BE= Date: Wed, 18 Mar 2026 23:12:18 +0200 From: Laurent Pinchart To: Tomi Valkeinen Cc: Niklas =?utf-8?Q?S=C3=B6derlund?= , Mauro Carvalho Chehab , Sakari Ailus , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Niklas =?utf-8?Q?S=C3=B6derlund?= , Mauro Carvalho Chehab , Jacopo Mondi Subject: Re: [PATCH v5 05/10] media: rcar-isp: Switch to Streams API Message-ID: <20260318211218.GI716464@killaraus.ideasonboard.com> References: <20260311-rcar-streams-v5-0-3e6c957d7567@ideasonboard.com> <20260311-rcar-streams-v5-5-3e6c957d7567@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260311-rcar-streams-v5-5-3e6c957d7567@ideasonboard.com> On Wed, Mar 11, 2026 at 03:53:18PM +0200, Tomi Valkeinen wrote: > Switch to Streams API with a single hardcoded route. > > For single-stream use case there should be no change in behavior. > > Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart > --- > drivers/media/platform/renesas/rcar-isp/csisp.c | 69 ++++++++++++++++++++++--- > 1 file changed, 62 insertions(+), 7 deletions(-) > > diff --git a/drivers/media/platform/renesas/rcar-isp/csisp.c b/drivers/media/platform/renesas/rcar-isp/csisp.c > index 58a9a3bd9f75..8ac45516aa39 100644 > --- a/drivers/media/platform/renesas/rcar-isp/csisp.c > +++ b/drivers/media/platform/renesas/rcar-isp/csisp.c > @@ -124,6 +124,17 @@ static const struct rcar_isp_format rcar_isp_formats[] = { > }, > }; > > +static const struct v4l2_mbus_framefmt risp_default_fmt = { > + .width = 1920, > + .height = 1080, > + .code = MEDIA_BUS_FMT_RGB888_1X24, > + .colorspace = V4L2_COLORSPACE_SRGB, > + .field = V4L2_FIELD_NONE, > + .ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT, > + .quantization = V4L2_QUANTIZATION_DEFAULT, > + .xfer_func = V4L2_XFER_FUNC_DEFAULT, > +}; > + > static const struct rcar_isp_format *risp_code_to_fmt(unsigned int code) > { > unsigned int i; > @@ -216,13 +227,20 @@ static void risp_power_off(struct rcar_isp *isp) > > static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state) > { > + const struct v4l2_subdev_route *route; > const struct v4l2_mbus_framefmt *fmt; > const struct rcar_isp_format *format; > unsigned int vc; > u32 sel_csi = 0; > int ret; > > - fmt = v4l2_subdev_state_get_format(state, RCAR_ISP_SINK); > + if (state->routing.num_routes != 1) > + return -EINVAL; > + > + route = &state->routing.routes[0]; > + > + fmt = v4l2_subdev_state_get_format(state, route->sink_pad, > + route->sink_stream); > if (!fmt) > return -EINVAL; > > @@ -341,7 +359,7 @@ static int risp_set_pad_format(struct v4l2_subdev *sd, > struct v4l2_subdev_state *state, > struct v4l2_subdev_format *format) > { > - struct v4l2_mbus_framefmt *framefmt; > + struct v4l2_mbus_framefmt *fmt; > > if (format->pad > RCAR_ISP_SINK) > return v4l2_subdev_get_fmt(sd, state, format); > @@ -349,10 +367,20 @@ static int risp_set_pad_format(struct v4l2_subdev *sd, > if (!risp_code_to_fmt(format->format.code)) > format->format.code = rcar_isp_formats[0].code; > > - for (unsigned int i = 0; i < RCAR_ISP_NUM_PADS; i++) { > - framefmt = v4l2_subdev_state_get_format(state, i); > - *framefmt = format->format; > - } > + /* Set sink format. */ > + fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream); > + if (!fmt) > + return -EINVAL; > + > + *fmt = format->format; > + > + /* Propagate the format to the source pad. */ > + fmt = v4l2_subdev_state_get_opposite_stream_format(state, format->pad, > + format->stream); > + if (!fmt) > + return -EINVAL; > + > + *fmt = format->format; > > return 0; > } > @@ -369,6 +397,32 @@ static const struct v4l2_subdev_ops rcar_isp_subdev_ops = { > .pad = &risp_pad_ops, > }; > > +static int risp_init_state(struct v4l2_subdev *sd, > + struct v4l2_subdev_state *state) > +{ > + static struct v4l2_subdev_route routes[] = { > + { > + .sink_pad = RCAR_ISP_SINK, > + .sink_stream = 0, > + .source_pad = RCAR_ISP_PORT0, > + .source_stream = 0, > + .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE, > + }, > + }; > + > + static const struct v4l2_subdev_krouting routing = { > + .num_routes = ARRAY_SIZE(routes), > + .routes = routes, > + }; > + > + return v4l2_subdev_set_routing_with_fmt(sd, state, &routing, > + &risp_default_fmt); > +} > + > +static const struct v4l2_subdev_internal_ops risp_internal_ops = { > + .init_state = risp_init_state, > +}; > + > /* ----------------------------------------------------------------------------- > * Async handling and registration of subdevices and links > */ > @@ -526,11 +580,12 @@ static int risp_probe(struct platform_device *pdev) > > isp->subdev.owner = THIS_MODULE; > isp->subdev.dev = &pdev->dev; > + isp->subdev.internal_ops = &risp_internal_ops; > v4l2_subdev_init(&isp->subdev, &rcar_isp_subdev_ops); > v4l2_set_subdevdata(&isp->subdev, &pdev->dev); > snprintf(isp->subdev.name, sizeof(isp->subdev.name), "%s %s", > KBUILD_MODNAME, dev_name(&pdev->dev)); > - isp->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE; > + isp->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS; > > isp->subdev.entity.function = MEDIA_ENT_F_VID_MUX; > isp->subdev.entity.ops = &risp_entity_ops; > -- Regards, Laurent Pinchart