From: Laurent Pinchart Date: Mon, 9 Nov 2015 22:01:57 +0000 (-0200) Subject: [media] media: omap4iss: csi2: Fix IRQ handling when stopping module X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=769161fd2d90fc5b5304c73a0f2be7298c5ce430;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [media] media: omap4iss: csi2: Fix IRQ handling when stopping module When stopping the CSI2 receiver the s_stream handler will wait for the IRQ handler to notice the stop request. The receiver, automatically disabled by the hardware after each frame, is then not reenabled by the IRQ handler as it returns immediately. As the IRQ handler check is performed before handling the context IRQ, the context IRQ source isn't cleared, and the CSI2 IRQ is then fired again immediately. The IRQ handler then fails to notice that the module is being stopped, processes the IRQ normally and reenables the CSI2 hardware. The problem goes unnoticed at stream stop time, but depending on the IRQ and s_stream scheduling timings, the CSI2 receiver can end up being hanged and will not produce any interrupt the next time it gets enabled, despite being soft-reset then. Fix this by checking for module stop after clearing the context IRQ source. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c index c6e6d47ac57f..b941035139ae 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.c +++ b/drivers/staging/media/omap4iss/iss_csi2.c @@ -674,6 +674,9 @@ static void csi2_isr_ctx(struct iss_csi2_device *csi2, status = iss_reg_read(csi2->iss, csi2->regs1, CSI2_CTX_IRQSTATUS(n)); iss_reg_write(csi2->iss, csi2->regs1, CSI2_CTX_IRQSTATUS(n), status); + if (omap4iss_module_sync_is_stopping(&csi2->wait, &csi2->stopping)) + return; + /* Propagate frame number */ if (status & CSI2_CTX_IRQ_FS) { struct iss_pipeline *pipe = @@ -776,9 +779,6 @@ void omap4iss_csi2_isr(struct iss_csi2_device *csi2) pipe->error = true; } - if (omap4iss_module_sync_is_stopping(&csi2->wait, &csi2->stopping)) - return; - /* Successful cases */ if (csi2_irqstatus & CSI2_IRQ_CONTEXT0) csi2_isr_ctx(csi2, &csi2->contexts[0]);