aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vimc/vimc-scaler.c
diff options
context:
space:
mode:
authorLucas A. M. Magalhães <lucmaga@gmail.com>2019-01-21 20:05:01 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-02-07 12:23:09 -0500
commitadc589d2a20808fb99d46a78175cd023f2040338 (patch)
treed31919d178d5b9a82a3be8fb9aea4a2e74742e66 /drivers/media/platform/vimc/vimc-scaler.c
parent276c1f066bdaaed6fe82ed231e1eff2f41c34882 (diff)
media: vimc: Add vimc-streamer for stream control
Add a linear pipeline logic for the stream control. It's created by walking backwards on the entity graph. When the stream starts it will simply loop through the pipeline calling the respective process_frame function of each entity. Fixes: f2fe89061d797 ("vimc: Virtual Media Controller core, capture and sensor") Cc: stable@vger.kernel.org # for v4.20 Signed-off-by: Lucas A. M. Magalhães <lucmaga@gmail.com> Acked-by: Helen Koike <helen.koike@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil-cisco@xs4all.nl: fixed small space-after-tab issue in the patch] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/vimc/vimc-scaler.c')
-rw-r--r--drivers/media/platform/vimc/vimc-scaler.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/drivers/media/platform/vimc/vimc-scaler.c b/drivers/media/platform/vimc/vimc-scaler.c
index b0952ee86296..39b2a73dfcc1 100644
--- a/drivers/media/platform/vimc/vimc-scaler.c
+++ b/drivers/media/platform/vimc/vimc-scaler.c
@@ -217,7 +217,6 @@ static const struct v4l2_subdev_pad_ops vimc_sca_pad_ops = {
217static int vimc_sca_s_stream(struct v4l2_subdev *sd, int enable) 217static int vimc_sca_s_stream(struct v4l2_subdev *sd, int enable)
218{ 218{
219 struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); 219 struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd);
220 int ret;
221 220
222 if (enable) { 221 if (enable) {
223 const struct vimc_pix_map *vpix; 222 const struct vimc_pix_map *vpix;
@@ -245,22 +244,10 @@ static int vimc_sca_s_stream(struct v4l2_subdev *sd, int enable)
245 if (!vsca->src_frame) 244 if (!vsca->src_frame)
246 return -ENOMEM; 245 return -ENOMEM;
247 246
248 /* Turn the stream on in the subdevices directly connected */
249 ret = vimc_pipeline_s_stream(&vsca->sd.entity, 1);
250 if (ret) {
251 vfree(vsca->src_frame);
252 vsca->src_frame = NULL;
253 return ret;
254 }
255 } else { 247 } else {
256 if (!vsca->src_frame) 248 if (!vsca->src_frame)
257 return 0; 249 return 0;
258 250
259 /* Disable streaming from the pipe */
260 ret = vimc_pipeline_s_stream(&vsca->sd.entity, 0);
261 if (ret)
262 return ret;
263
264 vfree(vsca->src_frame); 251 vfree(vsca->src_frame);
265 vsca->src_frame = NULL; 252 vsca->src_frame = NULL;
266 } 253 }
@@ -346,26 +333,19 @@ static void vimc_sca_fill_src_frame(const struct vimc_sca_device *const vsca,
346 vimc_sca_scale_pix(vsca, i, j, sink_frame); 333 vimc_sca_scale_pix(vsca, i, j, sink_frame);
347} 334}
348 335
349static void vimc_sca_process_frame(struct vimc_ent_device *ved, 336static void *vimc_sca_process_frame(struct vimc_ent_device *ved,
350 struct media_pad *sink, 337 const void *sink_frame)
351 const void *sink_frame)
352{ 338{
353 struct vimc_sca_device *vsca = container_of(ved, struct vimc_sca_device, 339 struct vimc_sca_device *vsca = container_of(ved, struct vimc_sca_device,
354 ved); 340 ved);
355 unsigned int i;
356 341
357 /* If the stream in this node is not active, just return */ 342 /* If the stream in this node is not active, just return */
358 if (!vsca->src_frame) 343 if (!vsca->src_frame)
359 return; 344 return ERR_PTR(-EINVAL);
360 345
361 vimc_sca_fill_src_frame(vsca, sink_frame); 346 vimc_sca_fill_src_frame(vsca, sink_frame);
362 347
363 /* Propagate the frame through all source pads */ 348 return vsca->src_frame;
364 for (i = 1; i < vsca->sd.entity.num_pads; i++) {
365 struct media_pad *pad = &vsca->sd.entity.pads[i];
366
367 vimc_propagate_frame(pad, vsca->src_frame);
368 }
369}; 349};
370 350
371static void vimc_sca_comp_unbind(struct device *comp, struct device *master, 351static void vimc_sca_comp_unbind(struct device *comp, struct device *master,