Beispiel #1
0
/*
 * csi2_set_stream - Enable/Disable streaming on the CSI2 module
 * @sd: ISP CSI2 V4L2 subdevice
 * @enable: ISP pipeline stream state
 *
 * Return 0 on success or a negative error code otherwise.
 */
static int csi2_set_stream(struct v4l2_subdev *sd, int enable)
{
	struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd);
	struct isp_device *isp = csi2->isp;
	struct isp_pipeline *pipe = to_isp_pipeline(&csi2->subdev.entity);
	struct isp_video *video_out = &csi2->video_out;

	switch (enable) {
	case ISP_PIPELINE_STREAM_CONTINUOUS:
		if (isp_csiphy_acquire(csi2->phy) < 0)
			return -ENODEV;
		csi2->use_fs_irq = pipe->do_propagation;
		if (csi2->output & CSI2_OUTPUT_MEMORY)
			isp_sbl_enable(isp, OMAP3_ISP_SBL_CSI2A_WRITE);
		isp_csi2_configure(csi2);
		isp_csi2_print_status(csi2);

		/*
		 * When outputting to memory with no buffer available, let the
		 * buffer queue handler start the hardware. A DMA queue flag
		 * ISP_VIDEO_DMAQUEUE_QUEUED will be set as soon as there is
		 * a buffer available.
		 */
		if (csi2->output & CSI2_OUTPUT_MEMORY &&
		    !(video_out->dmaqueue_flags & ISP_VIDEO_DMAQUEUE_QUEUED))
			break;
		/* Enable context 0 and IRQs */
		atomic_set(&csi2->stopping, 0);
		isp_csi2_ctx_enable(isp, csi2, 0, 1);
		isp_csi2_if_enable(isp, csi2, 1);
		isp_video_dmaqueue_flags_clr(video_out);
		break;

	case ISP_PIPELINE_STREAM_STOPPED:
		if (csi2->state == ISP_PIPELINE_STREAM_STOPPED)
			return 0;
		if (isp_module_sync_idle(&sd->entity, &csi2->wait,
					 &csi2->stopping))
			dev_dbg(isp->dev, "%s: module stop timeout.\n",
				sd->name);
		isp_csi2_ctx_enable(isp, csi2, 0, 0);
		isp_csi2_if_enable(isp, csi2, 0);
		isp_csi2_irq_ctx_set(isp, csi2, 0);
		isp_csiphy_release(csi2->phy);
		isp_video_dmaqueue_flags_clr(video_out);
		isp_sbl_disable(isp, OMAP3_ISP_SBL_CSI2A_WRITE);
		break;
	}

	csi2->state = enable;
	return 0;
}
Beispiel #2
0
/*
 * csi2_queue - Queues the first buffer when using memory output
 * @video: The video node
 * @buffer: buffer to queue
 */
static int csi2_queue(struct isp_video *video, struct isp_buffer *buffer)
{
    struct isp_device *isp = video->isp;
    struct isp_csi2_device *csi2 = &isp->isp_csi2a;

    csi2_set_outaddr(csi2, buffer->dma);

    /*
     * If streaming was enabled before there was a buffer queued
     * or underrun happened in the ISR, the hardware was not enabled
     * and DMA queue flag ISP_VIDEO_DMAQUEUE_UNDERRUN is still set.
     * Enable it now.
     */
    if (csi2->video_out.dmaqueue_flags & ISP_VIDEO_DMAQUEUE_UNDERRUN) {
        /* Enable / disable context 0 and IRQs */
        csi2_if_enable(isp, csi2, 1);
        csi2_ctx_enable(isp, csi2, 0, 1);
        isp_video_dmaqueue_flags_clr(&csi2->video_out);
    }

    return 0;
}