-
Notifications
You must be signed in to change notification settings - Fork 58.4k
i2c_hid: ELAN touchpad bugs fix #663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
e3d16ad
d7eb86d
b7a1b00
14a6666
844193c
f7ee5a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ | |
| #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) | ||
| #define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2) | ||
| #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) | ||
| #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are not supposed to touch existing quirks. Just add a new one on top.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, so your quirk becomes:
And this needs to be above: Otherwise the HID_ANY_ID match will match first and the code looking up the quirks will stop there. After fixing this please submit a new version of the patch to the mailinglist. Please Cc:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, I will fix that. |
||
| #define I2C_HID_QUIRK_FORCE_TRIGGER_FALLING BIT(4) | ||
|
|
||
| /* flags */ | ||
| #define I2C_HID_STARTED 0 | ||
|
|
@@ -182,8 +182,8 @@ static const struct i2c_hid_quirks { | |
| I2C_HID_QUIRK_NO_RUNTIME_PM }, | ||
| { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01F0, | ||
| I2C_HID_QUIRK_NO_RUNTIME_PM }, | ||
| { USB_VENDOR_ID_ELAN, HID_ANY_ID, | ||
| I2C_HID_QUIRK_BOGUS_IRQ }, | ||
| { USB_VENDOR_ID_ELAN, I2C_PRODUCT_ID_ELAN_TOUCHPAD, | ||
|
||
| I2C_HID_QUIRK_FORCE_TRIGGER_FALLING }, | ||
| { 0, 0 } | ||
| }; | ||
|
|
||
|
|
@@ -508,12 +508,6 @@ static void i2c_hid_get_input(struct i2c_hid *ihid) | |
| return; | ||
| } | ||
|
|
||
| if (ihid->quirks & I2C_HID_QUIRK_BOGUS_IRQ && ret_size == 0xffff) { | ||
| dev_warn_once(&ihid->client->dev, "%s: IRQ triggered but " | ||
| "there's no data\n", __func__); | ||
| return; | ||
| } | ||
|
|
||
| if ((ret_size > size) || (ret_size < 2)) { | ||
| dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", | ||
| __func__, size, ret_size); | ||
|
|
@@ -854,6 +848,8 @@ static int i2c_hid_init_irq(struct i2c_client *client) | |
|
|
||
| if (!irq_get_trigger_type(client->irq)) | ||
| irqflags = IRQF_TRIGGER_LOW; | ||
| if (ihid->quirks & I2C_HID_QUIRK_FORCE_TRIGGER_FALLING) | ||
| irqflags = IRQF_TRIGGER_FALLING; | ||
|
|
||
| ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, | ||
| irqflags | IRQF_ONESHOT, client->name, ihid); | ||
|
|
@@ -1123,10 +1119,6 @@ static int i2c_hid_probe(struct i2c_client *client, | |
| if (ret < 0) | ||
| goto err_pm; | ||
|
|
||
| ret = i2c_hid_init_irq(client); | ||
| if (ret < 0) | ||
| goto err_pm; | ||
|
|
||
| hid = hid_allocate_device(); | ||
| if (IS_ERR(hid)) { | ||
| ret = PTR_ERR(hid); | ||
|
|
@@ -1149,6 +1141,10 @@ static int i2c_hid_probe(struct i2c_client *client, | |
|
|
||
| ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product); | ||
|
|
||
| ret = i2c_hid_init_irq(client); | ||
| if (ret < 0) | ||
| goto err_pm; | ||
|
|
||
| ret = hid_add_device(hid); | ||
| if (ret) { | ||
| if (ret != -ENODEV) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I'm not sure you need to put this into header file.
And the name should start with
I2C_DEVICE_ID_of course.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For hid devices we have the convention to gather all vendor / product id defines in this single header.
We also have the convention to simply prefix all IDS with USB_DEVICE_ID_ even if it is an i2c device, the only exception to this is when the vendor uses a different VENDOR_ID for usb vs i2c, which they usually do not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I will rename it to USB_DEVICE_ID