summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>2022-11-03 16:31:11 +0000
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-11-25 07:17:57 +0000
commit4656d8ab4bd9e0867defdceec614ac5ef2875c5e (patch)
treef03a259f92439b46d783817348ccf0672532cb2f /drivers/media/platform
parent5d34d90fff89a450423b0f1acbafa68c1e60344d (diff)
downloadlinux-4656d8ab4bd9e0867defdceec614ac5ef2875c5e.tar.bz2
media: sun6i-csi: Add extra checks to the interrupt routine
Check against the enabled bits and make sure capture is running before serving an interrupt, to add extra safety in the process. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
index eae0ca5cb855..b9199945d6fe 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -89,13 +89,17 @@ static void sun6i_csi_v4l2_cleanup(struct sun6i_csi_device *csi_dev)
static irqreturn_t sun6i_csi_interrupt(int irq, void *private)
{
struct sun6i_csi_device *csi_dev = private;
+ bool capture_streaming = csi_dev->capture.state.streaming;
struct regmap *regmap = csi_dev->regmap;
- u32 status;
+ u32 status = 0, enable = 0;
regmap_read(regmap, SUN6I_CSI_CH_INT_STA_REG, &status);
+ regmap_read(regmap, SUN6I_CSI_CH_INT_EN_REG, &enable);
- if (!(status & 0xFF))
+ if (!status)
return IRQ_NONE;
+ else if (!(status & enable) || !capture_streaming)
+ goto complete;
if ((status & SUN6I_CSI_CH_INT_STA_FIFO0_OF) ||
(status & SUN6I_CSI_CH_INT_STA_FIFO1_OF) ||
@@ -116,6 +120,7 @@ static irqreturn_t sun6i_csi_interrupt(int irq, void *private)
if (status & SUN6I_CSI_CH_INT_STA_VS)
sun6i_csi_capture_sync(csi_dev);
+complete:
regmap_write(regmap, SUN6I_CSI_CH_INT_STA_REG, status);
return IRQ_HANDLED;