[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221215121634.287100-15-tomi.valkeinen@ideasonboard.com>
Date: Thu, 15 Dec 2022 14:16:28 +0200
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
sakari.ailus@...ux.intel.com,
Jacopo Mondi <jacopo+renesas@...ndi.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
niklas.soderlund+renesas@...natech.se,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
satish.nagireddy@...cruise.com, Tomasz Figa <tfiga@...omium.org>
Cc: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
Subject: [PATCH v16 14/20] media: subdev: add streams to v4l2_subdev_get_fmt() helper function
Add streams support to v4l2_subdev_get_fmt() helper function. Subdev
drivers that do not need to do anything special in their get_fmt op can
use this helper directly for v4l2_subdev_pad_ops.get_fmt.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
---
drivers/media/v4l2-core/v4l2-subdev.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 458124da9c5b..c02048e388d1 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1389,10 +1389,14 @@ int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state,
{
struct v4l2_mbus_framefmt *fmt;
- if (format->pad >= sd->entity.num_pads)
- return -EINVAL;
+ if (sd->flags & V4L2_SUBDEV_FL_STREAMS)
+ fmt = v4l2_subdev_state_get_stream_format(state, format->pad,
+ format->stream);
+ else if (format->pad < sd->entity.num_pads && format->stream == 0)
+ fmt = v4l2_subdev_get_pad_format(sd, state, format->pad);
+ else
+ fmt = NULL;
- fmt = v4l2_subdev_get_pad_format(sd, state, format->pad);
if (!fmt)
return -EINVAL;
--
2.34.1
Powered by blists - more mailing lists