diff options
Diffstat (limited to 'drivers/media/video/samsung/fimc/fimc_dev.c')
-rw-r--r-- | drivers/media/video/samsung/fimc/fimc_dev.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/media/video/samsung/fimc/fimc_dev.c b/drivers/media/video/samsung/fimc/fimc_dev.c index 2554d7e..aadae21 100644 --- a/drivers/media/video/samsung/fimc/fimc_dev.c +++ b/drivers/media/video/samsung/fimc/fimc_dev.c @@ -364,11 +364,19 @@ static inline void fimc_irq_out(struct fimc_control *ctrl) struct fimc_ctx *ctx; u32 wakeup = 1; int ctx_num = ctrl->out->idxs.active.ctx; - ctx = &ctrl->out->ctx[ctx_num]; /* Interrupt pendding clear */ fimc_hwset_clear_irq(ctrl); + /* check context num */ + if (ctx_num < 0 || ctx_num >= FIMC_MAX_CTXS) { + fimc_err("fimc_irq_out: invalid ctx (ctx=%d)\n", ctx_num); + wake_up(&ctrl->wq); + return; + } + + ctx = &ctrl->out->ctx[ctx_num]; + switch (ctx->overlay.mode) { case FIMC_OVLY_NONE_SINGLE_BUF: wakeup = fimc_irq_out_single_buf(ctrl, ctx); @@ -381,6 +389,8 @@ static inline void fimc_irq_out(struct fimc_control *ctrl) wakeup = fimc_irq_out_dma(ctrl, ctx); break; default: + fimc_err("[ctx=%d] fimc_irq_out: wrong overlay.mode (%d)\n", + ctx_num, ctx->overlay.mode); break; } @@ -1509,13 +1519,12 @@ int fimc_suspend(struct platform_device *pdev, pm_message_t state) if (ctrl->out) fimc_suspend_out(ctrl); - else if (ctrl->cap) fimc_suspend_cap(ctrl); else ctrl->status = FIMC_OFF_SLEEP; - if (atomic_read(&ctrl->in_use)) + if (atomic_read(&ctrl->in_use) && ctrl->status != FIMC_OFF_SLEEP) fimc_clk_en(ctrl, false); return 0; @@ -1630,12 +1639,11 @@ int fimc_resume(struct platform_device *pdev) ctrl = get_fimc_ctrl(id); pdata = to_fimc_plat(ctrl->dev); - if (atomic_read(&ctrl->in_use)) + if (atomic_read(&ctrl->in_use) && ctrl->status != FIMC_OFF_SLEEP) fimc_clk_en(ctrl, true); if (ctrl->out) fimc_resume_out(ctrl); - else if (ctrl->cap) fimc_resume_cap(ctrl); else |