I2C touchpad does not function after resuming from suspend

I have recently updated to 5.8.15-1 (from unstable), and the I2C touchpad does not function after resuming from suspend. Since the 5.8.15 changelog on LKML contains no relevant changes, I went looking for a cause in the Manjaro Gitlab, and I believe I found it. The 0304-i2c-hid.patch seems to be incorrect: in i2c_hid_resume() it does the opposite of what it should: it modifies IRQs when polling is enabled (it shouldn’t), and it does not manage IRQs when polling is disabled (it should).

The following lines are to blame:

-	enable_irq(client->irq);
+	if (polling_mode != I2C_POLLING_DISABLED)
+		enable_irq(client->irq);

This causes the IRQ not to be enabled if polling is disabled. The comparison should be polling_mode == I2C_POLLING_DISABLED instead of what it is now.


Furthermore, in the

(ihid->irq_wake_enabled && polling_mode != I2C_POLLING_DISABLED)

comparison in i2c_hid_resume(), I am not sure that the && polling_mode != I2C_POLLING_DISABLED part is needed since it makes i2c_hid_suspend() and i2c_hid_resume() “asymmetric” which may cause problems in some configurations.

@nightmare-2021 please take a look at it.

Paging @coiby as well.

1 Like

You must add the following parameter to /etc/default/grub and then update grub with sudo update-grub

GRUB_CMDLINE_LINUX_DEFAULT="i2c-hid.polling_mode=1"

You can find all information about this under the following link:

I’m not sure I understand. I do not want to use polling. Interrupts have worked fine up until now, and I have no reason to switch to polling. If Manjaro kernels want to switch to polling for I2C HID devices, why is it even possible to select non-polling?

Thank you for the link, I’ve explained my concerns on the mailing list as well. However, my point still stands: this patch causes I2C HID devices to stop working after resuming from suspend when using interrupts (essentially for everyone for whom it has worked so far). Please revert this patch or apply the following patch to the patch:

diff --git a/0304-i2c-hid.patch b/0304-i2c-hid.patch
index a07ff65..4e2130c 100644
--- a/0304-i2c-hid.patch
+++ b/0304-i2c-hid.patch
@@ -209,7 +209,7 @@ index dbd04492825d..c7af127959f6 100644
                if (ihid->pdata.post_power_delay_ms)
                        msleep(ihid->pdata.post_power_delay_ms);
 -      } else if (ihid->irq_wake_enabled) {
-+      } else if (ihid->irq_wake_enabled && polling_mode != I2C_POLLING_DISABLED) {
++      } else if (ihid->irq_wake_enabled) {
                wake_status = disable_irq_wake(client->irq);
                if (!wake_status)
                        ihid->irq_wake_enabled = false;
@@ -218,7 +218,7 @@ index dbd04492825d..c7af127959f6 100644
        }
 
 -      enable_irq(client->irq);
-+      if (polling_mode != I2C_POLLING_DISABLED)
++      if (polling_mode == I2C_POLLING_DISABLED)
 +              enable_irq(client->irq);
 
        /* Instead of resetting device, simply powers the device on. This

Thank you pointing out my mistake!

I will investigate this later. Thank you for the reminding!

You are right! This polling mode is supposed to be a fallback solution for the broken touchpads whose root causes are yet to be found&fixed. So polling mode is not enabled by default.

Yeah, my touchpad also stopped working correctly after resuming…
Hope that Legion patch will be corrected soon.

sudo modprobe -r i2c_hid && sudo modprobe i2c_hid should make it work again.

2 Likes

@nightmare-2021 please remove 0304-i2c-hid.patch or apply the patch I sent. The author, @coiby, h{er,im}self acknowledged the problem.

I’ll check it out tonight - I’m on my way and can’t be earlier

The best way to get all the information I need, is to install hw-probe, then start it and send me the link to the test result here.

pamac install hw-probe

sudo hw-probe --all --upload

This is always the best way, so that I can help as soon as possible

I’ll remove the patch for now. We can create a separate kernel to test this, however we should not force it to all users. Breaking the hardware is not good. Also any settings needed to be added to grub config should be optional and generally avoided.

3 Likes

Thanks, I’ve almost decided to go back to annoying practice of compiling kernel(s) and nvidia modules on my machine due to this patch.

Thanks @philm I can confirm that 5.8.15-2 eliminates this problem.

5.9.0-4 adds the bluetooth security fixes and a new patch for the Lenovo touchpad. Please test in unstable if the new patch breaks other touchpads again?

1 Like

Confirmed to work with Kernel 5.9.0-4 but still requires i2c-hid.polling_mode=1 to be added to grub. Wake from sleep works fine.

I rather want to know if a laptop, which is broken now, works with the new patch without adding anything to grub. That a lenovo still might need that polling, can be true.

I’ve just tried 5.8.16 (built from Manjaro’s git files with the updated patch), and on it touchpad is working fine after resuming from suspended state. No extra kernel options in cmdline (no polling mode), no removing and probing for module again.
Will now download 5.9 to check there too but I am quite sure it will be the same.
Thanks for the update @philm @coiby

Thank you for testing the patch!

Guys i am not sure is this the right thread but my Legion 5 is with MSFT0001:00 06CB:7F28 touch pad. After update to linux58-5.8.16-2 the touch pad stopped working again. I reverted to 5.8.12-3 that i have downloaded once @nightmare-2021 pushed it to GitLab and everything is working again. Do I need to enable the polling in GRUB conf to make it work with 5…8.16-2. I found the discussion after I reverted to 5.8.12-3 so I was not able to test it until now.

@yaggul You shouldn’t need to enable polling if it had worked before. Does it not work at all? Anyways, I suggest holding the kernel and related packages back until that patch is sorted out.