Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: staging/ipu7: Disallow source multiplexing

The IPU7 ISYS driver can't capture multiple streams on the same video
device. Disallow source multiplexing in the routes of the internal
subdev to reflect that limitation. As a result we can hardcode the
source stream to 0, simplifying the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Laurent Pinchart and committed by
Hans Verkuil
49cec2b5 adc276c4

+14 -60
+1 -2
drivers/staging/media/ipu7/ipu7-isys-queue.c
··· 442 442 media_pad_remote_pad_first(av->vdev.entity.pads); 443 443 struct v4l2_mbus_framefmt format; 444 444 struct v4l2_subdev *sd; 445 - u32 r_stream, code; 445 + u32 r_stream = 0, code; 446 446 int ret; 447 447 448 448 if (!remote_pad) 449 449 return -ENOTCONN; 450 450 451 451 sd = media_entity_to_v4l2_subdev(remote_pad->entity); 452 - r_stream = ipu7_isys_get_src_stream_by_src_pad(sd, remote_pad->index); 453 452 454 453 ret = ipu7_isys_get_stream_pad_fmt(sd, remote_pad->index, r_stream, 455 454 &format);
+10 -25
drivers/staging/media/ipu7/ipu7-isys-subdev.c
··· 194 194 .code = MEDIA_BUS_FMT_SGRBG10_1X10, 195 195 .field = V4L2_FIELD_NONE, 196 196 }; 197 + struct v4l2_subdev_route *route; 197 198 int ret; 198 199 199 200 ret = v4l2_subdev_routing_validate(sd, routing, 200 - V4L2_SUBDEV_ROUTING_ONLY_1_TO_1); 201 + V4L2_SUBDEV_ROUTING_ONLY_1_TO_1 | 202 + V4L2_SUBDEV_ROUTING_NO_SOURCE_MULTIPLEXING); 201 203 if (ret) 202 204 return ret; 205 + 206 + /* 207 + * The device doesn't support source multiplexing, set all source 208 + * streams to 0 to simplify stream handling through the driver. 209 + */ 210 + for_each_active_route(routing, route) 211 + route->source_stream = 0; 203 212 204 213 return v4l2_subdev_set_routing_with_fmt(sd, state, routing, &fmt); 205 214 } ··· 229 220 v4l2_subdev_unlock_state(state); 230 221 231 222 return fmt ? 0 : -EINVAL; 232 - } 233 - 234 - u32 ipu7_isys_get_src_stream_by_src_pad(struct v4l2_subdev *sd, u32 pad) 235 - { 236 - struct v4l2_subdev_state *state; 237 - struct v4l2_subdev_route *routes; 238 - u32 source_stream = 0; 239 - unsigned int i; 240 - 241 - state = v4l2_subdev_lock_and_get_active_state(sd); 242 - if (!state) 243 - return 0; 244 - 245 - routes = state->routing.routes; 246 - for (i = 0; i < state->routing.num_routes; i++) { 247 - if (routes[i].source_pad == pad) { 248 - source_stream = routes[i].source_stream; 249 - break; 250 - } 251 - } 252 - 253 - v4l2_subdev_unlock_state(state); 254 - 255 - return source_stream; 256 223 } 257 224 258 225 static int ipu7_isys_subdev_init_state(struct v4l2_subdev *sd,
-1
drivers/staging/media/ipu7/ipu7-isys-subdev.h
··· 37 37 struct v4l2_subdev_state *state, 38 38 struct v4l2_subdev_mbus_code_enum 39 39 *code); 40 - u32 ipu7_isys_get_src_stream_by_src_pad(struct v4l2_subdev *sd, u32 pad); 41 40 int ipu7_isys_get_stream_pad_fmt(struct v4l2_subdev *sd, u32 pad, u32 stream, 42 41 struct v4l2_mbus_framefmt *format); 43 42 int ipu7_isys_subdev_set_routing(struct v4l2_subdev *sd,
+3 -32
drivers/staging/media/ipu7/ipu7-isys-video.c
··· 291 291 struct v4l2_mbus_framefmt *s_fmt; 292 292 struct v4l2_subdev *s_sd; 293 293 struct media_pad *s_pad; 294 - u32 s_stream, code; 294 + u32 s_stream = 0, code; 295 295 int ret = -EPIPE; 296 296 297 297 if (!link->source->entity) ··· 307 307 link->sink->entity->name); 308 308 309 309 s_pad = media_pad_remote_pad_first(&av->pad); 310 - s_stream = ipu7_isys_get_src_stream_by_src_pad(s_sd, s_pad->index); 311 310 312 311 v4l2_subdev_lock_state(s_state); 313 312 ··· 369 370 struct device *dev = &isys->adev->auxdev.dev; 370 371 struct v4l2_mbus_framefmt fmt; 371 372 int output_pins; 372 - u32 src_stream; 373 + u32 src_stream = 0; 373 374 int ret; 374 375 375 - src_stream = ipu7_isys_get_src_stream_by_src_pad(sd, src_pad->index); 376 376 ret = ipu7_isys_get_stream_pad_fmt(sd, src_pad->index, src_stream, 377 377 &fmt); 378 378 if (ret < 0) { ··· 779 781 return stream; 780 782 } 781 783 782 - static u32 get_remote_pad_stream(struct media_pad *r_pad) 783 - { 784 - struct v4l2_subdev_state *state; 785 - struct v4l2_subdev *sd; 786 - u32 stream_id = 0; 787 - unsigned int i; 788 - 789 - sd = media_entity_to_v4l2_subdev(r_pad->entity); 790 - state = v4l2_subdev_lock_and_get_active_state(sd); 791 - if (!state) 792 - return 0; 793 - 794 - for (i = 0; i < state->stream_configs.num_configs; i++) { 795 - struct v4l2_subdev_stream_config *cfg = 796 - &state->stream_configs.configs[i]; 797 - if (cfg->pad == r_pad->index) { 798 - stream_id = cfg->stream; 799 - break; 800 - } 801 - } 802 - 803 - v4l2_subdev_unlock_state(state); 804 - 805 - return stream_id; 806 - } 807 - 808 784 int ipu7_isys_video_set_streaming(struct ipu7_isys_video *av, int state, 809 785 struct ipu7_isys_buffer_list *bl) 810 786 { ··· 786 814 struct device *dev = &av->isys->adev->auxdev.dev; 787 815 struct media_pad *r_pad; 788 816 struct v4l2_subdev *sd; 789 - u32 r_stream; 817 + u32 r_stream = 0; 790 818 int ret = 0; 791 819 792 820 dev_dbg(dev, "set stream: %d\n", state); ··· 796 824 797 825 sd = &stream->asd->sd; 798 826 r_pad = media_pad_remote_pad_first(&av->pad); 799 - r_stream = get_remote_pad_stream(r_pad); 800 827 if (!state) { 801 828 stop_streaming_firmware(av); 802 829