From patchwork Wed Mar 21 10:29:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Masney X-Patchwork-Id: 10299113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7ACB60349 for ; Wed, 21 Mar 2018 10:32:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C80E9296F4 for ; Wed, 21 Mar 2018 10:32:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCADE2975A; Wed, 21 Mar 2018 10:32:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B309296F4 for ; Wed, 21 Mar 2018 10:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751553AbeCUKb7 (ORCPT ); Wed, 21 Mar 2018 06:31:59 -0400 Received: from onstation.org ([52.200.56.107]:47262 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751522AbeCUK3Z (ORCPT ); Wed, 21 Mar 2018 06:29:25 -0400 Received: from xilitla.hsd1.wv.comcast.net (c-98-236-77-125.hsd1.wv.comcast.net [98.236.77.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 16D0458A; Wed, 21 Mar 2018 10:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=onstation.org; s=default; t=1521628164; bh=YV7LG9Pv81w0W7H82/xjiUUnBkO1L+DXa6hjbBhV6do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kE/No04qyiq7IARsl9l/5J+khyhmndTOIewJazj3kyQNJNV81zzl5cJqCXaj9oygj IBdA/GjYYAuGO7r0o5+8bJP9LBC3AYy6g/UtjCy16vaazaqi/i9haSEyQN/qu72lfm BCNdNOCMcioq9jlEeUmvUhm+8aZMU3XYVKvHy7Cs= From: Brian Masney To: jic23@kernel.org, linux-iio@vger.kernel.org Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-kernel@vger.kernel.org, Jon.Brenner@ams.com Subject: [PATCH 02/11] staging: iio: tsl2x7x: correct interrupt handler trigger Date: Wed, 21 Mar 2018 06:29:03 -0400 Message-Id: <20180321102912.5130-3-masneyb@onstation.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180321102912.5130-1-masneyb@onstation.org> References: <20180321102912.5130-1-masneyb@onstation.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);