Skip to content

Commit 09f20f2

Browse files
bingbucaomchehab
authored andcommitted
media: intel-ipu3: cio2: Handle IRQs until INT_STS is cleared
Interrupt behavior shows that some time the frame end and frame start of next frame is unstable and can range from several to hundreds of micro-sec. In the case of ~10us, isr may not clear next sof interrupt status in single handling, which prevents new interrupts from coming. Fix this by handling all pending IRQs before exiting isr, so any abnormal behavior results from very short interrupt status changes is protected. Signed-off-by: Bingbu Cao <bingbu.cao@intel.com> Signed-off-by: Andy Yeh <andy.yeh@intel.com> Signed-off-by: Yong Zhi <yong.zhi@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
1 parent f10379a commit 09f20f2

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

‎drivers/media/pci/intel/ipu3/ipu3-cio2.c‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -640,18 +640,10 @@ static const char *const cio2_port_errs[] = {
640640
"PKT2LONG",
641641
};
642642

643-
static irqreturn_t cio2_irq(int irq, void *cio2_ptr)
643+
static void cio2_irq_handle_once(struct cio2_device *cio2, u32 int_status)
644644
{
645-
struct cio2_device *cio2 = cio2_ptr;
646645
void __iomem *const base = cio2->base;
647646
struct device *dev = &cio2->pci_dev->dev;
648-
u32 int_status, int_clear;
649-
650-
int_status = readl(base + CIO2_REG_INT_STS);
651-
int_clear = int_status;
652-
653-
if (!int_status)
654-
return IRQ_NONE;
655647

656648
if (int_status & CIO2_INT_IOOE) {
657649
/*
@@ -770,9 +762,29 @@ static irqreturn_t cio2_irq(int irq, void *cio2_ptr)
770762
int_status &= ~(CIO2_INT_IOIE | CIO2_INT_IOIRQ);
771763
}
772764

773-
writel(int_clear, base + CIO2_REG_INT_STS);
774765
if (int_status)
775766
dev_warn(dev, "unknown interrupt 0x%x on INT\n", int_status);
767+
}
768+
769+
static irqreturn_t cio2_irq(int irq, void *cio2_ptr)
770+
{
771+
struct cio2_device *cio2 = cio2_ptr;
772+
void __iomem *const base = cio2->base;
773+
struct device *dev = &cio2->pci_dev->dev;
774+
u32 int_status;
775+
776+
int_status = readl(base + CIO2_REG_INT_STS);
777+
dev_dbg(dev, "isr enter - interrupt status 0x%x\n", int_status);
778+
if (!int_status)
779+
return IRQ_NONE;
780+
781+
do {
782+
writel(int_status, base + CIO2_REG_INT_STS);
783+
cio2_irq_handle_once(cio2, int_status);
784+
int_status = readl(base + CIO2_REG_INT_STS);
785+
if (int_status)
786+
dev_dbg(dev, "pending status 0x%x\n", int_status);
787+
} while (int_status);
776788

777789
return IRQ_HANDLED;
778790
}

0 commit comments

Comments
 (0)