Re: [PATCH 6/7] spmi: apple: use IRQ for RX FIFO if possible
Nick Chan <[email protected]> Sun, 26 Jul 2026 19:00:06 +0800
| Newsgroups | dev.linux.lists.asahi,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Sasha Finkelstein 於 2026/7/25 晚上9:48 寫道: > From: Alba Mendez <[email protected]> > > The IRQ fires as soon as the reply is available, which is usually takes > a few us instead of the 10ms sleep interval for polling > > Signed-off-by: Alba Mendez <[email protected]> > Signed-off-by: Sasha Finkelstein <[email protected]> > --- > drivers/spmi/spmi-apple-controller.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 96 insertions(+), 1 deletion(-) > > diff --git a/drivers/spmi/spmi-apple-controller.c b/drivers/spmi/spmi-apple-controller.c > index d8509f027df6..d627187b3ac0 100644 > --- a/drivers/spmi/spmi-apple-controller.c > +++ b/drivers/spmi/spmi-apple-controller.c [...] > @@ -195,6 +277,7 @@ static int apple_spmi_probe(struct platform_device *pdev) > > spmi = spmi_controller_get_drvdata(ctrl); > mutex_init(&spmi->fifo_lock); > + init_completion(&spmi->fifo_rx); > > spmi->regs = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(spmi->regs)) > @@ -206,11 +289,23 @@ static int apple_spmi_probe(struct platform_device *pdev) > ctrl->write_cmd = spmi_write_cmd; > ctrl->cmd = spmi_cmd; > > + irq = platform_get_irq_optional(pdev, 0); > + if (irq < 0 && irq != -ENXIO) > + return irq; > + if (irq >= 0) { > + ret = apple_spmi_init_irq(pdev, spmi, irq); > + if (ret) > + return ret; > + } > + > ret = devm_spmi_controller_add(&pdev->dev, ctrl); > if (ret) > return dev_err_probe(&pdev->dev, ret, > "spmi_controller_add failed\n"); > > + dev_dbg(&pdev->dev, irq >= 0 ? "Initialized with IRQ" : > + "Initialized without IRQ, falling back to polling"); > + This does not compile with clang: drivers/spmi/spmi-apple-controller.c:453:22: error: initializer element is not a compile-time constant 453 | dev_dbg(&pdev->dev, irq >= 0 ? "Initialized with IRQ" : | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | "Initialized without IRQ, falling back to polling"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > return 0; > } > > Best Regards, Nick Chan