From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Ferry Toth <fntoth@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
<linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Ferry Toth <ftoth@exalondelft.nl>
Subject: Re: [PATCH v1 01/11] iio: light: tsl2563: Do not hardcode interrupt trigger type
Date: Mon, 12 Dec 2022 10:59:02 +0000 [thread overview]
Message-ID: <20221212105902.000059a4@Huawei.com> (raw)
In-Reply-To: <c48cc4ff-9021-0e32-6e68-89fa549847cc@gmail.com>
On Sun, 11 Dec 2022 18:14:01 +0100
Ferry Toth <fntoth@gmail.com> wrote:
> Hi,
>
> Op 11-12-2022 om 14:26 schreef Jonathan Cameron:
> > On Wed, 7 Dec 2022 21:03:38 +0200
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> >> From: Ferry Toth <ftoth@exalondelft.nl>
> >>
> >> 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>
> >
> > 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?
>
> It's a breakout board too. I think it's something like GY-2561.
>
> I wanted to write up an example how to get connect iio sensors to work
> with linux. So I asked my colleague who is a great fan of aliexpress if
> he had any sensor on a breakout board with I2C. In the past I had it
> working with MRAA and UPM but that seems to be a dead end now.
>
> We have ACPI working on Intel Edison-Arduino with quite a few examples
> from Andy. And the "Arduino" header makes it very easy to wire up these
> kind of breakout boards, fantastic platform this type of developments.
>
> Just wiring up the I2C and get it to work was easy enough. And then the
> interrupt pin makes an interesting example (even though likely useless
> for most applications of the light sensor).
>
> Write-up here if you are interested:
> https://htot.github.io/meta-intel-edison/4.6-libiio.html
Thanks!
Jonathan
>
> > 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) {
> >
>
prev parent reply other threads:[~2022-12-12 11:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 19:03 [PATCH v1 01/11] iio: light: tsl2563: Do not hardcode interrupt trigger type Andy Shevchenko
2022-12-07 19:03 ` [PATCH v1 02/11] iio: light: tsl2563: Use i2c_smbus_write_word_data() in tsl2563_configure() Andy Shevchenko
2022-12-07 19:03 ` [PATCH v1 03/11] iio: light: tsl2563: Configure INT in one place Andy Shevchenko
2022-12-11 13:17 ` Jonathan Cameron
2022-12-07 19:03 ` [PATCH v1 04/11] iio: light: tsl2563: Make use of the macros from bits.h Andy Shevchenko
2022-12-11 13:19 ` Jonathan Cameron
2022-12-07 19:03 ` [PATCH v1 05/11] iio: light: tsl2563: Drop unused defintion(s) Andy Shevchenko
2022-12-07 19:03 ` [PATCH v1 06/11] iio: light: tsl2563: Simplify with dev_err_probe Andy Shevchenko
2022-12-07 19:03 ` [PATCH v1 07/11] iio: light: tsl2563: Drop legacy platform data code Andy Shevchenko
2022-12-07 19:03 ` [PATCH v1 08/11] iio: light: tsl2563: Utilise temporary variable for struct device Andy Shevchenko
2022-12-07 19:03 ` [PATCH v1 09/11] iio: light: tsl2563: Use dev_get_drvdata() directly in PM callbacks Andy Shevchenko
2022-12-07 19:03 ` [PATCH v1 10/11] iio: light: tsl2563: sort header inclusion alphabetically Andy Shevchenko
2022-12-07 19:03 ` [PATCH v1 11/11] iio: light: tsl2563: Keep Makefile sorted by module name Andy Shevchenko
2022-12-11 13:26 ` [PATCH v1 01/11] iio: light: tsl2563: Do not hardcode interrupt trigger type Jonathan Cameron
2022-12-11 17:14 ` Ferry Toth
2022-12-12 10:59 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221212105902.000059a4@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=fntoth@gmail.com \
--cc=ftoth@exalondelft.nl \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox