static irqreturn_t jpeg_irq_handler(int irq, void *priv) { unsigned int int_status; struct jpeg_dev *jpeg = priv; spin_lock(&jpeg->slock); int_status = jpeg_get_int_status(jpeg->regs); jpeg_clean_interrupt(jpeg->regs); clear_bit(DEV_RUN, &jpeg->state); if (int_status & 0x2) { if (jpeg->oneshot_dev) { struct m2m1shot_task *task = m2m1shot_get_current_task(jpeg->oneshot_dev); task->task.buf_cap.plane[0].len = jpeg_get_stream_size(jpeg->regs); m2m1shot_task_finish(jpeg->oneshot_dev, task, true); } } else { dev_err(jpeg->dev, "JPEG ERROR Interrupt (%#x) is triggered\n", int_status); jpeg_show_sfr_status(jpeg->regs); exynos_sysmmu_show_status(jpeg->dev); } spin_unlock(&jpeg->slock); return IRQ_HANDLED; }
int jpeg_exe_enc(struct jpeg_control *ctrl) { jpeg_start_encode(ctrl->reg_base); if (interruptible_sleep_on_timeout(&ctrl->wq, INT_TIMEOUT) == 0) jpeg_err("waiting for interrupt is timeout\n"); if (ctrl->irq_ret != OK_ENC_OR_DEC) { jpeg_err("jpeg encode error(%d)\n", ctrl->irq_ret); return -1; } ctrl->enc_param.size = jpeg_get_stream_size(ctrl->reg_base); return 0; }