Skip to contentSkip to conversation

i2c: designware: use polling when IRQ resource is 0

PATCH In review Samuel Tirwa 2 participants 2 messages Nov 3

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 i2c: designware: use polling when IRQ resource is 0

When an Intel LPSS I2C controller has no usable interrupt (firmware reports PCI INTx as not connected), intel-lpss passes 0 as the IRQ base, which leaves the child device with an IRQ resource whose start is 0. platform_get_irq_optional() then returns 0 instead of -ENXIO, so the DesignWare driver never enabled ACCESS_POLLING and request_irq(0, ...) failed.

Treat an IRQ number of 0 the same as 'no IRQ resource' and enable polling mode.

---
 drivers/i2c/busses/i2c-designware-platdrv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-platdrv.c +1 -1
index ca63b74..035ec92 100644
@@ -4,7 +4,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 	int irq, ret;
 
 	irq = platform_get_irq_optional(pdev, 0);
-	if (irq == -ENXIO)
+	if (irq == -ENXIO || irq == 0)
 		flags |= ACCESS_POLLING;
 	else if (irq < 0)
 		return irq;
Signature · 1 line
2.56.0.windows.4
#1 lore raw
Quoted 9 lines · Samuel Tirwa

When an Intel LPSS I2C controller has no usable interrupt (firmware reports PCI INTx as not connected), intel-lpss passes 0 as the IRQ base, which leaves the child device with an IRQ resource whose start is 0. platform_get_irq_optional() then returns 0 instead of -ENXIO, so the DesignWare driver never enabled ACCESS_POLLING and request_irq(0, ...) failed.

Treat an IRQ number of 0 the same as 'no IRQ resource' and enable polling mode.

Slow down. You have made a mess in the mailing list: no email thread, no versioning between the series of the same, no cover letter. Take your time to become a familiar with the process first.

...

drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_plat_probe(struct platform_device *pdev) · line 10

Quoted 6 lines
drivers/i2c/busses/i2c-designware-platdrv.c +1 -1
 	irq = platform_get_irq_optional(pdev, 0);
-	if (irq == -ENXIO)
+	if (irq == -ENXIO || irq == 0)
 		flags |= ACCESS_POLLING;
 	else if (irq < 0)
 		return irq;

NAK. irq==0 gives a warning and has not be a valid output from platform_get_irq*().

Signature · 2 lines
With Best Regards,
Andy Shevchenko