aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/i2c-hid/i2c-hid.c
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2016-11-21 15:21:27 +0100
committerJiri Kosina <jkosina@suse.cz>2016-11-28 14:42:53 +0100
commit00f7fea5da4986af93457b625a379d5e3ee51754 (patch)
treec24e7a64e28ed9968eca8cfb0c1b1221a6963533 /drivers/hid/i2c-hid/i2c-hid.c
parentHID: i2c-hid: add a simple quirk to fix device defects (diff)
downloadlinux-dev-00f7fea5da4986af93457b625a379d5e3ee51754.tar.xz
linux-dev-00f7fea5da4986af93457b625a379d5e3ee51754.zip
HID: i2c-hid: force the IRQ level trigger only when not set
Instead of forcing the level trigger of the IRQ, we can count on ACPI or OF to set it up for us. The first release of the HID over I2C specification mentioned that the level trigger needed to be active low. In the latest version of the specification, there is no such explicit mention, so it's better to not assume one. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/i2c-hid/i2c-hid.c')
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index ce518795cb30..8d53efe04dad 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -22,6 +22,7 @@
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/input.h>
+#include <linux/irq.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/pm.h>
@@ -858,13 +859,16 @@ static struct hid_ll_driver i2c_hid_ll_driver = {
static int i2c_hid_init_irq(struct i2c_client *client)
{
struct i2c_hid *ihid = i2c_get_clientdata(client);
+ unsigned long irqflags = 0;
int ret;
dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq);
+ if (!irq_get_trigger_type(client->irq))
+ irqflags = IRQF_TRIGGER_LOW;
+
ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq,
- IRQF_TRIGGER_LOW | IRQF_ONESHOT,
- client->name, ihid);
+ irqflags | IRQF_ONESHOT, client->name, ihid);
if (ret < 0) {
dev_warn(&client->dev,
"Could not register for %s interrupt, irq = %d,"