Re: [PATCH 3/4] iio: accel: bmc150: Make it possible to configure INT2 instead of INT1
From: Stephan Gerhold <stephan@gerhold.net>
Date: 2021-07-19 17:29:00
Also in:
linux-iio
On Mon, Jul 19, 2021 at 07:19:05PM +0300, Andy Shevchenko wrote:
On Mon, Jul 19, 2021 at 6:11 PM Stephan Gerhold [off-list ref] wrote:quoted
On Mon, Jul 19, 2021 at 06:01:01PM +0300, Andy Shevchenko wrote:quoted
On Mon, Jul 19, 2021 at 5:07 PM Linus Walleij [off-list ref] wrote:quoted
On Mon, Jul 19, 2021 at 1:26 PM Stephan Gerhold [off-list ref] wrote:...quoted
quoted
quoted
quoted
#include <linux/acpi.h> +#include <linux/of_irq.h>(...)quoted
+ irq_info = bmc150_accel_interrupts_int1; + if (irq == of_irq_get_byname(dev->of_node, "INT2")) + irq_info = bmc150_accel_interrupts_int2;This looks a bit DT-specific, but I don't see that ACPI has named IRQs so I don't know what to do about it either.Yeah, we only have so far the (de facto) established way of naming GPIO based IRQs, and not IOxAPIC ones.quoted
What does platform_get_irq_byname() do on ACPI systems?See above.quoted
If there is no obvious fix I would leave it like this until the first ACPI used needing this comes along, but I think maybe Andy has suggestions.The platform_get_irq_byname() should do something similar that has been done in platform_get_irq() WRT ACPI. Here for sure the platform_get_irq_byname() or its optional variant should be used.I don't think there is a platform device here, we only have the i2c_client or spi_device. That's why I didn't use platform_get_irq_byname(). :) Is there something equivalent for I2C/SPI drivers?Not yet. You probably need to supply some code there to allow multi-IRQ devices (in resource provider agnostic way). You need to provide fwnode_get_irq_byname() to be similar with https://elixir.bootlin.com/linux/latest/source/drivers/base/property.c#L1010 Then use it in the drivers. And/or integrate into frameworks somehow (something in between the lines: https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L461).
Well, I don't think anyone has an ACPI use case for this right now so it's probably better if this is done by someone who actually needs this and can test it somewhere. :) I actually just "copied" this approach from some other IIO drivers where this is done similarly (and additionally checked the source code to make sure this won't break anything for ACPI platforms). Stephan