Bug 217234

Summary: Touchpad disabled after wakeup from sleep on Lenovo Yoga 7i 15ITL5
Product: Drivers Reporter: arsgeiger
Component: Input DevicesAssignee: drivers_input-devices
Status: RESOLVED CODE_FIX    
Severity: normal CC: jwrdegoede, regressions
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 6.1.x-6.2.7 Subsystem:
Regression: No Bisected commit-id:
Attachments: libinput events on linux6.0
libinput events on linux6.2
linux6.0 dmesg output
linux6.2 dmesg output
platform/x86: ideapad-laptop: Stop sending KEY_TOUCHPAD_TOGGLE

Description arsgeiger 2023-03-22 23:52:35 UTC
Created attachment 304002 [details]
libinput events on linux6.0

After booting linux6.1 and later upon closing the lid and opening it again, the touchpad is no longer usable. After powering off and booting linux6.0 again (no other changes), the touchpad does continue to work after closing the lid and opening it again.

When the touchpad gets disabled on linux6.1, after logging in to gnome, I can re-enable it from the settings. Using `libinput debug-events --verbose` Here is a comparison of the output on linux6.0:

>    2: event10 - lid: suspending touchpad
> -event1   SWITCH_TOGGLE           +0.000s     switch lid state 1
>    3: event10 - lid: resume touchpad
> -event6   KEYBOARD_KEY            +2.164s     KEY_F22 (192) pressed
>  event6   KEYBOARD_KEY            +2.164s     KEY_F22 (192) released
>  event6   KEYBOARD_KEY            +2.627s     KEY_F22 (192) pressed
>  event6   KEYBOARD_KEY            +2.627s     KEY_F22 (192) released
> -event1   SWITCH_TOGGLE           +2.168s     switch lid state 0

And linux 6.1+:

>   2: event10 - lid: suspending touchpad
> -event1   SWITCH_TOGGLE           +0.000s     switch lid state 1
>    3: event10 - lid: resume touchpad
> -event6   KEYBOARD_KEY            +2.000s     KEY_TOUCHPAD_TOGGLE (530)
> pressed
>  event6   KEYBOARD_KEY            +2.000s     KEY_TOUCHPAD_TOGGLE (530)
>  released
> -event1   SWITCH_TOGGLE           +2.000s     switch lid state 0
Comment 1 arsgeiger 2023-03-22 23:54:12 UTC
Created attachment 304003 [details]
libinput events on linux6.2
Comment 2 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-03-23 07:41:21 UTC
Could you please attach dmesg output from a working and a broken kernel?
Comment 3 arsgeiger 2023-03-23 09:36:21 UTC
Created attachment 304007 [details]
linux6.0 dmesg output
Comment 4 arsgeiger 2023-03-23 09:37:34 UTC
Created attachment 304008 [details]
linux6.2 dmesg output
Comment 5 arsgeiger 2023-03-30 11:50:11 UTC
Alright, I found the offending commit (which does not exist in linux6.0 but was backported to linux6.1):
https://gitlab.com/linux-kernel/stable/-/commit/5829f8a897e4f030cd2d32a930eea8954ab5dcd3

Building linux6.2 with this commit reverted does workaround the issue for me.
Comment 6 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-03-30 13:31:29 UTC
I pointed the developer of that commit to this ticket:
https://lore.kernel.org/regressions/7fe4e169-1cf9-2a26-0567-021172dadd3c@leemhuis.info/T/#u
Comment 7 Hans de Goede 2023-03-30 19:52:14 UTC
arsgeiger, thank you for reporting this and for figuring out which commit broke things.

Thorsten, thank you for bringing this to my attention.

I have written a patch which should fix this and also submitted this for review:
https://lore.kernel.org/platform-driver-x86/20230330194644.64628-1-hdegoede@redhat.com/T/#u

I'll also attach it here.

arsgeiger, can you build a 6.2 kernel with this patch instead of the revert and then check that this indeed fixes things please?

Once I have confirmation that this fixes things then I'll include it in my next fixes pull-req to Linus and then it should get backported to the stable kernel series in about a week after Linus has merged it.
Comment 8 Hans de Goede 2023-03-30 19:54:37 UTC
Created attachment 304059 [details]
platform/x86: ideapad-laptop: Stop sending KEY_TOUCHPAD_TOGGLE
Comment 9 arsgeiger 2023-03-31 04:30:21 UTC
Thanks Hans, I applied your patch and built the kernel, and the touchpad sleep issue does seem to be resolved.
Comment 10 Hans de Goede 2023-03-31 19:08:03 UTC
(In reply to arsgeiger from comment #9)
> Thanks Hans, I applied your patch and built the kernel, and the touchpad
> sleep issue does seem to be resolved.

Thanks for testing. I have merged the patch into:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes

and send a pull-req to Linux to get this merged into the next 6.3-rc# release coming Sunday. From there it should get backported to the stable kernel series in about a week.