Re: [PATCH v1 01/11] iio: light: tsl2563: Do not hardcode interrupt trigger type

From: Jonathan Cameron
Date: Sun Dec 11 2022 - 08:13:26 EST


On Wed, 7 Dec 2022 21:03:38 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> From: Ferry Toth <ftoth@xxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

Andy, would have preferred a cover letter, so I had an obvious place
to reply to the whole series...

Mostly I'm amazed anyone still has one of these devices (I have one but
it's on a break out board for the stargate2/imote2 pxa27x platform that we
dropped support for last year - I hadn't booted it for a few years)
- I can probably bodge it onto something else but I can't say it was
high on my todo list ;) So nice to know that someone still cares about
this.

So I'm curious Ferry, what device has one of these?

Whole series applied to the togreg branch of iio.git though note I'll only
push this out as testing for now because I'll want to rebase that tree
after rc1 is available.

Thanks,

Jonathan

> ---
> drivers/iio/light/tsl2563.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> 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) {