Re: [PATCH 3/4] iio: accel: bmc150: Make it possible to configure INT2 instead of INT1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 19, 2021 at 06:01:01PM +0300, Andy Shevchenko wrote:
> On Mon, Jul 19, 2021 at 5:07 PM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> > On Mon, Jul 19, 2021 at 1:26 PM Stephan Gerhold <stephan@xxxxxxxxxxx> wrote:
> >
> > > Some Bosch accelerometers have two interrupt pins (INT1 and INT2).
> > > At the moment, the driver uses only the first one, which is fine for
> > > most situations. However, some boards might only have INT2 connected
> > > for some reason.
> > >
> > > Add the necessary bits and configuration to set up INT2. Then try
> > > to detect this situation at least for device tree setups by checking
> > > if the first interrupt (the one picked by the I2C/SPI core) is actually
> > > named "INT2" using the interrupt-names property.
> > >
> > > of_irq_get_byname() returns either 0 or some error code in case
> > > the driver probed without device tree, so in all other cases we fall
> > > back to configuring INT1 as before.
> > >
> > > Signed-off-by: Stephan Gerhold <stephan@xxxxxxxxxxx>
> >
> > >  #include <linux/acpi.h>
> > > +#include <linux/of_irq.h>
> > (...)
> > > +       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.
> 
> > What does platform_get_irq_byname() do on ACPI systems?
> 
> See above.
> 
> > 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?

Thanks!
Stephan



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux