diff options
author | Helen Fornazier <helen.koike@collabora.com> | 2017-06-19 13:00:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-06-23 08:03:37 -0400 |
commit | bf5fb95c261de259e912e49973c66347a0a5b3d3 (patch) | |
tree | aa82d288682f0c3b58ab9ae938e96c67ababb387 /drivers/media/platform/vimc/vimc-capture.c | |
parent | c149543ef46e3dcc80280a4cc9fbcd05294d3c58 (diff) |
[media] vimc: common: Add vimc_pipeline_s_stream helper
Move the vimc_cap_pipeline_s_stream from the vimc-cap.c to vimc-common.c
as this core will be reused by other subdevices to activate the stream
in their directly connected nodes
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/vimc/vimc-capture.c')
-rw-r--r-- | drivers/media/platform/vimc/vimc-capture.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index 9adb06d7e13d..93f6a0916329 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c | |||
@@ -132,31 +132,6 @@ static void vimc_cap_return_all_buffers(struct vimc_cap_device *vcap, | |||
132 | spin_unlock(&vcap->qlock); | 132 | spin_unlock(&vcap->qlock); |
133 | } | 133 | } |
134 | 134 | ||
135 | static int vimc_cap_pipeline_s_stream(struct vimc_cap_device *vcap, int enable) | ||
136 | { | ||
137 | struct v4l2_subdev *sd; | ||
138 | struct media_pad *pad; | ||
139 | int ret; | ||
140 | |||
141 | /* Start the stream in the subdevice direct connected */ | ||
142 | pad = media_entity_remote_pad(&vcap->vdev.entity.pads[0]); | ||
143 | |||
144 | /* | ||
145 | * if it is a raw node from vimc-core, there is nothing to activate | ||
146 | * TODO: remove this when there are no more raw nodes in the | ||
147 | * core and return error instead | ||
148 | */ | ||
149 | if (pad->entity->obj_type == MEDIA_ENTITY_TYPE_BASE) | ||
150 | return 0; | ||
151 | |||
152 | sd = media_entity_to_v4l2_subdev(pad->entity); | ||
153 | ret = v4l2_subdev_call(sd, video, s_stream, enable); | ||
154 | if (ret && ret != -ENOIOCTLCMD) | ||
155 | return ret; | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static int vimc_cap_start_streaming(struct vb2_queue *vq, unsigned int count) | 135 | static int vimc_cap_start_streaming(struct vb2_queue *vq, unsigned int count) |
161 | { | 136 | { |
162 | struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); | 137 | struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); |
@@ -173,7 +148,7 @@ static int vimc_cap_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
173 | } | 148 | } |
174 | 149 | ||
175 | /* Enable streaming from the pipe */ | 150 | /* Enable streaming from the pipe */ |
176 | ret = vimc_cap_pipeline_s_stream(vcap, 1); | 151 | ret = vimc_pipeline_s_stream(&vcap->vdev.entity, 1); |
177 | if (ret) { | 152 | if (ret) { |
178 | media_pipeline_stop(entity); | 153 | media_pipeline_stop(entity); |
179 | vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); | 154 | vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); |
@@ -192,7 +167,7 @@ static void vimc_cap_stop_streaming(struct vb2_queue *vq) | |||
192 | struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); | 167 | struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); |
193 | 168 | ||
194 | /* Disable streaming from the pipe */ | 169 | /* Disable streaming from the pipe */ |
195 | vimc_cap_pipeline_s_stream(vcap, 0); | 170 | vimc_pipeline_s_stream(&vcap->vdev.entity, 0); |
196 | 171 | ||
197 | /* Stop the media pipeline */ | 172 | /* Stop the media pipeline */ |
198 | media_pipeline_stop(&vcap->vdev.entity); | 173 | media_pipeline_stop(&vcap->vdev.entity); |