Thread (27 messages) 27 messages, 5 authors, 2021-07-31

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

From: Linus Walleij <hidden>
Date: 2021-07-19 14:07:37
Also in: linux-iio

On Mon, Jul 19, 2021 at 1:26 PM Stephan Gerhold [off-list ref] 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@gerhold.net>
 #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.
What does platform_get_irq_byname() do on ACPI systems?

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.

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help