diff options
author | Markuss Broks <markuss.broks@gmail.com> | 2022-05-23 19:53:41 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-06-11 15:35:28 +0200 |
commit | 76d1eb09eb9e962b43c9cc45cae1799bf5fb210e (patch) | |
tree | 1331516390e9b60e531bbe10ef90c68c55580739 | |
parent | dt-bindings: proximity: vl53l0x: Document optional supply and GPIO properties (diff) | |
download | linux-76d1eb09eb9e962b43c9cc45cae1799bf5fb210e.tar.xz linux-76d1eb09eb9e962b43c9cc45cae1799bf5fb210e.zip |
proximity: vl53l0x: Prefer pre-initialized interrupt flags
On some boards interrupt type might be different than falling edge,
like hardcoded in driver. Leave interrupt flags as they were pre-configured
from the device-tree. If they're not provided, default to falling edge
interrupts.
Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
Link: https://lore.kernel.org/r/20220523175344.5845-3-markuss.broks@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/iio/proximity/vl53l0x-i2c.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c index a284b20529fb..7272732d9800 100644 --- a/drivers/iio/proximity/vl53l0x-i2c.c +++ b/drivers/iio/proximity/vl53l0x-i2c.c @@ -16,6 +16,7 @@ #include <linux/delay.h> #include <linux/i2c.h> +#include <linux/irq.h> #include <linux/interrupt.h> #include <linux/module.h> @@ -57,11 +58,15 @@ static irqreturn_t vl53l0x_handle_irq(int irq, void *priv) static int vl53l0x_configure_irq(struct i2c_client *client, struct iio_dev *indio_dev) { + int irq_flags = irq_get_trigger_type(client->irq); struct vl53l0x_data *data = iio_priv(indio_dev); int ret; + if (!irq_flags) + irq_flags = IRQF_TRIGGER_FALLING; + ret = devm_request_irq(&client->dev, client->irq, vl53l0x_handle_irq, - IRQF_TRIGGER_FALLING, indio_dev->name, indio_dev); + irq_flags, indio_dev->name, indio_dev); if (ret) { dev_err(&client->dev, "devm_request_irq error: %d\n", ret); return ret; |