summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorFerry Toth <ftoth@exalondelft.nl>2022-12-07 21:03:38 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-12-28 17:19:45 +0000
commit027641b52fe37b64af61025298ce160c8b9b7a73 (patch)
tree0e5651c6909f612eaa0bbb3b9140906ddc2fe97b /drivers/iio
parent22cd9320b11a2eb05e5d490863a4219ca32e8ec9 (diff)
downloadlinux-stable-027641b52fe37b64af61025298ce160c8b9b7a73.tar.gz
linux-stable-027641b52fe37b64af61025298ce160c8b9b7a73.tar.bz2
linux-stable-027641b52fe37b64af61025298ce160c8b9b7a73.zip
iio: light: tsl2563: Do not hardcode interrupt trigger type
Instead of hardcoding IRQ trigger type to IRQF_TRIGGER_RAISING, let's respect the settings specified in the firmware description. To be compatible with the older firmware descriptions, if trigger type is not set up there, we'll set it to default (raising edge). Fixes: 388be4883952 ("staging:iio: tsl2563 abi fixes and interrupt handling") Fixes: bdab1001738f ("staging:iio:light:tsl2563 remove old style event registration.") Signed-off-by: Ferry Toth <ftoth@exalondelft.nl> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221207190348.9347-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/light/tsl2563.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index d0e42b73203a..71302ae864d9 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -704,6 +704,7 @@ static int tsl2563_probe(struct i2c_client *client)
struct iio_dev *indio_dev;
struct tsl2563_chip *chip;
struct tsl2563_platform_data *pdata = client->dev.platform_data;
+ unsigned long irq_flags;
int err = 0;
u8 id = 0;
@@ -759,10 +760,15 @@ static int tsl2563_probe(struct i2c_client *client)
indio_dev->info = &tsl2563_info_no_irq;
if (client->irq) {
+ irq_flags = irq_get_trigger_type(client->irq);
+ if (irq_flags == IRQF_TRIGGER_NONE)
+ irq_flags = IRQF_TRIGGER_RISING;
+ irq_flags |= IRQF_ONESHOT;
+
err = devm_request_threaded_irq(&client->dev, client->irq,
NULL,
&tsl2563_event_handler,
- IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+ irq_flags,
"tsl2563_event",
indio_dev);
if (err) {