aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vimc/vimc-streamer.c
diff options
context:
space:
mode:
authorHelen Fornazier <helen.koike@collabora.com>2019-03-06 17:42:43 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-03-19 16:33:07 -0400
commit6f3f3e11999b192e39404c49b584b7aca4cb1ecd (patch)
tree4bb57f79308b069701a01198c549694960a8c5ab /drivers/media/platform/vimc/vimc-streamer.c
parent43e3b726f5e1b34e4d6bdacc72fdde84cfffaf13 (diff)
media: vimc: stream: init/terminate the first entity
The s_stream callback was not being called for the first entity in the stream pipeline array. Instead of verifying the type of the node (video or subdevice) and calling s_stream from the second entity in the pipeline, do this process for all the entities in the pipeline for consistency. The previous code was not a problem because the first entity is a video device and not a subdevice, but this patch prepares vimc to allow setting some configuration in the entity before calling s_stream. Signed-off-by: Helen Koike <helen.koike@collabora.com> Tested-by: André Almeida <andre.almeida@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil-cisco@xs4all.nl: fix line-too-long warning] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/vimc/vimc-streamer.c')
-rw-r--r--drivers/media/platform/vimc/vimc-streamer.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
index b7c1fdef5f0d..6fc18fea2e45 100644
--- a/drivers/media/platform/vimc/vimc-streamer.c
+++ b/drivers/media/platform/vimc/vimc-streamer.c
@@ -46,19 +46,18 @@ static struct media_entity *vimc_get_source_entity(struct media_entity *ent)
46 */ 46 */
47static void vimc_streamer_pipeline_terminate(struct vimc_stream *stream) 47static void vimc_streamer_pipeline_terminate(struct vimc_stream *stream)
48{ 48{
49 struct media_entity *entity; 49 struct vimc_ent_device *ved;
50 struct v4l2_subdev *sd; 50 struct v4l2_subdev *sd;
51 51
52 while (stream->pipe_size) { 52 while (stream->pipe_size) {
53 stream->pipe_size--; 53 stream->pipe_size--;
54 entity = stream->ved_pipeline[stream->pipe_size]->ent; 54 ved = stream->ved_pipeline[stream->pipe_size];
55 entity = vimc_get_source_entity(entity);
56 stream->ved_pipeline[stream->pipe_size] = NULL; 55 stream->ved_pipeline[stream->pipe_size] = NULL;
57 56
58 if (!is_media_entity_v4l2_subdev(entity)) 57 if (!is_media_entity_v4l2_subdev(ved->ent))
59 continue; 58 continue;
60 59
61 sd = media_entity_to_v4l2_subdev(entity); 60 sd = media_entity_to_v4l2_subdev(ved->ent);
62 v4l2_subdev_call(sd, video, s_stream, 0); 61 v4l2_subdev_call(sd, video, s_stream, 0);
63 } 62 }
64} 63}
@@ -89,18 +88,25 @@ static int vimc_streamer_pipeline_init(struct vimc_stream *stream,
89 } 88 }
90 stream->ved_pipeline[stream->pipe_size++] = ved; 89 stream->ved_pipeline[stream->pipe_size++] = ved;
91 90
91 if (is_media_entity_v4l2_subdev(ved->ent)) {
92 sd = media_entity_to_v4l2_subdev(ved->ent);
93 ret = v4l2_subdev_call(sd, video, s_stream, 1);
94 if (ret && ret != -ENOIOCTLCMD) {
95 pr_err("subdev_call error %s\n",
96 ved->ent->name);
97 vimc_streamer_pipeline_terminate(stream);
98 return ret;
99 }
100 }
101
92 entity = vimc_get_source_entity(ved->ent); 102 entity = vimc_get_source_entity(ved->ent);
93 /* Check if the end of the pipeline was reached*/ 103 /* Check if the end of the pipeline was reached*/
94 if (!entity) 104 if (!entity)
95 return 0; 105 return 0;
96 106
107 /* Get the next device in the pipeline */
97 if (is_media_entity_v4l2_subdev(entity)) { 108 if (is_media_entity_v4l2_subdev(entity)) {
98 sd = media_entity_to_v4l2_subdev(entity); 109 sd = media_entity_to_v4l2_subdev(entity);
99 ret = v4l2_subdev_call(sd, video, s_stream, 1);
100 if (ret && ret != -ENOIOCTLCMD) {
101 vimc_streamer_pipeline_terminate(stream);
102 return ret;
103 }
104 ved = v4l2_get_subdevdata(sd); 110 ved = v4l2_get_subdevdata(sd);
105 } else { 111 } else {
106 vdev = container_of(entity, 112 vdev = container_of(entity,