linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Masney <masneyb@onstation.org>
To: jic23@kernel.org, linux-iio@vger.kernel.org
Cc: devel@driverdev.osuosl.org, lars@metafoo.de,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	Jon.Brenner@ams.com, pmeerw@pmeerw.net, knaack.h@gmx.de
Subject: [PATCH 02/11] staging: iio: tsl2x7x: correct interrupt handler trigger
Date: Wed, 21 Mar 2018 06:29:03 -0400	[thread overview]
Message-ID: <20180321102912.5130-3-masneyb@onstation.org> (raw)
In-Reply-To: <20180321102912.5130-1-masneyb@onstation.org>

tsl2x7x_event_handler() was not called as expected when the device was
asserting a hardware interrupt. This patch changes the interrupt line
trigger from rising to falling.

The driver was tested on a TSL2772 hooked up to a Raspberry Pi 2. The
interrupt pin also had a 10K pull-up resistor per the requirements from
the datasheet. The relevant device tree binding:

&i2c1 {
	tsl2772@39 {
		compatible = "amstaos,tsl2772";
		reg = <0x39>;
		interrupt-parent = <&gpio>;
		interrupts = <22 0x2>;
	};
};

With this patch, iio_event_monitor now shows the events when the
channels are outside the defined interrupt thresholds.

$ sudo ./iio_event_monitor tsl2772
Found IIO device with name tsl2772 with device number 0
Event: time: 1478193460053760446, type: proximity, channel: 0, evtype:
thresh, direction: either
...
Event: time: 1478193463020270185, type: illuminance, channel: 0, evtype:
thresh, direction: either
...

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 drivers/staging/iio/light/tsl2x7x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c
index 82cf9d853b18..59921850a226 100644
--- a/drivers/staging/iio/light/tsl2x7x.c
+++ b/drivers/staging/iio/light/tsl2x7x.c
@@ -1763,7 +1763,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
 		ret = devm_request_threaded_irq(&clientp->dev, clientp->irq,
 						NULL,
 						&tsl2x7x_event_handler,
-						IRQF_TRIGGER_RISING |
+						IRQF_TRIGGER_FALLING |
 						IRQF_ONESHOT,
 						"TSL2X7X_event",
 						indio_dev);
-- 
2.14.3

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2018-03-21 10:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 10:29 [PATCH 00/11] staging: iio: tsl2x7x: staging cleanups Brian Masney
2018-03-21 10:29 ` [PATCH 01/11] staging: iio: tsl2x7x: remove unnecessary code Brian Masney
2018-03-24 13:32   ` Jonathan Cameron
2018-03-21 10:29 ` Brian Masney [this message]
2018-03-24 13:33   ` [PATCH 02/11] staging: iio: tsl2x7x: correct interrupt handler trigger Jonathan Cameron
2018-03-21 10:29 ` [PATCH 03/11] staging: iio: tsl2x7x: no need to clear interrupt flag when getting lux Brian Masney
2018-03-24 13:34   ` Jonathan Cameron
2018-03-21 10:29 ` [PATCH 04/11] staging: iio: tsl2x7x: simplify tsl2x7x_prox_cal() Brian Masney
2018-03-24 13:35   ` Jonathan Cameron
2018-03-21 10:29 ` [PATCH 05/11] staging: iio: tsl2x7x: split out als and prox interrupt settings Brian Masney
2018-03-24 13:36   ` Jonathan Cameron
2018-03-21 10:29 ` [PATCH 06/11] staging: iio: tsl2x7x: make logging consistent and correct newlines Brian Masney
2018-03-24 13:39   ` Jonathan Cameron
2018-03-21 10:29 ` [PATCH 07/11] staging: iio: tsl2x7x: split out als and prox persistence settings Brian Masney
2018-03-24 13:40   ` Jonathan Cameron
2018-03-21 10:29 ` [PATCH 08/11] staging: iio: tsl2x7x: remove unused variables from tsl2x7x_get_lux() Brian Masney
2018-03-24 13:41   ` Jonathan Cameron
2018-03-21 10:29 ` [PATCH 09/11] staging: iio: tsl2x7x: remove ch0 and ch1 " Brian Masney
2018-03-24 13:42   ` Jonathan Cameron
2018-03-21 10:29 ` [PATCH 10/11] staging: iio: tsl2x7x: put local variables in reverse Christmas tree order Brian Masney
2018-03-24 13:44   ` Jonathan Cameron
2018-03-21 10:29 ` [PATCH 11/11] staging: iio: tsl2x7x: add copyright Brian Masney
2018-03-24 13:46   ` Jonathan Cameron

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=20180321102912.5130-3-masneyb@onstation.org \
    --to=masneyb@onstation.org \
    --cc=Jon.Brenner@ams.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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;
as well as URLs for NNTP newsgroup(s).