Esempio n. 1
0
static inline u32 fimc_irq_out_fimd(struct fimc_control *ctrl)
{
	u32 prev, next, wakeup = 0;
	int ret = -1;

	/* Attach done buffer to outgoing queue. */
	if (ctrl->out->idx.prev != -1) {
		ret = fimc_attach_out_queue(ctrl, ctrl->out->idx.prev);
		if (ret < 0) {
			fimc_err("Failed: fimc_attach_out_queue\n");
		} else {
			ctrl->out->idx.prev = -1;
			wakeup = 1; /* To wake up fimc_v4l2_dqbuf(). */
		}
	}

	/* Update index structure. */
	if (ctrl->out->idx.next != -1) {
		ctrl->out->idx.active	= ctrl->out->idx.next;
		ctrl->out->idx.next	= -1;
	}

	/* Detach buffer from incomming queue. */
	ret =  fimc_detach_in_queue(ctrl, &next);
	if (ret == 0) {	/* There is a buffer in incomming queue. */
		prev = ctrl->out->idx.active;
		ctrl->out->idx.prev	= prev;
		ctrl->out->idx.next	= next;

		/* Set the address */
		fimc_outdev_set_src_addr(ctrl, ctrl->out->src[next].base);
	}

	return wakeup;
}
Esempio n. 2
0
static inline u32 fimc_irq_out_none(struct fimc_control *ctrl)
{
	u32 next = 0, wakeup = 1;
	int ret = -1;

	if (ctrl->status == FIMC_READY_OFF) {
		ctrl->out->idx.active = -1;
		ctrl->status = FIMC_STREAMOFF;
		return wakeup;
	}

	/* Attach done buffer to outgoing queue. */
	ret = fimc_attach_out_queue(ctrl, ctrl->out->idx.active);
	if (ret < 0)
		fimc_err("Failed: fimc_attach_out_queue\n");

	/* Detach buffer from incomming queue. */
	ret =  fimc_detach_in_queue(ctrl, &next);
	if (ret == 0) {	/* There is a buffer in incomming queue. */
		fimc_outdev_set_src_addr(ctrl, ctrl->out->src[next].base);
		ret = fimc_outdev_start_camif(ctrl);
		if (ret < 0)
			fimc_err("Fail: fimc_start_camif\n");

		ctrl->out->idx.active = next;
		ctrl->status = FIMC_STREAMON;
	} else {	/* There is no buffer in incomming queue. */
		ctrl->out->idx.active = -1;
		ctrl->status = FIMC_STREAMON_IDLE;
	}

	return wakeup;
}
Esempio n. 3
0
static inline u32 fimc_irq_out_dma(struct fimc_control *ctrl)
{
	u32 next = 0, wakeup = 1;
	int ret = -1;
#ifdef VIEW_FUNCTION_CALL
	printk("[FIMC_DEV] %s(%d)\n", __func__, __LINE__);
#endif

	/* Attach done buffer to outgoing queue. */
	ret = fimc_attach_out_queue(ctrl, ctrl->out->idx.active);
	if (ret < 0)
		dev_err(ctrl->dev, "Failed: fimc_attach_out_queue\n");

	if (ctrl->status == FIMC_READY_OFF) {
		ctrl->out->idx.active = -1;
		return wakeup;
	}

	/* Detach buffer from incomming queue. */
	ret =  fimc_detach_in_queue(ctrl, &next);
	if (ret == 0) {	/* There is a buffer in incomming queue. */
		fimc_outdev_set_src_addr(ctrl, ctrl->out->buf[next].base);
		ret = fimc_outdev_start_camif(ctrl);
		if (ret < 0)
			dev_err(ctrl->dev, "Fail: fimc_start_camif\n");

		ctrl->out->idx.active = next;
		ctrl->status = FIMC_STREAMON;
	} else {	/* There is no buffer in incomming queue. */
		ctrl->out->idx.active = -1;
		ctrl->status = FIMC_STREAMON_IDLE;
	}

	return wakeup;
}
Esempio n. 4
0
static inline u32 fimc_irq_out_fimd(struct fimc_control *ctrl)
{
	u32 prev, next, wakeup = 0;
	int ret = -1;
#ifdef VIEW_FUNCTION_CALL
	printk("[FIMC_DEV] %s(%d)\n", __func__, __LINE__);
#endif

	/* Attach done buffer to outgoing queue. */
	if (ctrl->out->idx.prev != -1) {
		ret = fimc_attach_out_queue(ctrl, ctrl->out->idx.prev);
		if (ret < 0) {
			dev_err(ctrl->dev,
				"Failed: fimc_attach_out_queue\n");
		} else {
			ctrl->out->idx.prev = -1;
			wakeup = 1; /* To wake up fimc_v4l2_dqbuf(). */
		}
	}

	/* Update index structure. */
	if (ctrl->out->idx.next != -1) {
		ctrl->out->idx.active	= ctrl->out->idx.next;
		ctrl->out->idx.next	= -1;
	}

	/* Detach buffer from incomming queue. */
	ret =  fimc_detach_in_queue(ctrl, &next);
	if (ret == 0) {	/* There is a buffer in incomming queue. */
		prev = ctrl->out->idx.active;
		ctrl->out->idx.prev	= prev;
		ctrl->out->idx.next	= next;

		/* Set the address */
		fimc_outdev_set_src_addr(ctrl, ctrl->out->buf[next].base);
	}

	return wakeup;
}
Esempio n. 5
0
static inline u32 fimc_irq_out_dma(struct fimc_control *ctrl)
{
	struct fimc_buf_set buf_set;
	u32 next = 0, wakeup = 1;
	int idx = ctrl->out->idx.active;
	int ret = -1, i;

	if (ctrl->status == FIMC_READY_OFF) {
		ctrl->out->idx.active = -1;
		ctrl->status = FIMC_STREAMOFF;
		return wakeup;
	}

	/* Attach done buffer to outgoing queue. */
	ret = fimc_attach_out_queue(ctrl, idx);
	if (ret < 0)
		fimc_err("Failed: fimc_attach_out_queue\n");

	if(ctrl->out->overlay.mode == FIMC_OVERLAY_DMA_AUTO) {
		ret = s3cfb_direct_ioctl(ctrl->id, S3CFB_SET_WIN_ADDR, \
				(unsigned long)ctrl->out->dst[idx].base[FIMC_ADDR_Y]);
		if (ret < 0) {
			fimc_err("direct_ioctl(S3CFB_SET_WIN_ADDR) fail\n");
			return -EINVAL;
		}

		if(ctrl->fb.is_enable == 0) {
			ret = s3cfb_direct_ioctl(ctrl->id, S3CFB_SET_WIN_ON, \
								(unsigned long)NULL);
			if (ret < 0) {
				fimc_err("direct_ioctl(S3CFB_SET_WIN_ON) fail\n");
				return -EINVAL;
			}

			ctrl->fb.is_enable = 1;
		}
	}

	/* Detach buffer from incomming queue. */
	ret =  fimc_detach_in_queue(ctrl, &next);
	if (ret == 0) {	/* There is a buffer in incomming queue. */
		fimc_outdev_set_src_addr(ctrl, ctrl->out->src[next].base);

		memset(&buf_set, 0x00, sizeof(buf_set));
		buf_set.base[FIMC_ADDR_Y] = ctrl->out->dst[next].base[FIMC_ADDR_Y];

		for (i = 0; i < FIMC_PHYBUFS; i++)
			fimc_hwset_output_address(ctrl, &buf_set, i);
		
		ret = fimc_outdev_start_camif(ctrl);
		if (ret < 0)
			fimc_err("Fail: fimc_start_camif\n");

		ctrl->out->idx.active = next;
		ctrl->status = FIMC_STREAMON;
	} else {	/* There is no buffer in incomming queue. */
		ctrl->out->idx.active = -1;
		ctrl->status = FIMC_STREAMON_IDLE;
	}

	return wakeup;
}
Esempio n. 6
0
static inline int fimc_resume_out(struct fimc_control *ctrl)
{
        int index = -1, ret = -1;

	switch (ctrl->out->overlay.mode) {
	case FIMC_OVERLAY_NONE:
		if (ctrl->status == FIMC_ON_IDLE_SLEEP) {
		        ret = fimc_outdev_set_param(ctrl);
		        if (ret < 0)
		                fimc_err("Fail: fimc_outdev_set_param\n");

			ctrl->status = FIMC_STREAMON_IDLE;
		} else if (ctrl->status == FIMC_OFF_SLEEP) {
			ctrl->status = FIMC_STREAMOFF;
		} else {
			fimc_err("%s: Undefined status : %d\n", 
						__func__, ctrl->status);
		}
		break;

	case FIMC_OVERLAY_DMA_AUTO:
		if (ctrl->status == FIMC_ON_IDLE_SLEEP) {
			fimc_outdev_resume_dma(ctrl);
		        ret = fimc_outdev_set_param(ctrl);
		        if (ret < 0)
		                fimc_err("Fail: fimc_outdev_set_param\n");

			ctrl->status = FIMC_STREAMON_IDLE;

		} else if (ctrl->status == FIMC_OFF_SLEEP) {
			ctrl->status = FIMC_STREAMOFF;
		} else {
			fimc_err("%s: Undefined status : %d\n", 
						__func__, ctrl->status);
		}

		break;

	case FIMC_OVERLAY_DMA_MANUAL:
		if (ctrl->status == FIMC_ON_IDLE_SLEEP) {
		        ret = fimc_outdev_set_param(ctrl);
		        if (ret < 0)
		                fimc_err("Fail: fimc_outdev_set_param\n");

			ctrl->status = FIMC_STREAMON_IDLE;

		} else if (ctrl->status == FIMC_OFF_SLEEP) {
			ctrl->status = FIMC_STREAMOFF;
		} else {
			fimc_err("%s: Undefined status : %d\n", 
						__func__, ctrl->status);
		}

		break;

	case FIMC_OVERLAY_FIFO:
		if (ctrl->status == FIMC_ON_SLEEP) {
		        ctrl->status = FIMC_READY_ON;

		        ret = fimc_outdev_set_param(ctrl);
		        if (ret < 0)
		                fimc_err("Fail: fimc_outdev_set_param\n");

#if defined(CONFIG_VIDEO_IPC)
	                if (ctrl->out->pix.field == V4L2_FIELD_INTERLACED_TB)
	                        ipc_start();
#endif
			index = ctrl->out->idx.active;
	                fimc_outdev_set_src_addr(ctrl, ctrl->out->src[index].base);

	                ret = fimc_start_fifo(ctrl);
	                if (ret < 0)
	                        fimc_err("Fail: fimc_start_fifo\n");

	                ctrl->status = FIMC_STREAMON;
		} else if (ctrl->status == FIMC_OFF_SLEEP) {
			ctrl->status = FIMC_STREAMOFF;
		} else {
			fimc_err("%s: Undefined status : %d\n", __func__, ctrl->status);
		}

		break;
	}

	return 0;
}