media_pad_remote_pad_first(av->vdev.entity.pads);
struct v4l2_mbus_framefmt format;
struct v4l2_subdev *sd;
- u32 r_stream, code;
+ u32 r_stream = 0, code;
int ret;
if (!remote_pad)
return -ENOTCONN;
sd = media_entity_to_v4l2_subdev(remote_pad->entity);
- r_stream = ipu7_isys_get_src_stream_by_src_pad(sd, remote_pad->index);
ret = ipu7_isys_get_stream_pad_fmt(sd, remote_pad->index, r_stream,
&format);
.code = MEDIA_BUS_FMT_SGRBG10_1X10,
.field = V4L2_FIELD_NONE,
};
+ struct v4l2_subdev_route *route;
int ret;
ret = v4l2_subdev_routing_validate(sd, routing,
- V4L2_SUBDEV_ROUTING_ONLY_1_TO_1);
+ V4L2_SUBDEV_ROUTING_ONLY_1_TO_1 |
+ V4L2_SUBDEV_ROUTING_NO_SOURCE_MULTIPLEXING);
if (ret)
return ret;
+ /*
+ * The device doesn't support source multiplexing, set all source
+ * streams to 0 to simplify stream handling through the driver.
+ */
+ for_each_active_route(routing, route)
+ route->source_stream = 0;
+
return v4l2_subdev_set_routing_with_fmt(sd, state, routing, &fmt);
}
return fmt ? 0 : -EINVAL;
}
-u32 ipu7_isys_get_src_stream_by_src_pad(struct v4l2_subdev *sd, u32 pad)
-{
- struct v4l2_subdev_state *state;
- struct v4l2_subdev_route *routes;
- u32 source_stream = 0;
- unsigned int i;
-
- state = v4l2_subdev_lock_and_get_active_state(sd);
- if (!state)
- return 0;
-
- routes = state->routing.routes;
- for (i = 0; i < state->routing.num_routes; i++) {
- if (routes[i].source_pad == pad) {
- source_stream = routes[i].source_stream;
- break;
- }
- }
-
- v4l2_subdev_unlock_state(state);
-
- return source_stream;
-}
-
static int ipu7_isys_subdev_init_state(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state)
{
struct v4l2_subdev_state *state,
struct v4l2_subdev_mbus_code_enum
*code);
-u32 ipu7_isys_get_src_stream_by_src_pad(struct v4l2_subdev *sd, u32 pad);
int ipu7_isys_get_stream_pad_fmt(struct v4l2_subdev *sd, u32 pad, u32 stream,
struct v4l2_mbus_framefmt *format);
int ipu7_isys_subdev_set_routing(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *s_fmt;
struct v4l2_subdev *s_sd;
struct media_pad *s_pad;
- u32 s_stream, code;
+ u32 s_stream = 0, code;
int ret = -EPIPE;
if (!link->source->entity)
link->sink->entity->name);
s_pad = media_pad_remote_pad_first(&av->pad);
- s_stream = ipu7_isys_get_src_stream_by_src_pad(s_sd, s_pad->index);
v4l2_subdev_lock_state(s_state);
struct device *dev = &isys->adev->auxdev.dev;
struct v4l2_mbus_framefmt fmt;
int output_pins;
- u32 src_stream;
+ u32 src_stream = 0;
int ret;
- src_stream = ipu7_isys_get_src_stream_by_src_pad(sd, src_pad->index);
ret = ipu7_isys_get_stream_pad_fmt(sd, src_pad->index, src_stream,
&fmt);
if (ret < 0) {
return stream;
}
-static u32 get_remote_pad_stream(struct media_pad *r_pad)
-{
- struct v4l2_subdev_state *state;
- struct v4l2_subdev *sd;
- u32 stream_id = 0;
- unsigned int i;
-
- sd = media_entity_to_v4l2_subdev(r_pad->entity);
- state = v4l2_subdev_lock_and_get_active_state(sd);
- if (!state)
- return 0;
-
- for (i = 0; i < state->stream_configs.num_configs; i++) {
- struct v4l2_subdev_stream_config *cfg =
- &state->stream_configs.configs[i];
- if (cfg->pad == r_pad->index) {
- stream_id = cfg->stream;
- break;
- }
- }
-
- v4l2_subdev_unlock_state(state);
-
- return stream_id;
-}
-
int ipu7_isys_video_set_streaming(struct ipu7_isys_video *av, int state,
struct ipu7_isys_buffer_list *bl)
{
struct device *dev = &av->isys->adev->auxdev.dev;
struct media_pad *r_pad;
struct v4l2_subdev *sd;
- u32 r_stream;
+ u32 r_stream = 0;
int ret = 0;
dev_dbg(dev, "set stream: %d\n", state);
sd = &stream->asd->sd;
r_pad = media_pad_remote_pad_first(&av->pad);
- r_stream = get_remote_pad_stream(r_pad);
if (!state) {
stop_streaming_firmware(av);