예제 #1
0
/* Stream off, which equals to a pause */
static int vidioc_streamoff(struct file *file, void *priv,
			    enum v4l2_buf_type type)
{
	struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);

	if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
		return vb2_streamoff(&ctx->vq_src, type);
	else if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
		return vb2_streamoff(&ctx->vq_dst, type);
	return -EINVAL;
}
예제 #2
0
static int gsc_capture_streamoff(struct file *file, void *priv,
			    enum v4l2_buf_type type)
{
	struct gsc_dev *gsc = video_drvdata(file);
	struct v4l2_subdev *sd;
	struct gsc_pipeline *p = &gsc->pipeline;
	int ret;

	if (p->disp) {
		gsc_pm_qos_ctrl(gsc, GSC_QOS_OFF, 0, 0);
		sd = gsc->pipeline.disp;
	} else if (p->sensor) {
		sd = gsc->pipeline.sensor;
	} else {
		gsc_err("Error pipeline");
		return -EPIPE;
	}

	ret = vb2_streamoff(&gsc->cap.vbq, type);
	if (ret == 0) {
		if (p->disp)
			media_entity_pipeline_stop(&p->disp->entity);
		else if (p->sensor)
			media_entity_pipeline_stop(&p->sensor->entity);
	}

	return ret;
}
예제 #3
0
int fimc_is_video_streamoff(struct file *file,
	struct fimc_is_video_ctx *vctx,
	enum v4l2_buf_type type)
{
	int ret = 0;
	u32 qcount;
	struct fimc_is_queue *queue;
	struct vb2_queue *vbq;
	struct fimc_is_framemgr *framemgr;

	BUG_ON(!file);
	BUG_ON(!vctx);

	if (!(vctx->state & BIT(FIMC_IS_VIDEO_START))) {
		err("[V%02d] invalid streamoff is requested(%lX)", vctx->video->id, vctx->state);
		return -EINVAL;
	}

	queue = GET_QUEUE(vctx);
	framemgr = &queue->framemgr;
	vbq = queue->vbq;
	if (!vbq) {
		merr("vbq is NULL", vctx);
		ret = -EINVAL;
		goto p_err;
	}

	framemgr_e_barrier_irq(framemgr, FMGR_IDX_0);
	qcount = framemgr->frame_req_cnt +
		framemgr->frame_pro_cnt +
		framemgr->frame_com_cnt;
	framemgr_x_barrier_irq(framemgr, FMGR_IDX_0);

	if (qcount > 0)
		mwarn("video%d stream off : queued buffer is not empty(%d)", vctx,
			vctx->video->id, qcount);

	if (vbq->type != type) {
		merr("invalid stream type(%d != %d)", vctx, vbq->type, type);
		ret = -EINVAL;
		goto p_err;
	}

	if (!vbq->streaming) {
		merr("streamoff: not streaming", vctx);
		ret = -EINVAL;
		goto p_err;
	}

	ret = vb2_streamoff(vbq, type);
	if (ret) {
		err("[V%02d] vb2_streamoff is fail(%d)", vctx->video->id, ret);
		goto p_err;
	}

	vctx->state = BIT(FIMC_IS_VIDEO_STOP);

p_err:
	return ret;
}
예제 #4
0
static int at91sam9x5_video_vidioc_streamoff(struct file *filp,
		void *fh, enum v4l2_buf_type type)
{
	struct video_device *vdev = video_devdata(filp);
	struct at91sam9x5_video_priv *priv = video_get_drvdata(vdev);
	unsigned long flags;

	spin_lock_irqsave(&priv->lock, flags);

	/* disable channel */
	at91sam9x5_video_write32(priv, REG_HEOCHDR, REG_HEOCHDR_CHDIS);

	at91sam9x5_video_handle_irqstat(priv);

	if (priv->cur.vb)
		at91sam9x5_video_write32(priv, REG_HEOIER,
				REG_HEOIxR_ADD | REG_HEOIxR_DMA |
				REG_HEOIxR_UADD | REG_HEOIxR_UDMA |
				REG_HEOIxR_VADD | REG_HEOIxR_VDMA);

	priv->hwstate = at91sam9x5_video_HW_IDLE;

	spin_unlock_irqrestore(&priv->lock, flags);

	return vb2_streamoff(&priv->queue, type);
}
static int mxr_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
{
	struct mxr_layer *layer = video_drvdata(file);
	struct mxr_device *mdev = layer->mdev;

	switch (layer->idx) {
	case 0:
		mdev->layer_en.graph0 = 0;
		break;
	case 1:
		mdev->layer_en.graph1 = 0;
		break;
	case 2:
		mdev->layer_en.graph2 = 0;
		break;
	case 3:
		mdev->layer_en.graph3 = 0;
		break;
	default:
		mxr_err(mdev, "invalid layer number\n");
		return -EINVAL;
	}

	mdev->frame_packing = 0;
	if ((mdev->layer_en.graph0 && mdev->layer_en.graph2) ||
	    (mdev->layer_en.graph1 && mdev->layer_en.graph3)) {
		mdev->frame_packing = 1;
		mxr_dbg(mdev, "frame packing mode\n");
	}

	mxr_dbg(mdev, "%s:%d\n", __func__, __LINE__);
	return vb2_streamoff(&layer->vb_queue, i);
}
예제 #6
0
파일: uvc_queue.c 프로젝트: AiWinters/linux
/*
 * Enable or disable the video buffers queue.
 *
 * The queue must be enabled before starting video acquisition and must be
 * disabled after stopping it. This ensures that the video buffers queue
 * state can be properly initialized before buffers are accessed from the
 * interrupt handler.
 *
 * Enabling the video queue returns -EBUSY if the queue is already enabled.
 *
 * Disabling the video queue cancels the queue and removes all buffers from
 * the main queue.
 *
 * This function can't be called from interrupt context. Use
 * uvc_queue_cancel() instead.
 */
int uvc_queue_enable(struct uvc_video_queue *queue, int enable)
{
	unsigned long flags;
	int ret;

	mutex_lock(&queue->mutex);
	if (enable) {
		ret = vb2_streamon(&queue->queue, queue->queue.type);
		if (ret < 0)
			goto done;

		queue->buf_used = 0;
	} else {
		ret = vb2_streamoff(&queue->queue, queue->queue.type);
		if (ret < 0)
			goto done;

		spin_lock_irqsave(&queue->irqlock, flags);
		INIT_LIST_HEAD(&queue->irqqueue);
		spin_unlock_irqrestore(&queue->irqlock, flags);
	}

done:
	mutex_unlock(&queue->mutex);
	return ret;
}
예제 #7
0
static int wfdioc_streamon(struct file *filp, void *fh,
		enum v4l2_buf_type i)
{
	int rc = 0;
	struct wfd_inst *inst = filp->private_data;
	unsigned long flags;
	if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
		WFD_MSG_ERR("stream on for buffer type = %d is not "
			"supported.\n", i);
		return -EINVAL;
	}

	spin_lock_irqsave(&inst->inst_lock, flags);
	inst->streamoff = false;
	spin_unlock_irqrestore(&inst->inst_lock, flags);
	/*TODO: Do we need to lock the instance here*/
	rc = vb2_streamon(&inst->vid_bufq, i);
	if (rc) {
		WFD_MSG_ERR("videobuf_streamon failed with err = %d\n", rc);
		goto vidbuf_streamon_failed;
	}
	inst->mdp_task = kthread_run(mdp_output_thread, filp,
				"mdp_output_thread");
	if (IS_ERR(inst->mdp_task)) {
		rc = PTR_ERR(inst->mdp_task);
		goto mdp_task_failed;
	}
	return rc;
mdp_task_failed:
	vb2_streamoff(&inst->vid_bufq, i);
vidbuf_streamon_failed:
	return rc;
}
예제 #8
0
파일: uvc_queue.c 프로젝트: 383530895/linux
/*
 * Enable or disable the video buffers queue.
 *
 * The queue must be enabled before starting video acquisition and must be
 * disabled after stopping it. This ensures that the video buffers queue
 * state can be properly initialized before buffers are accessed from the
 * interrupt handler.
 *
 * Enabling the video queue initializes parameters (such as sequence number,
 * sync pattern, ...). If the queue is already enabled, return -EBUSY.
 *
 * Disabling the video queue cancels the queue and removes all buffers from
 * the main queue.
 *
 * This function can't be called from interrupt context. Use
 * uvcg_queue_cancel() instead.
 */
int uvcg_queue_enable(struct uvc_video_queue *queue, int enable)
{
	unsigned long flags;
	int ret = 0;

	mutex_lock(&queue->mutex);
	if (enable) {
		ret = vb2_streamon(&queue->queue, queue->queue.type);
		if (ret < 0)
			goto done;

		queue->sequence = 0;
		queue->buf_used = 0;
	} else {
		ret = vb2_streamoff(&queue->queue, queue->queue.type);
		if (ret < 0)
			goto done;

		spin_lock_irqsave(&queue->irqlock, flags);
		INIT_LIST_HEAD(&queue->irqqueue);

		/*
		 * FIXME: We need to clear the DISCONNECTED flag to ensure that
		 * applications will be able to queue buffers for the next
		 * streaming run. However, clearing it here doesn't guarantee
		 * that the device will be reconnected in the meantime.
		 */
		queue->flags &= ~UVC_QUEUE_DISCONNECTED;
		spin_unlock_irqrestore(&queue->irqlock, flags);
	}

done:
	mutex_unlock(&queue->mutex);
	return ret;
}
예제 #9
0
int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
{
	struct video_device *vdev = video_devdata(file);

	if (vb2_queue_is_busy(vdev, file))
		return -EBUSY;
	return vb2_streamoff(vdev->queue, i);
}
예제 #10
0
static int fimc_is_isp_video_streamoff(struct file *file, void *priv,
			    enum v4l2_buf_type type)
{
	struct fimc_is_dev *is_dev = video_drvdata(file);

	printk(KERN_DEBUG "%s\n", __func__);
	return vb2_streamoff(&is_dev->video[FIMC_IS_VIDEO_NUM_BAYER].vbq, type);
}
예제 #11
0
static int fimc_cap_streamoff(struct file *file, void *priv,
                              enum v4l2_buf_type type)
{
    struct fimc_ctx *ctx = priv;
    struct fimc_dev *fimc = ctx->fimc_dev;

    return vb2_streamoff(&fimc->vid_cap.vbq, type);
}
예제 #12
0
/**
 * v4l2_m2m_streamoff() - turn off streaming for a video queue
 */
int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
		       enum v4l2_buf_type type)
{
	struct vb2_queue *vq;

	vq = v4l2_m2m_get_vq(m2m_ctx, type);
	return vb2_streamoff(vq, type);
}
예제 #13
0
int uvc_queue_streamoff(struct uvc_video_queue *queue, enum v4l2_buf_type type)
{
	int ret;

	mutex_lock(&queue->mutex);
	ret = vb2_streamoff(&queue->queue, type);
	mutex_unlock(&queue->mutex);

	return ret;
}
static int gsc_capture_streamoff(struct file *file, void *priv,
			    enum v4l2_buf_type type)
{
	struct gsc_dev *gsc = video_drvdata(file);
	int ret;

	ret = vb2_streamoff(&gsc->cap.vbq, type);

	return ret;
}
예제 #15
0
static int
hwcam_dev_vo_streamoff(
        struct file* filep,
        void* fh,
        enum v4l2_buf_type buf_type)
{
    hwcam_dev_t* cam = video_drvdata(filep);
	hwcam_user_t* user = VO2USER(fh);
	BUG_ON(!cam || !user);
    return vb2_streamoff(&user->vb2q, buf_type);
}
예제 #16
0
/*
 * msm_fd_streamoff - V4l2 ioctl stream off handler.
 * @file: Pointer to file struct.
 * @fh: V4l2 File handle.
 * @buf_type: V4l2 buffer type.
 */
static int msm_fd_streamoff(struct file *file,
	void *fh, enum v4l2_buf_type buf_type)
{
	struct fd_ctx *ctx = msm_fd_ctx_from_fh(fh);
	int ret;

	ret = vb2_streamoff(&ctx->vb2_q, buf_type);
	if (ret < 0)
		dev_err(ctx->fd_device->dev, "Stream off fails\n");

	return ret;
}
예제 #17
0
static int fimc_cap_streamoff(struct file *file, void *priv,
			    enum v4l2_buf_type type)
{
	struct fimc_dev *fimc = video_drvdata(file);
	struct v4l2_subdev *sd = fimc->pipeline.sensor;
	int ret;

	ret = vb2_streamoff(&fimc->vid_cap.vbq, type);
	if (ret == 0)
		media_entity_pipeline_stop(&sd->entity);
	return ret;
}
예제 #18
0
static int fimc_lite_streamoff(struct file *file, void *priv,
			       enum v4l2_buf_type type)
{
	struct fimc_lite *fimc = video_drvdata(file);
	struct v4l2_subdev *sd = fimc->pipeline.subdevs[IDX_SENSOR];
	int ret;

	ret = vb2_streamoff(&fimc->vb_queue, type);
	if (ret == 0)
		media_entity_pipeline_stop(&sd->entity);
	return ret;
}
예제 #19
0
static int nxp_video_streamoff(struct file *file, void *fh,
        enum v4l2_buf_type i)
{
    int ret;
    u32 pad;
    struct nxp_video *me;
    struct v4l2_subdev *subdev;
    void *hostdata_back;


    me = file->private_data;
    subdev = _get_remote_subdev(me, i, &pad);

    if (me->vbq) {
        ret = vb2_streamoff(me->vbq, i);
        if (ret < 0) {
            printk(KERN_ERR "%s: failed to vb2_streamoff() %s\n", __func__, me->name);
            return 0;
        }
    } else {
        struct vb2_queue *vq = v4l2_m2m_get_vq(me->m2m_ctx, i);
        ret = vb2_streamoff(vq, i);
        if (ret < 0) {
            pr_err(KERN_ERR "%s: m2m, failed to vb2_streamoff() %s\n", __func__, me->name);
            return 0;
        }
    }

    vmsg("%s %s\n", __func__, me->name);

    hostdata_back = v4l2_get_subdev_hostdata(subdev);
    v4l2_set_subdev_hostdata(subdev, me->name);
    ret = v4l2_subdev_call(subdev, video, s_stream, 0);
    v4l2_set_subdev_hostdata(subdev, hostdata_back);

    vmsg("%s: %s exit\n", __func__, me->name);

    return ret;
}
int fimc_is_video_streamoff(struct file *file,
	struct fimc_is_video_ctx *vctx,
	enum v4l2_buf_type type)
{
	int ret = 0;
	u32 qcount;
	struct fimc_is_queue *queue;
	struct vb2_queue *vbq;
	struct fimc_is_framemgr *framemgr;

	BUG_ON(!file);
	BUG_ON(!vctx);

	queue = GET_QUEUE(vctx, type);
	framemgr = &queue->framemgr;
	vbq = queue->vbq;
	if (!vbq) {
		merr("vbq is NULL", vctx);
		ret = -EINVAL;
		goto p_err;
	}

	framemgr_e_barrier_irq(framemgr, 0);
	qcount = framemgr->frame_req_cnt +
		framemgr->frame_pro_cnt +
		framemgr->frame_com_cnt;
	framemgr_x_barrier_irq(framemgr, 0);

	if (qcount > 0)
		mwarn("video%d stream off : queued buffer is not empty(%d)", vctx,
			vctx->video->id, qcount);

	if (vbq->type != type) {
		merr("invalid stream type(%d != %d)", vctx, vbq->type, type);
		ret = -EINVAL;
		goto p_err;
	}

	if (!vbq->streaming) {
		merr("streamoff: not streaming", vctx);
		ret = -EINVAL;
		goto p_err;
	}

	ret = vb2_streamoff(vbq, type);

p_err:
	return ret;
}
예제 #21
0
static int __vb2_cleanup_fileio(struct vb2_queue *q)
{
	struct vb2_fileio_data *fileio = q->fileio;

	if (fileio) {
		q->fileio = NULL;

		vb2_streamoff(q, q->type);
		fileio->req.count = 0;
		vb2_reqbufs(q, &fileio->req);
		kfree(fileio);
		dprintk(3, "file io emulator closed\n");
	}
	return 0;
}
예제 #22
0
/*
 * Enable or disable the video buffers queue.
 *
 * The queue must be enabled before starting video acquisition and must be
 * disabled after stopping it. This ensures that the video buffers queue
 * state can be properly initialized before buffers are accessed from the
 * interrupt handler.
 *
 * Enabling the video queue initializes parameters (such as sequence number,
 * sync pattern, ...). If the queue is already enabled, return -EBUSY.
 *
 * Disabling the video queue cancels the queue and removes all buffers from
 * the main queue.
 *
 * This function can't be called from interrupt context. Use
 * uvcg_queue_cancel() instead.
 */
int uvcg_queue_enable(struct uvc_video_queue *queue, int enable)
{
	unsigned long flags;
	int ret = 0;

	if (enable) {
		ret = vb2_streamon(&queue->queue, queue->queue.type);
		if (ret < 0)
			return ret;

		queue->sequence = 0;
		queue->buf_used = 0;
	} else {
		ret = vb2_streamoff(&queue->queue, queue->queue.type);
		if (ret < 0)
			return ret;

		spin_lock_irqsave(&queu
static int camera_v4l2_streamoff(struct file *filep, void *fh,
		enum v4l2_buf_type buf_type)
{
	struct v4l2_event event;
	int rc;
	struct camera_v4l2_private *sp = fh_to_private(fh);

	camera_pack_event(filep, MSM_CAMERA_SET_PARM,
		MSM_CAMERA_PRIV_STREAM_OFF, -1, &event);

	rc = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
	if (rc < 0)
		return rc;

	rc = camera_check_event_status(&event);
	vb2_streamoff(&sp->vb2_q, buf_type);
	return rc;
}
예제 #24
0
/**
 * __vb2_cleanup_fileio() - free resourced used by file io emulator
 * @q:		videobuf2 queue
 */
static int __vb2_cleanup_fileio(struct vb2_queue *q)
{
	struct vb2_fileio_data *fileio = q->fileio;

	if (fileio) {
		/*
		 * Hack fileio context to enable direct calls to vb2 ioctl
		 * interface.
		 */
		q->fileio = NULL;

		vb2_streamoff(q, q->type);
		fileio->req.count = 0;
		vb2_reqbufs(q, &fileio->req);
		kfree(fileio);
		dprintk(3, "file io emulator closed\n");
	}
	return 0;
}
예제 #25
0
static int
iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
{
	struct iss_video_fh *vfh = to_iss_video_fh(fh);
	struct iss_video *video = video_drvdata(file);
	struct iss_pipeline *pipe = to_iss_pipeline(&video->video.entity);
	enum iss_pipeline_state state;
	unsigned long flags;

	if (type != video->type)
		return -EINVAL;

	mutex_lock(&video->stream_lock);

	if (!vb2_is_streaming(&vfh->queue))
		goto done;

	/* Update the pipeline state. */
	if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
		state = ISS_PIPELINE_STREAM_OUTPUT
		      | ISS_PIPELINE_QUEUE_OUTPUT;
	else
		state = ISS_PIPELINE_STREAM_INPUT
		      | ISS_PIPELINE_QUEUE_INPUT;

	spin_lock_irqsave(&pipe->lock, flags);
	pipe->state &= ~state;
	spin_unlock_irqrestore(&pipe->lock, flags);

	/* Stop the stream. */
	omap4iss_pipeline_set_stream(pipe, ISS_PIPELINE_STREAM_STOPPED);
	vb2_streamoff(&vfh->queue, type);
	video->queue = NULL;

	if (video->iss->pdata->set_constraints)
		video->iss->pdata->set_constraints(video->iss, false);
	media_entity_pipeline_stop(&video->video.entity);

done:
	mutex_unlock(&video->stream_lock);
	return 0;
}
예제 #26
0
static int
xvip_dma_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
{
	struct v4l2_fh *vfh = file->private_data;
	struct xvip_dma *dma = to_xvip_dma(vfh->vdev);
	int ret;

	mutex_lock(&dma->lock);

	if (dma->queue.owner && dma->queue.owner != vfh) {
		ret = -EBUSY;
		goto done;
	}

	ret = vb2_streamoff(&dma->queue, type);

done:
	mutex_unlock(&dma->lock);
	return ret;
}
예제 #27
0
/**
 * v4l2_m2m_streamoff() - turn off streaming for a video queue
 */
int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
		       enum v4l2_buf_type type)
{
	struct v4l2_m2m_dev *m2m_dev;
	struct v4l2_m2m_queue_ctx *q_ctx;
	unsigned long flags_job, flags;
	int ret;

	/* wait until the current context is dequeued from job_queue */
	v4l2_m2m_cancel_job(m2m_ctx);

	q_ctx = get_queue_ctx(m2m_ctx, type);
	ret = vb2_streamoff(&q_ctx->q, type);
	if (ret)
		return ret;

	m2m_dev = m2m_ctx->m2m_dev;
	spin_lock_irqsave(&m2m_dev->job_spinlock, flags_job);
	/* We should not be scheduled anymore, since we're dropping a queue. */
	if (m2m_ctx->job_flags & TRANS_QUEUED)
		list_del(&m2m_ctx->queue);
	m2m_ctx->job_flags = 0;

	spin_lock_irqsave(&q_ctx->rdy_spinlock, flags);
	/* Drop queue, since streamoff returns device to the same state as after
	 * calling reqbufs. */
	INIT_LIST_HEAD(&q_ctx->rdy_queue);
	q_ctx->num_rdy = 0;
	spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags);

	if (m2m_dev->curr_ctx == m2m_ctx) {
		m2m_dev->curr_ctx = NULL;
		wake_up(&m2m_ctx->finished);
	}
	spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);

	return 0;
}
예제 #28
0
static int wfdioc_streamoff(struct file *filp, void *fh,
		enum v4l2_buf_type i)
{
	struct wfd_inst *inst = filp->private_data;
	unsigned long flags;
	spin_lock_irqsave(&inst->inst_lock, flags);
	if (inst->streamoff) {
		WFD_MSG_ERR("Module is already in streamoff state\n");
		spin_unlock_irqrestore(&inst->inst_lock, flags);
		return -EINVAL;
	}
	inst->streamoff = true;
	spin_unlock_irqrestore(&inst->inst_lock, flags);
	if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
		WFD_MSG_ERR("stream off for buffer type = %d is not "
			"supported.\n", i);
		return -EINVAL;
	}
	WFD_MSG_DBG("Calling videobuf_streamoff\n");
	vb2_streamoff(&inst->vid_bufq, i);
	vb2_queue_release(&inst->vid_bufq);
	kthread_stop(inst->mdp_task);
	return 0;
}
예제 #29
0
파일: myvivi_end.c 프로젝트: NieHao/drv
static int myvivi_vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
{
	vb2_streamoff(&myvivi_vb_vidqueue, i);
	return 0;
}
static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
{
	struct vcap_client_data *c_data = file->private_data;
	int rc;

	switch (c_data->op_mode) {
	case VC_VCAP_OP:
		rc = vb2_streamoff(&c_data->vc_vidq, i);
		if (rc >= 0)
			atomic_set(&c_data->dev->vc_enabled, 0);
		return rc;
	case VP_VCAP_OP:
		rc = streamoff_validate_q(&c_data->vp_in_vidq);
		if (rc < 0)
			return rc;
		rc = streamoff_validate_q(&c_data->vp_out_vidq);
		if (rc < 0)
			return rc;

		/* These stream on calls should not fail */
		rc = vb2_streamoff(&c_data->vp_in_vidq,
				V4L2_BUF_TYPE_INTERLACED_IN_DECODER);
		if (rc < 0)
			return rc;

		rc = vb2_streamoff(&c_data->vp_out_vidq,
				V4L2_BUF_TYPE_VIDEO_OUTPUT);
		if (rc < 0)
			return rc;

		deinit_motion_buf(c_data);
		if (c_data->vid_vp_action.nr_enabled)
			deinit_nr_buf(c_data);
		atomic_set(&c_data->dev->vp_enabled, 0);
		return rc;
	case VC_AND_VP_VCAP_OP:
		rc = streamoff_validate_q(&c_data->vc_vidq);
		if (rc < 0)
			return rc;
		rc = streamoff_validate_q(&c_data->vp_in_vidq);
		if (rc < 0)
			return rc;
		rc = streamoff_validate_q(&c_data->vp_out_vidq);
		if (rc < 0)
			return rc;

		/* These stream on calls should not fail */
		c_data->streaming = 0;
		rc = vb2_streamoff(&c_data->vc_vidq,
				V4L2_BUF_TYPE_VIDEO_CAPTURE);
		if (rc < 0)
			return rc;

		rc = vb2_streamoff(&c_data->vp_in_vidq,
				V4L2_BUF_TYPE_INTERLACED_IN_DECODER);
		if (rc < 0)
			return rc;

		rc = vb2_streamoff(&c_data->vp_out_vidq,
				V4L2_BUF_TYPE_VIDEO_OUTPUT);
		if (rc < 0)
			return rc;

		deinit_motion_buf(c_data);
		if (c_data->vid_vp_action.nr_enabled)
			deinit_nr_buf(c_data);
		atomic_set(&c_data->dev->vc_enabled, 0);
		atomic_set(&c_data->dev->vp_enabled, 0);
		return rc;
	default:
		pr_err("VCAP Error: %s: Unknown Operation mode", __func__);
		return -ENOTRECOVERABLE;
	}
	return 0;
}