mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	"Franklin S Cooper Jr" <fcooper@ti.com>,
	"Maxime Ripard" <maxime.ripard@free-electrons.com>,
	"Lothar Waßmann" <LW@KARO-electronics.de>
Subject: [PATCH 5/6] Input: edt-ft5x06 - do not hardcode interrupt trigger type
Date: Sat, 12 Sep 2015 10:45:50 -0700	[thread overview]
Message-ID: <3b89cb3ec897a05e8170ea1e736d3e969c1f8419.1442079408.git.dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <5044530af510d6686e78f8dfa912d89ef824f899.1442079408.git.dmitry.torokhov@gmail.com>
In-Reply-To: <5044530af510d6686e78f8dfa912d89ef824f899.1442079408.git.dmitry.torokhov@gmail.com>

Instead of hardcoding IRQ trigger type to IRQF_TRIGGER_FALLING, let's
respect settings specified in device tree. To be compatible with older
DTSes, if trigger type is not set up in DTS we'll set it to default
(falling edge).

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 .../devicetree/bindings/input/touchscreen/edt-ft5x06.txt     |  2 +-
 drivers/input/touchscreen/edt-ft5x06.c                       | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
index 9330d4d..bedd7dd 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
@@ -49,7 +49,7 @@ Example:
 		pinctrl-names = "default";
 		pinctrl-0 = <&edt_ft5x06_pins>;
 		interrupt-parent = <&gpio2>;
-		interrupts = <5 0>;
+		interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
 		reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
 		wake-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
 	};
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index ef8a7cd..7239c31 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -27,6 +27,7 @@
 
 #include <linux/module.h>
 #include <linux/ratelimit.h>
+#include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/i2c.h>
@@ -874,6 +875,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 {
 	struct edt_ft5x06_ts_data *tsdata;
 	struct input_dev *input;
+	unsigned long irq_flags;
 	int error;
 	char fw_version[EDT_NAME_LEN];
 
@@ -959,9 +961,13 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 	input_set_drvdata(input, tsdata);
 	i2c_set_clientdata(client, tsdata);
 
-	error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
-					edt_ft5x06_ts_isr,
-					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+	irq_flags = irq_get_trigger_type(client->irq);
+	if (irq_flags == IRQF_TRIGGER_NONE)
+		irq_flags = IRQF_TRIGGER_FALLING;
+	irq_flags |= IRQF_ONESHOT;
+
+	error = devm_request_threaded_irq(&client->dev, client->irq,
+					NULL, edt_ft5x06_ts_isr, irq_flags,
 					client->name, tsdata);
 	if (error) {
 		dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
-- 
2.6.0.rc0.131.gf624c3d


  parent reply	other threads:[~2015-09-12 17:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-12 17:45 [PATCH 1/6] Input: edt-ft5x06 - switch to newer gpio framework Dmitry Torokhov
2015-09-12 17:45 ` [PATCH 2/6] Input: edt-ft5x06 - drop parsing of irq gpio Dmitry Torokhov
2015-09-12 17:45 ` [PATCH 3/6] Input: edt-ft5x06 - remove support for platform data Dmitry Torokhov
2015-09-12 17:45 ` [PATCH 4/6] Input: edt-ft5x06 - use generic properties API Dmitry Torokhov
2015-09-12 17:45 ` Dmitry Torokhov [this message]
2015-09-12 17:45 ` [PATCH 6/6] ARM: dts: set up trigger type for edt-ft5x06 interrupts Dmitry Torokhov
2015-09-14 21:24   ` Felipe Balbi
2015-09-15 15:40     ` Tony Lindgren
2015-09-23 12:16   ` Shawn Guo
2015-09-21 22:55 ` [PATCH 1/6] Input: edt-ft5x06 - switch to newer gpio framework Dmitry Torokhov
2015-09-22 22:00   ` Franklin S Cooper Jr.

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=3b89cb3ec897a05e8170ea1e736d3e969c1f8419.1442079408.git.dmitry.torokhov@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=LW@KARO-electronics.de \
    --cc=fcooper@ti.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    /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

all inboxes | Powered by JetHome®