iio: accel: bmc150: Make it possible to configure INT2 instead of INT1
authorStephan Gerhold <stephan@gerhold.net>
Mon, 2 Aug 2021 15:56:56 +0000 (17:56 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 8 Aug 2021 15:48:30 +0000 (16:48 +0100)
commit73d672e63f3062e987f9c92abdeb332e280f47db
tree5946e4a6986bcc00bcc7d8c800769f1f5fcc7ef4
parent02104141f3fa08c0b8d3924e0db4744212ed5b9a
iio: accel: bmc150: Make it possible to configure INT2 instead of INT1

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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210802155657.102766-4-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/bmc150-accel-core.c