Bug 217761 - DELL0A78:00 27C6:0D42 Touchpad (gestures) doesn't work properly after resuming from suspend.
Summary: DELL0A78:00 27C6:0D42 Touchpad (gestures) doesn't work properly after resumin...
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: AMD Linux
: P3 high
Assignee: drivers_input-devices
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-04 09:22 UTC by bishal
Modified: 2024-10-17 16:38 UTC (History)
4 users (show)

See Also:
Kernel Version: 6.5.0-rc4-1-default+, 6.11.0-rc3-150500.55.68-default+
Subsystem:
Regression: No
Bisected commit-id:


Attachments
output of `sudo journalctl --system -b` on the boot producing the error. (259.84 KB, text/plain)
2023-08-04 09:22 UTC, bishal
Details
dmesg output of the same boot (92.93 KB, text/plain)
2023-08-04 09:24 UTC, bishal
Details
log produced by amd_s2idle.py (303.71 KB, text/plain)
2023-08-12 01:00 UTC, bishal
Details
output of `sudo acpidump` (831.67 KB, text/plain)
2023-08-12 04:36 UTC, bishal
Details
log produced by amd_s2idle.py 3 suspend entries. (123.30 KB, text/plain)
2023-08-12 04:44 UTC, bishal
Details
output of `sudo acpidump -b` (78.41 KB, application/zip)
2023-08-12 04:54 UTC, bishal
Details
screenshot containing instruction to wake the system manually. (122.33 KB, image/png)
2023-08-12 15:01 UTC, bishal
Details
content of /sys/kernel/debug/gpio right after boot without any changes. (19.01 KB, text/plain)
2023-08-13 01:08 UTC, bishal
Details
content of /sys/kernel/debug/gpio after suspending without removing i2c_hid_acpi module (19.01 KB, text/plain)
2023-08-13 01:09 UTC, bishal
Details
content of /sys/kernel/debug/gpio after suspending by removing i2c_hid_acpi module right before suspending and adding the module right after resume. (19.01 KB, text/plain)
2023-08-13 01:11 UTC, bishal
Details
possible patch v1 (1.67 KB, patch)
2023-08-13 12:01 UTC, Mario Limonciello (AMD)
Details | Diff
log (kernel built by applying the patch p1) produced by amd_s2idle.py 3 suspend entries (140.26 KB, text/plain)
2023-08-14 12:48 UTC, bishal
Details
Boot producing the touchpad bug even without suspending. (229.59 KB, text/plain)
2023-08-14 13:07 UTC, bishal
Details
the accompaining dmesg. (89.24 KB, text/plain)
2023-08-14 13:09 UTC, bishal
Details

Description bishal 2023-08-04 09:22:17 UTC
Created attachment 304774 [details]
output of `sudo journalctl --system -b` on the boot producing the error.

Description:
------------
The touchpad doesn't function normally after resuming from suspend. Touch works most of the time so does the hardware click buttons. The things which don't work are touchpad multitouch gestures (2 fingers and 3 fingers) and cursor movement is also somewhat laggy.

Workaround:
-----------
removing the module i2c_hid_acpi just before suspend and adding it after resume seems to solve the problem. 

Script: (output of `cat /usr/lib/systemd/system-sleep/make-touchpad-work.sleep`)
-----------------------------------------------------------------------------

#!/bin/sh

case $1/$2 in
  pre/*)
    echo "Going to $2..."
    # Place your pre suspend commands here, or `exit 0` if no pre suspend action required
    echo "Removing i2c_hid_acpi module before suspend."
    modprobe -r i2c_hid_acpi
    ;;
  post/*)
    echo "Waking up from $2..."
    # Place your post suspend (resume) commands here, or `exit 0` if no post suspend action required
    sleep 2
    echo "Adding i2c_hid_acpi module after suspend (before resuming)."
    modprobe i2c_hid_acpi
    ;;
esac
-----------------------------------------------------------------------------

When was it discovered?
-------------------------
I had prior hardware issues with the touchpad so I didn't notice 
it for a very long time, each time such an issue appeared I thought it was a hardware issue. But the issue is still there even after fixing the hardware (loose ribbon cable). Before the hardware issue, there was an issue with resuming from suspend on my laptop (because of laptop begin particularly new AMD variant). So, if I remember correctly, the touchpad worked fine for particular duration between suspend issue being fixed and hardware issue appearing. 

GNU/Linux version:
------------------
Linux localhost.localdomain 6.5.0-rc4-1-default+ 
#1 SMP PREEMPT_DYNAMIC Thu Aug 3 20:15:04 +0545 2023 x86_64 x86_64 x86_64 GNU/Linux

Touchpad information:
------------------------
PS/2 00.0: 10500 PS/2 Mouse
  [Created at input.249]
  Unique ID: AH6Q.rKa1+aijZtE
  Hardware Class: mouse
  Model: "DELL0A78:00 27C6:0D42 Touchpad"
  Vendor: 0x27c6 
  Device: 0x0d42 "DELL0A78:00 27C6:0D42 Touchpad"
  Compatible to: int 0x0210 0x0001
  Device File: /dev/input/mice (/dev/input/mouse2)
  Device Files: /dev/input/mice, /dev/input/mouse2, /dev/input/event3, /dev/input/by-path/platform-AMDI0010:03-event-mouse, /dev/input/by-path/platform-AMDI0010:03-mouse
  Device Number: char 13:63 (char 13:34)
  Driver Info #0:
    Buttons: 1
    Wheels: 0
    XFree86 Protocol: explorerps/2
    GPM Protocol: exps2
  Config Status: cfg=no, avail=yes, need=no, active=unknown


Prior to testing on mainline kernel, it was tested on opensuse tumbleweed and reported here: https://bugzilla.suse.com/show_bug.cgi?id=1212779
Comment 1 bishal 2023-08-04 09:24:58 UTC
Created attachment 304775 [details]
dmesg output of the same boot
Comment 2 Bagas Sanjaya 2023-08-04 13:44:46 UTC
Please note that you won't get much traction here when you choose ``Kernel`` component, because there is *literally* no kernel development mailing lists on
Cc: list. I have forwarded this bug to linux-input list [1].

[1]: https://lore.kernel.org/linux-input/9a9f9bfe-d532-5814-e3cd-b53bfc4f7480@gmail.com/
Comment 3 Mario Limonciello (AMD) 2023-08-11 21:41:56 UTC
Can you please run this script to capture some extra debugging data?

https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py
Comment 4 bishal 2023-08-12 01:00:58 UTC
Created attachment 304823 [details]
log produced by amd_s2idle.py
Comment 6 Mario Limonciello (AMD) 2023-08-12 04:14:06 UTC
> 2023-08-12 06:36:02,334 DEBUG:        2023-08-12T06:35:15,957011+05:45
> amd_pmc AMDI0005:00: Last suspend didn't reach deepest state


So your system flat out didn't suspend properly on the second attempt it looks like to me.  Did the trackpad work after the first suspend?  Or it didn't work after either?  Or is the problem really just the multi-touch gestures fail?

Can I please see an acpidump for your system as well?  There's some things I would like to better understand about your log.
Comment 7 bishal 2023-08-12 04:36:22 UTC
Created attachment 304826 [details]
output of `sudo acpidump`

Request if required in other formats.
Comment 8 bishal 2023-08-12 04:37:52 UTC
(In reply to Mario Limonciello (AMD) from comment #6)
> > 2023-08-12 06:36:02,334 DEBUG:        2023-08-12T06:35:15,957011+05:45
> > amd_pmc AMDI0005:00: Last suspend didn't reach deepest state
> 
> 
> So your system flat out didn't suspend properly on the second attempt it
> looks like to me.  Did the trackpad work after the first suspend?  Or it
> didn't work after either?  Or is the problem really just the multi-touch
> gestures fail?

I don't know if I requested multiple suspends, let me try with multiple suspends and a higher gap to test the touchpad in between the suspends.
Comment 9 bishal 2023-08-12 04:44:11 UTC
Created attachment 304827 [details]
log produced by amd_s2idle.py 3 suspend entries.

Touchpad multitouch didn't work in between the suspends.

Clarification:
-------------

Touchpad always works but the multitouch gestures are broken. Also the touchpad movement is a bit sluggish and doesn't work properly from time to time (even simple movements).
Comment 10 bishal 2023-08-12 04:54:12 UTC
Created attachment 304828 [details]
output of `sudo acpidump -b`
Comment 11 Mario Limonciello (AMD) 2023-08-12 13:14:13 UTC
Thanks for sharing the logs and report.  My observations:
- It appears your system doesn't have any notifications to the EC at suspend entry, which is unusual.
- Your touchpad is on GPIO 9 and was the reason that the system woke up from suspend each time.  Is that your doing?  If not, then I would suspect the polarity or edge/level is programmed wrong by your BIOS ACPI tables.

                    GpioInt (Level, ActiveLow, ExclusiveAndWake, PullNone, 0x0000,
                        "\\_SB.GPIO", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0009
                        }

Is this a regression?  If so; do you know when it worked last?
Comment 12 bishal 2023-08-12 14:50:42 UTC
> It appears your system doesn't have any notifications to the EC at suspend
> entry, which is unusual.
I don't have enough knowledge to understand this.


> Your touchpad is on GPIO 9 and was the reason that the system woke up from
> suspend each time.  Is that your doing?  If not, then I would suspect the
> polarity or edge/level is programmed wrong by your BIOS ACPI tables.

The system failed to wakeup automatically and this was suggested:

WARNING:	Timer based wakeup doesn't work properly for your ASIC/firmware, please manually wake the system

so, I manually woke the system using touchpad, and there wasn't a warning saying the system woke up prematurely. ( I've had those in different runs. )
Comment 13 bishal 2023-08-12 15:01:57 UTC
Created attachment 304837 [details]
screenshot containing instruction to wake the system manually.
Comment 14 Mario Limonciello (AMD) 2023-08-12 18:43:06 UTC
> so, I manually woke the system using touchpad, and there wasn't a warning
> saying the system woke up prematurely. ( I've had those in different runs. )

OK thanks.  If you've woken it up manually by the touchpad, that explains the logs.

One more thought.  Can you please capture /sys/kernel/debug/gpio in these specific circumstances to compare:

1) Right at bootup
2) After suspending without removing i2c-hid (when you have your problem)
3) After suspending with removing i2c-hid and putting it back (when you don't have your problem)
Comment 15 bishal 2023-08-13 01:08:22 UTC
Created attachment 304842 [details]
content of  /sys/kernel/debug/gpio right after boot without any changes.
Comment 16 bishal 2023-08-13 01:09:25 UTC
Created attachment 304843 [details]
content of  /sys/kernel/debug/gpio after suspending without removing i2c_hid_acpi module
Comment 17 bishal 2023-08-13 01:11:04 UTC
Created attachment 304844 [details]
content of  /sys/kernel/debug/gpio after suspending by removing i2c_hid_acpi module right before suspending and adding the module right after resume.
Comment 18 Mario Limonciello (AMD) 2023-08-13 03:40:58 UTC
OK, I don't see anything different with the GPIO controller programming.

As a different workaround; what happens if you unload/reload after suspend?  Does that also help?  If so, perhaps this touchpad needs a reset for some reason.
Comment 19 bishal 2023-08-13 03:50:07 UTC
(In reply to Mario Limonciello (AMD) from comment #18)

> As a different workaround; what happens if you unload/reload after suspend? 
> Does that also help?  

If I am correct you meant this:

- Remove the script to unload i2c_hid_acpi before resume and load after resume.
- Suspend the laptop
- Check for touchpad issue (issue still present)
- unload i2c_hid_acpi using modprobe -r i2c_hid_acpi
- load i2c_hid_acpi using modprobe i2c_hid_acpi (fixes the issue)

This fixes the issue.

>If so, perhaps this touchpad needs a reset for some reason.

Hardware itself needs resetting ? How would I do that? 
Or, the drivers?
Comment 20 Mario Limonciello (AMD) 2023-08-13 12:01:11 UTC
Created attachment 304845 [details]
possible patch v1

Have a try with this patch.
Comment 21 Takashi Iwai 2023-08-13 13:26:36 UTC
IIRC, I provided already a similar patch before this report opened, but the result at that time was negative.  In anyway, I'll rebuild the kernel again with the patch again.

The test kernel is being built in OBS home:tiwai;bsc1212779-3 repo now.
The package will appear later at
  http://download.opensuse.org/repositories/home:/tiwai:/bsc1212779-3/standard/
Please give it a try later.
Comment 22 bishal 2023-08-14 12:47:13 UTC
(In reply to Mario Limonciello (AMD) from comment #20)
> Created attachment 304845 [details]
> possible patch v1
> 
> Have a try with this patch.

Same problem even with this patch.
Comment 23 bishal 2023-08-14 12:48:29 UTC
Created attachment 304848 [details]
log (kernel built by applying the patch p1) produced by amd_s2idle.py 3 suspend entries
Comment 24 Mario Limonciello (AMD) 2023-08-14 12:52:31 UTC
I'm out of ideas on this one then; maybe some input maintainers might have more idea what's actually going on that rmmod/modprobe after suspend helps this problem.
Comment 25 bishal 2023-08-14 13:07:32 UTC
Created attachment 304849 [details]
Boot producing the touchpad bug even without suspending.

Some reboots produce the touchpad bug right from the bootup (without suspending). The attached log is of one such boot.
Comment 26 bishal 2023-08-14 13:09:05 UTC
Created attachment 304850 [details]
the accompaining dmesg.

dmesg of boot producing the touchpad bug from the start.
Comment 27 Mario Limonciello (AMD) 2024-10-17 15:44:44 UTC
I just looked and saw there is a BIOS update for your system.  I think it's worth trying this to see if it helps your issue.

https://www.dell.com/support/home/en-us/drivers/driversdetails?driverid=w2wwc&oscode=wt64a&productcode=inspiron-15-5515-laptop
Comment 28 bishal 2024-10-17 16:38:36 UTC
I tried the newer BIOS version, but the issue remains. 

Tested on 6.12.0-rc3-150500.55.68-default+

The output of `dmidecode -t bios -q` after the bios update:
BIOS Information
	Vendor: Dell Inc.
	Version: 1.23.1
	Release Date: 05/13/2024
	Address: 0xE0000
	Runtime Size: 128 kB
	ROM Size: 8 MB
	Characteristics:
		PCI is supported
		PNP is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		Boot from CD is supported
		Selectable boot is supported
		EDD is supported
		Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)
		Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
		5.25"/360 kB floppy services are supported (int 13h)
		5.25"/1.2 MB floppy services are supported (int 13h)
		3.5"/720 kB floppy services are supported (int 13h)
		3.5"/2.88 MB floppy services are supported (int 13h)
		8042 keyboard services are supported (int 9h)
		CGA/mono video services are supported (int 10h)
		ACPI is supported
		USB legacy is supported
		Smart battery is supported
		BIOS boot specification is supported
		Function key-initiated network boot is supported
		Targeted content distribution is supported
		UEFI is supported
	BIOS Revision: 5.3

BIOS Language Information
	Language Description Format: Long
	Installable Languages: 4
		en|US|iso8859-1
		fr|FR|iso8859-1
		ja|JP|unicode
		zh|TW|unicode
	Currently Installed Language: en|US|iso8859-1

Note You need to log in before you can comment on or make changes to this bug.