static int gsc_capture_state_cleanup(struct gsc_dev *gsc)
{
	unsigned long flags;
	bool streaming;

	spin_lock_irqsave(&gsc->slock, flags);
	streaming = gsc->state & (1 << ST_CAPT_PIPE_STREAM);

	gsc->state &= ~(1 << ST_CAPT_RUN | 1 << ST_CAPT_STREAM |
			1 << ST_CAPT_PIPE_STREAM | 1 << ST_CAPT_PEND);

	set_bit(ST_CAPT_SUSPENDED, &gsc->state);
	spin_unlock_irqrestore(&gsc->slock, flags);

	if (streaming)
		return gsc_cap_pipeline_s_stream(gsc, 0);
	else
		return 0;
}
Beispiel #2
0
static void gsc_capture_buf_queue(struct vb2_buffer *vb)
{
	struct gsc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
	struct gsc_dev *gsc = ctx->gsc_dev;
	struct gsc_capture_device *cap = &gsc->cap;
	struct exynos_md *mdev = gsc->mdev[MDEV_CAPTURE];
	int min_bufs, ret;
	unsigned long flags;

	spin_lock_irqsave(&gsc->slock, flags);
	ret = gsc_capture_set_addr(vb);
	if (ret)
		gsc_err("Failed to prepare output addr");

	gsc_hw_set_output_buf_masking(gsc, vb->v4l2_buf.index, 0);

	min_bufs = cap->reqbufs_cnt > 1 ? 2 : 1;

	if (vb2_is_streaming(&cap->vbq) &&
		(gsc_hw_get_nr_unmask_bits(gsc) >= min_bufs) &&
		!test_bit(ST_CAPT_STREAM, &gsc->state)) {
		if (!test_and_set_bit(ST_CAPT_PIPE_STREAM, &gsc->state)) {
			spin_unlock_irqrestore(&gsc->slock, flags);
			if (!mdev->is_flite_on)
				gsc_cap_pipeline_s_stream(gsc, 1);
			else
				v4l2_subdev_call(gsc->cap.sd_cap, video,
							s_stream, 1);
			return;
		}

		if (!test_bit(ST_CAPT_STREAM, &gsc->state)) {
			gsc_dbg("G-Scaler h/w enable control");
			gsc_hw_enable_control(gsc, true);
			set_bit(ST_CAPT_STREAM, &gsc->state);
		}
	}
	spin_unlock_irqrestore(&gsc->slock, flags);

	return;
}
static int gsc_capture_start_streaming(struct vb2_queue *q, unsigned int count)
{
	struct gsc_ctx *ctx = q->drv_priv;
	struct gsc_dev *gsc = ctx->gsc_dev;
	struct gsc_capture_device *cap = &gsc->cap;
	int min_bufs;

	gsc_hw_set_sw_reset(gsc);
	gsc_wait_reset(gsc);
	gsc_hw_set_output_buf_mask_all(gsc);

	min_bufs = cap->reqbufs_cnt > 1 ? 2 : 1;
	if ((gsc_hw_get_nr_unmask_bits(gsc) >= min_bufs) &&
		!test_bit(ST_CAPT_STREAM, &gsc->state)) {
		if (!test_and_set_bit(ST_CAPT_PIPE_STREAM, &gsc->state)) {
			gsc_info("");
			gsc_cap_pipeline_s_stream(gsc, 1);
		}
	}

	return 0;
}
static void gsc_capture_buf_queue(struct vb2_buffer *vb)
{
	struct gsc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
	struct gsc_dev *gsc = ctx->gsc_dev;
	struct gsc_capture_device *cap = &gsc->cap;
	int min_bufs, ret;
	unsigned long flags;

	spin_lock_irqsave(&gsc->slock, flags);
	ret = gsc_capture_set_addr(vb);
	if (ret)
		gsc_err("Failed to prepare output addr");

	if (!test_bit(ST_CAPT_SUSPENDED, &gsc->state)) {
		gsc_info("buf_index : %d", vb->v4l2_buf.index);
		gsc_hw_set_output_buf_masking(gsc, vb->v4l2_buf.index, 0);
	}

	min_bufs = cap->reqbufs_cnt > 1 ? 2 : 1;

	if (vb2_is_streaming(&cap->vbq) &&
		(gsc_hw_get_nr_unmask_bits(gsc) >= min_bufs) &&
		!test_bit(ST_CAPT_STREAM, &gsc->state)) {
		if (!test_and_set_bit(ST_CAPT_PIPE_STREAM, &gsc->state)) {
			spin_unlock_irqrestore(&gsc->slock, flags);
			gsc_cap_pipeline_s_stream(gsc, 1);
			return;
		}

		if (!test_bit(ST_CAPT_STREAM, &gsc->state)) {
			gsc_info("G-Scaler h/w enable control");
			gsc_hw_enable_control(gsc, true);
			set_bit(ST_CAPT_STREAM, &gsc->state);
		}
	}
	spin_unlock_irqrestore(&gsc->slock, flags);

	return;
}
Beispiel #5
0
static int gsc_capture_start_streaming(struct vb2_queue *q, unsigned int count)
{
	struct gsc_ctx *ctx = q->drv_priv;
	struct gsc_dev *gsc = ctx->gsc_dev;
	struct gsc_capture_device *cap = &gsc->cap;
	struct exynos_md *mdev = gsc->mdev[MDEV_CAPTURE];
	int min_bufs;

	min_bufs = cap->reqbufs_cnt > 1 ? 2 : 1;
	if ((gsc_hw_get_nr_unmask_bits(gsc) >= min_bufs) &&
		!test_bit(ST_CAPT_STREAM, &gsc->state)) {
		if (!test_and_set_bit(ST_CAPT_PIPE_STREAM, &gsc->state)) {
			gsc_dbg("");
			if (!mdev->is_flite_on)
				gsc_cap_pipeline_s_stream(gsc, 1);
			else
				v4l2_subdev_call(gsc->cap.sd_cap, video,
							s_stream, 1);
		}
	}

	return 0;
}
Beispiel #6
0
static int gsc_capture_state_cleanup(struct gsc_dev *gsc)
{
	struct exynos_md *mdev = gsc->mdev[MDEV_CAPTURE];
	unsigned long flags;
	bool streaming;

	spin_lock_irqsave(&gsc->slock, flags);
	streaming = gsc->state & (1 << ST_CAPT_PIPE_STREAM);

	gsc->state &= ~(1 << ST_CAPT_RUN | 1 << ST_CAPT_STREAM |
			1 << ST_CAPT_PIPE_STREAM | 1 << ST_CAPT_PEND);

	spin_unlock_irqrestore(&gsc->slock, flags);

	if (streaming) {
		if (!mdev->is_flite_on)
			return gsc_cap_pipeline_s_stream(gsc, 0);
		else
			return v4l2_subdev_call(gsc->cap.sd_cap, video,
							s_stream, 0);
	} else {
		return 0;
	}
}