Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 241781
b: refs/heads/master
c: 65777e5
h: refs/heads/master
i:
  241779: 1cd7fbb
v: v3
  • Loading branch information
Hyunwoong Kim authored and Mauro Carvalho Chehab committed Mar 21, 2011
1 parent 2d696d4 commit cfd649a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1b09f292eb99fd6a3601e8421c463905dbb0a866
refs/heads/master: 65777e5c58bd3b25fcba39eddb98d8a8ce35d3be
35 changes: 33 additions & 2 deletions trunk/drivers/media/video/s5p-fimc/fimc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,23 @@ int fimc_set_scaler_info(struct fimc_ctx *ctx)
return 0;
}

static int stop_streaming(struct vb2_queue *q)
{
struct fimc_ctx *ctx = q->drv_priv;
struct fimc_dev *fimc = ctx->fimc_dev;

if (!fimc_m2m_pending(fimc))
return 0;

set_bit(ST_M2M_SHUT, &fimc->state);

wait_event_timeout(fimc->irq_queue,
!test_bit(ST_M2M_SHUT, &fimc->state),
FIMC_SHUTDOWN_TIMEOUT);

return 0;
}

static void fimc_capture_handler(struct fimc_dev *fimc)
{
struct fimc_vid_cap *cap = &fimc->vid_cap;
Expand Down Expand Up @@ -358,7 +375,10 @@ static irqreturn_t fimc_isr(int irq, void *priv)

spin_lock(&fimc->slock);

if (test_and_clear_bit(ST_M2M_PEND, &fimc->state)) {
if (test_and_clear_bit(ST_M2M_SHUT, &fimc->state)) {
wake_up(&fimc->irq_queue);
goto isr_unlock;
} else if (test_and_clear_bit(ST_M2M_PEND, &fimc->state)) {
struct vb2_buffer *src_vb, *dst_vb;
struct fimc_ctx *ctx = v4l2_m2m_get_curr_priv(fimc->m2m.m2m_dev);

Expand Down Expand Up @@ -634,7 +654,17 @@ static void fimc_dma_run(void *priv)

static void fimc_job_abort(void *priv)
{
/* Nothing done in job_abort. */
struct fimc_ctx *ctx = priv;
struct fimc_dev *fimc = ctx->fimc_dev;

if (!fimc_m2m_pending(fimc))
return;

set_bit(ST_M2M_SHUT, &fimc->state);

wait_event_timeout(fimc->irq_queue,
!test_bit(ST_M2M_SHUT, &fimc->state),
FIMC_SHUTDOWN_TIMEOUT);
}

static int fimc_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers,
Expand Down Expand Up @@ -711,6 +741,7 @@ struct vb2_ops fimc_qops = {
.buf_queue = fimc_buf_queue,
.wait_prepare = fimc_unlock,
.wait_finish = fimc_lock,
.stop_streaming = stop_streaming,
};

static int fimc_m2m_querycap(struct file *file, void *priv,
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/media/video/s5p-fimc/fimc-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ enum fimc_dev_flags {
ST_IDLE,
ST_OUTDMA_RUN,
ST_M2M_PEND,
ST_M2M_SHUT,
/* for capture node */
ST_CAPT_PEND,
ST_CAPT_RUN,
Expand Down

0 comments on commit cfd649a

Please sign in to comment.