mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
media: subdev: add v4l2_subdev_set_routing_with_fmt() helper
v4l2_subdev_set_routing_with_fmt() is the same as v4l2_subdev_set_routing(), but additionally initializes all the streams with the given format. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
72c5fbcaa3
commit
5b0d85b379
@@ -1481,6 +1481,28 @@ __v4l2_subdev_next_active_route(const struct v4l2_subdev_krouting *routing,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__v4l2_subdev_next_active_route);
|
||||
|
||||
int v4l2_subdev_set_routing_with_fmt(struct v4l2_subdev *sd,
|
||||
struct v4l2_subdev_state *state,
|
||||
struct v4l2_subdev_krouting *routing,
|
||||
const struct v4l2_mbus_framefmt *fmt)
|
||||
{
|
||||
struct v4l2_subdev_stream_configs *stream_configs;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
ret = v4l2_subdev_set_routing(sd, state, routing);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
stream_configs = &state->stream_configs;
|
||||
|
||||
for (i = 0; i < stream_configs->num_configs; ++i)
|
||||
stream_configs->configs[i].fmt = *fmt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_subdev_set_routing_with_fmt);
|
||||
|
||||
struct v4l2_mbus_framefmt *
|
||||
v4l2_subdev_state_get_stream_format(struct v4l2_subdev_state *state,
|
||||
unsigned int pad, u32 stream)
|
||||
|
||||
@@ -1486,6 +1486,22 @@ __v4l2_subdev_next_active_route(const struct v4l2_subdev_krouting *routing,
|
||||
for ((route) = NULL; \
|
||||
((route) = __v4l2_subdev_next_active_route((routing), (route)));)
|
||||
|
||||
/**
|
||||
* v4l2_subdev_set_routing_with_fmt() - Set given routing and format to subdev
|
||||
* state
|
||||
* @sd: The subdevice
|
||||
* @state: The subdevice state
|
||||
* @routing: Routing that will be copied to subdev state
|
||||
* @fmt: Format used to initialize all the streams
|
||||
*
|
||||
* This is the same as v4l2_subdev_set_routing, but additionally initializes
|
||||
* all the streams using the given format.
|
||||
*/
|
||||
int v4l2_subdev_set_routing_with_fmt(struct v4l2_subdev *sd,
|
||||
struct v4l2_subdev_state *state,
|
||||
struct v4l2_subdev_krouting *routing,
|
||||
const struct v4l2_mbus_framefmt *fmt);
|
||||
|
||||
/**
|
||||
* v4l2_subdev_state_get_stream_format() - Get pointer to a stream format
|
||||
* @state: subdevice state
|
||||
|
||||
Reference in New Issue
Block a user