Skip to content
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

i2c_hid: ELAN touchpad bugs fix #663

Closed
wants to merge 6 commits into from
Closed

i2c_hid: ELAN touchpad bugs fix #663

wants to merge 6 commits into from

Conversation

dalechyn
Copy link

While using ELAN touchpad's, there are messages flooding in journalctl and dmesg with incomplete report:
[ 581.465203] i2c_hid i2c-ELAN1200:00: i2c_hid_get_input: incomplete report (16/65535)

Also there were the next bugs:

  • If you touch touchpad with 5 fingers, the driver dies immediately.
  • When you scroll anything, and release one finger, driver thought you are still scrolling

Recently, I spoke to ELANTECH and they send me a patch suggested by Intel to fix this issue. It was a simple hack, so me and guys from redhat forum created this patch.

It is fixed by adding additional quirk to trigger IRQF_TRIGGER_FALLING flag.

An explanation about why i2c_hid_init_irq section was moved under the i2c_hid_lookup_quirk, answered by Hans de Goede [email protected]:

i2c_hid_init_irq now checks for a quirk, so we must setup the quirks before we init the irq, and we cannot setup the quirk earlier, so we must init the irq later.

So this commit revert's this commit, as no message flood can be seen by now, and fixes touchpad problems.

Signed-off-by: Vladislav Dalechyn [email protected]

@KernelPRBot
Copy link

Hi @vladik2738!

Thanks for your contribution to the Linux kernel!

Linux kernel development happens on mailing lists, rather than on GitHub - this GitHub repository is a read-only mirror that isn't used for accepting contributions. So that your change can become part of Linux, please email it to us as a patch.

Sending patches isn't quite as simple as sending a pull request, but fortunately it is a well documented process.

Here's what to do:

  • Format your contribution according to kernel requirements
  • Decide who to send your contribution to
  • Set up your system to send your contribution as an email
  • Send your contribution and wait for feedback

How do I format my contribution?

The Linux kernel community is notoriously picky about how contributions are formatted and sent. Fortunately, they have documented their expectations.

Firstly, all contributions need to be formatted as patches. A patch is a plain text document showing the change you want to make to the code, and documenting why it is a good idea.

You can create patches with git format-patch.

Secondly, patches need 'commit messages', which is the human-friendly documentation explaining what the change is and why it's necessary.

Thirdly, changes have some technical requirements. There is a Linux kernel coding style, and there are licensing requirements you need to comply with.

Both of these are documented in the Submitting Patches documentation that is part of the kernel.

Note that you will almost certainly have to modify your existing git commits to satisfy these requirements. Don't worry: there are many guides on the internet for doing this.

Who do I send my contribution to?

The Linux kernel is composed of a number of subsystems. These subsystems are maintained by different people, and have different mailing lists where they discuss proposed changes.

If you don't already know what subsystem your change belongs to, the get_maintainer.pl script in the kernel source can help you.

get_maintainer.pl will take the patch or patches you created in the previous step, and tell you who is responsible for them, and what mailing lists are used. You can also take a look at the MAINTAINERS file by hand.

Make sure that your list of recipients includes a mailing list. If you can't find a more specific mailing list, then LKML - the Linux Kernel Mailing List - is the place to send your patches.

It's not usually necessary to subscribe to the mailing list before you send the patches, but if you're interested in kernel development, subscribing to a subsystem mailing list is a good idea. (At this point, you probably don't need to subscribe to LKML - it is a very high traffic list with about a thousand messages per day, which is often not useful for beginners.)

How do I send my contribution?

Use git send-email, which will ensure that your patches are formatted in the standard manner. In order to use git send-email, you'll need to configure git to use your SMTP email server.

For more information about using git send-email, look at the Git documentation or type git help send-email. There are a number of useful guides and tutorials about git send-email that can be found on the internet.

How do I get help if I'm stuck?

Firstly, don't get discouraged! There are an enormous number of resources on the internet, and many kernel developers who would like to see you succeed.

Many issues - especially about how to use certain tools - can be resolved by using your favourite internet search engine.

If you can't find an answer, there are a few places you can turn:

If you get really, really stuck, you could try the owners of this bot, @daxtens and @ajdlinux. Please be aware that we do have full-time jobs, so we are almost certainly the slowest way to get answers!

I sent my patch - now what?

You wait.

You can check that your email has been received by checking the mailing list archives for the mailing list you sent your patch to. Messages may not be received instantly, so be patient. Kernel developers are generally very busy people, so it may take a few weeks before your patch is looked at.

Then, you keep waiting. Three things may happen:

  • You might get a response to your email. Often these will be comments, which may require you to make changes to your patch, or explain why your way is the best way. You should respond to these comments, and you may need to submit another revision of your patch to address the issues raised.
  • Your patch might be merged into the subsystem tree. Code that becomes part of Linux isn't merged into the main repository straight away - it first goes into the subsystem tree, which is managed by the subsystem maintainer. It is then batched up with a number of other changes sent to Linus for inclusion. (This process is described in some detail in the kernel development process guide).
  • Your patch might be ignored completely. This happens sometimes - don't take it personally. Here's what to do:
    • Wait a bit more - patches often take several weeks to get a response; more if they were sent at a busy time.
    • Kernel developers often silently ignore patches that break the rules. Check for obvious violations of the Submitting Patches guidelines, the style guidelines, and any other documentation you can find about your subsystem. Check that you're sending your patch to the right place.
    • Try again later. When you resend it, don't add angry commentary, as that will get your patch ignored. It might also get you silently blacklisted.

Further information

Happy hacking!

This message was posted by a bot - if you have any questions or suggestions, please talk to my owners, @ajdlinux and @daxtens, or raise an issue at https://github.com/ajdlinux/KernelPRBot.

@dalechyn dalechyn changed the title ELAN touchpad i2c_hid bugs fix i2c_hid: ELAN touchpad bugs fix Mar 19, 2019
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so your quirk becomes:

#define I2C_HID_QUIRK_FORCE_TRIGGER_FALLING BIT(5)
and then put your device specific quirk before the match using ANY_ID so that it will be checked first, you device specific quirk should look something like this:

{ USB_VENDOR_ID_ELAN, I2C_PRODUCT_ID_ELAN_TOUCHPAD,
  I2C_HID_QUIRK_BOGUS_IRQ | I2C_HID_QUIRK_FORCE_TRIGGER_FALLING },

And this needs to be above:

	{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
		 I2C_HID_QUIRK_BOGUS_IRQ },

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:
Hans de Goede [email protected] when submitting a new version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I will fix that.

@@ -385,6 +385,8 @@
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001

#define I2C_PRODUCT_ID_ELAN_TOUCHPAD 0x303e
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Author

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.

Then I will rename it to USB_DEVICE_ID

@@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should use I2C_VENDOR_ID_ELAN, but since there is an example of USB_VENDOR_ID_ELAN in use, it's okay for now.

@@ -385,7 +385,7 @@
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001

#define I2C_PRODUCT_ID_ELAN_TOUCHPAD 0x303e
#define USB_DEVICE_ID_ELAN_TOUCHPAD 0x303e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to put this line below the "#define USB_VENDOR_ID_ELAN" line (and then sorted by product-id, so below the USB_DEVICE_ID_HP_X2_10_COVER define).

{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
I2C_HID_QUIRK_BOGUS_IRQ },
{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHPAD,
I2C_HID_QUIRK_BOGUS_IRQ | I2C_HID_QUIRK_FORCE_TRIGGER_FALLING },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I tried to explain before, the { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHPAD, ...} quirk MUST be above the { USB_VENDOR_ID_ELAN, HID_ANY_ID, ...} quirk. The quirks are checked one by one until one matches.

Except that I'm wrong and i2c_hid_lookup_quirk keeps going after a match, so the most specific quirk must be at the bottom.

Never mind this is correct, lets discuss this further on the mailinglist.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right because i2c_hid_lookup_quirk looks from the top.

@jwrdegoede
Copy link
Contributor

As the automated PR response tried to explain, github is not the way to submit kernel patches upstream.

When you are ready, please squash all your commits together and send the patch as an email to the relevant people and mailinglists, using "git send-email" to send it.

Copy link
Contributor

@andy-shev andy-shev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to send this thru mailing list. Here is not a place to get your stuff merged.
Here is a document describes process of submitting patches to the Linux kernel.
https://elixir.bootlin.com/linux/latest/source/Documentation/process/submitting-patches.rst

@dalechyn
Copy link
Author

You need to send this thru mailing list. Here is not a place to get your stuff merged.
Here is a document describes process of submitting patches to the Linux kernel.
https://elixir.bootlin.com/linux/latest/source/Documentation/process/submitting-patches.rst

I am already sending patches through mailing list, I just commit and push all changes in my linux repository, that's why commit's keep popping up.

@danindiana
Copy link

Hi Gang, mouse pad still not working on Lenovo laptop V330-14ARR.

sudo dmidecode |grep Version
Version: 3ECN36WW(V3.03)
Version: Lenovo V330-14ARR
Version: SDK0J40697 WIN
Version: Lenovo V330-14ARR
Version: AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx

Currently running:
Linux 4.19.15-041915-generic #201901130432 SMP Sun Jan 13 09:34:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

dmesg | grep -i elan
[ 2.155219] i2c_hid i2c-ELAN0616:00: i2c-ELAN0616:00 supply vdd not found, using dummy regulator
[ 2.155236] i2c_hid i2c-ELAN0616:00: Linked as a consumer to regulator.0
[ 2.155238] i2c_hid i2c-ELAN0616:00: i2c-ELAN0616:00 supply vddl not found, using dummy regulator

Any help would be appreciated. I've seen forum reports that a kernel update would fix problem but this seems to be a tough nut to crack for this machine. Mousepad confirmed to work fine in windows but who wants to run windows if they don't have to?

@dalechyn dalechyn marked this pull request as draft January 25, 2023 14:35
@dalechyn dalechyn closed this Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants