Commit 12cecbf9 authored by Tomi Valkeinen's avatar Tomi Valkeinen Committed by Mauro Carvalho Chehab
Browse files

media: drivers: use video device pipeline start/stop



Convert the media drivers to use video device based pipeline start/stop
where possible.

Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 340eba47
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -989,7 +989,7 @@ static int cio2_vb2_start_streaming(struct vb2_queue *vq, unsigned int count)
		return r;
	}

	r = media_pipeline_start(&q->vdev.entity, &q->pipe);
	r = video_device_pipeline_start(&q->vdev, &q->pipe);
	if (r)
		goto fail_pipeline;

@@ -1009,7 +1009,7 @@ static int cio2_vb2_start_streaming(struct vb2_queue *vq, unsigned int count)
fail_csi2_subdev:
	cio2_hw_exit(cio2, q);
fail_hw:
	media_pipeline_stop(&q->vdev.entity);
	video_device_pipeline_stop(&q->vdev);
fail_pipeline:
	dev_dbg(dev, "failed to start streaming (%d)\n", r);
	cio2_vb2_return_all_buffers(q, VB2_BUF_STATE_QUEUED);
@@ -1030,7 +1030,7 @@ static void cio2_vb2_stop_streaming(struct vb2_queue *vq)
	cio2_hw_exit(cio2, q);
	synchronize_irq(cio2->pci_dev->irq);
	cio2_vb2_return_all_buffers(q, VB2_BUF_STATE_ERROR);
	media_pipeline_stop(&q->vdev.entity);
	video_device_pipeline_stop(&q->vdev);
	pm_runtime_put(dev);
	cio2->streaming = false;
}
+3 −3
Original line number Diff line number Diff line
@@ -493,7 +493,7 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
	struct v4l2_subdev *subdev;
	int ret;

	ret = media_pipeline_start(&vdev->entity, &video->pipe);
	ret = video_device_pipeline_start(vdev, &video->pipe);
	if (ret < 0)
		return ret;

@@ -522,7 +522,7 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
	return 0;

error:
	media_pipeline_stop(&vdev->entity);
	video_device_pipeline_stop(vdev);

	video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED);

@@ -553,7 +553,7 @@ static void video_stop_streaming(struct vb2_queue *q)
		v4l2_subdev_call(subdev, video, s_stream, 0);
	}

	media_pipeline_stop(&vdev->entity);
	video_device_pipeline_stop(vdev);

	video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR);
}
+3 −3
Original line number Diff line number Diff line
@@ -1265,7 +1265,7 @@ static int rvin_set_stream(struct rvin_dev *vin, int on)
	sd = media_entity_to_v4l2_subdev(pad->entity);

	if (!on) {
		media_pipeline_stop(&vin->vdev.entity);
		video_device_pipeline_stop(&vin->vdev);
		return v4l2_subdev_call(sd, video, s_stream, 0);
	}

@@ -1282,7 +1282,7 @@ static int rvin_set_stream(struct rvin_dev *vin, int on)
	mdev = vin->vdev.entity.graph_obj.mdev;
	mutex_lock(&mdev->graph_mutex);
	pipe = media_entity_pipeline(&sd->entity) ? : &vin->vdev.pipe;
	ret = __media_pipeline_start(&vin->vdev.entity, pipe);
	ret = __video_device_pipeline_start(&vin->vdev, pipe);
	mutex_unlock(&mdev->graph_mutex);
	if (ret)
		return ret;
@@ -1291,7 +1291,7 @@ static int rvin_set_stream(struct rvin_dev *vin, int on)
	if (ret == -ENOIOCTLCMD)
		ret = 0;
	if (ret)
		media_pipeline_stop(&vin->vdev.entity);
		video_device_pipeline_stop(&vin->vdev);

	return ret;
}
+3 −3
Original line number Diff line number Diff line
@@ -927,7 +927,7 @@ static void vsp1_video_stop_streaming(struct vb2_queue *vq)
	}
	mutex_unlock(&pipe->lock);

	media_pipeline_stop(&video->video.entity);
	video_device_pipeline_stop(&video->video);
	vsp1_video_release_buffers(video);
	vsp1_video_pipeline_put(pipe);
}
@@ -1046,7 +1046,7 @@ vsp1_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
		return PTR_ERR(pipe);
	}

	ret = __media_pipeline_start(&video->video.entity, &pipe->pipe);
	ret = __video_device_pipeline_start(&video->video, &pipe->pipe);
	if (ret < 0) {
		mutex_unlock(&mdev->graph_mutex);
		goto err_pipe;
@@ -1070,7 +1070,7 @@ vsp1_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
	return 0;

err_stop:
	media_pipeline_stop(&video->video.entity);
	video_device_pipeline_stop(&video->video);
err_pipe:
	vsp1_video_pipeline_put(pipe);
	return ret;
+5 −5
Original line number Diff line number Diff line
@@ -913,7 +913,7 @@ static void rkisp1_cap_stream_disable(struct rkisp1_capture *cap)
 *
 * Call s_stream(false) in the reverse order from
 * rkisp1_pipeline_stream_enable() and disable the DMA engine.
 * Should be called before media_pipeline_stop()
 * Should be called before video_device_pipeline_stop()
 */
static void rkisp1_pipeline_stream_disable(struct rkisp1_capture *cap)
	__must_hold(&cap->rkisp1->stream_lock)
@@ -937,7 +937,7 @@ static void rkisp1_pipeline_stream_disable(struct rkisp1_capture *cap)
 * rkisp1_pipeline_stream_enable - enable nodes in the pipeline
 *
 * Enable the DMA Engine and call s_stream(true) through the pipeline.
 * Should be called after media_pipeline_start()
 * Should be called after video_device_pipeline_start()
 */
static int rkisp1_pipeline_stream_enable(struct rkisp1_capture *cap)
	__must_hold(&cap->rkisp1->stream_lock)
@@ -994,7 +994,7 @@ static void rkisp1_vb2_stop_streaming(struct vb2_queue *queue)

	rkisp1_dummy_buf_destroy(cap);

	media_pipeline_stop(&node->vdev.entity);
	video_device_pipeline_stop(&node->vdev);

	mutex_unlock(&cap->rkisp1->stream_lock);
}
@@ -1008,7 +1008,7 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count)

	mutex_lock(&cap->rkisp1->stream_lock);

	ret = media_pipeline_start(entity, &cap->rkisp1->pipe);
	ret = video_device_pipeline_start(&cap->vnode.vdev, &cap->rkisp1->pipe);
	if (ret) {
		dev_err(cap->rkisp1->dev, "start pipeline failed %d\n", ret);
		goto err_ret_buffers;
@@ -1044,7 +1044,7 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count)
err_destroy_dummy:
	rkisp1_dummy_buf_destroy(cap);
err_pipeline_stop:
	media_pipeline_stop(entity);
	video_device_pipeline_stop(&cap->vnode.vdev);
err_ret_buffers:
	rkisp1_return_all_buffers(cap, VB2_BUF_STATE_QUEUED);
	mutex_unlock(&cap->rkisp1->stream_lock);
Loading