Bug 207759

Summary: Elan Touchscreen not working on Lenovo IdeaPad 5 15
Product: Drivers Reporter: dl3it (dl3it)
Component: Input DevicesAssignee: drivers_input-devices
Status: RESOLVED CODE_FIX    
Severity: normal CC: benjamin.tissoires, bezirg, brady.110, brunolucas, cliffburton11, dirkneukirchen, gabrielschmehle, glogow, guiman2006, imz, jesuismartinjeremy, jwrdegoede, lovesh.bond, lukasbecker2, lyntier, niklagaming
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.6.13 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg / kernel log
Xorg.0.log
[PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
output of sudo apcidump -o acpidump.lenovo-Ideapad-5-15ARE05
[PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices

Description dl3it 2020-05-16 16:51:08 UTC
The Elantech Touchscreen is not working in Lenovo Ideapad 5 15.

[    0.550596] elants_i2c i2c-ELAN0001:00: i2c-ELAN0001:00 supply vcc33 not found, using dummy regulator
[    0.551836] elants_i2c i2c-ELAN0001:00: i2c-ELAN0001:00 supply vccio not found, using dummy regulator
[    0.560932] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121
[    0.562427] elants_i2c i2c-ELAN0001:00: software reset failed: -121
[    0.595925] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121
[    0.597974] elants_i2c i2c-ELAN0001:00: software reset failed: -121
[    0.621893] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121
[    0.622504] elants_i2c i2c-ELAN0001:00: software reset failed: -121
[    0.632650] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (4d 61 69 6e): -121
[    0.634256] elants_i2c i2c-ELAN0001:00: boot failed: -121
[    0.699212] elants_i2c i2c-ELAN0001:00: invalid 'hello' packet: 00 00 ff ff
[    1.630506] elants_i2c i2c-ELAN0001:00: Failed to read fw id: -121
[    1.645508] elants_i2c i2c-ELAN0001:00: unknown packet 00 00 ff ff

When booting a test Windows10 (sorry..), it works; so a HW fault can be excluded.
When using it, it produces errors:

[  933.159820] elants_i2c i2c-ELAN0001:00: unknown packet 0e 00 04 03
[  933.167034] elants_i2c i2c-ELAN0001:00: unknown packet 0e 00 04 03
[  933.172617] elants_i2c i2c-ELAN0001:00: unknown packet 0e 00 04 13
[  933.180073] elants_i2c i2c-ELAN0001:00: unknown packet 0e 00 04 03
[  933.185652] elants_i2c i2c-ELAN0001:00: unknown packet 0e 00 04 13
[  933.192860] elants_i2c i2c-ELAN0001:00: unknown packet 0e 00 04 03
[  933.198440] elants_i2c i2c-ELAN0001:00: unknown packet 0e 00 04 13

and so on...

Same beheaviour for kernel 5.4.xx and 5.6.xx
Comment 1 dirkneukirchen 2020-06-02 06:23:43 UTC
2 users of Manjaro reported the same errors on their Lenovo Ideapad 5 

manjaro forum report: https://forum.manjaro.org/t/elan-touchpad-not-working/143624

Also strange that its using elants_i2c instead of elan_i2c (or generic ones)
but seems similar to https://bugzilla.kernel.org/show_bug.cgi?id=203467 

Maybe its hardware design issue ?

I have no idea why "i8042.dumbkbd=1" would help - are these touchpad / elan "touchscreens" connected to I2C and PS2 and SMBus ?
Comment 2 dl3it 2020-06-02 08:04:33 UTC
I fixed it temporarily by changing elants_i2c from "built in" to "module". It works flawlessly now.
I would not expect a hardware issue. It looks more like the module beeing started too early. The whole I2C is dead, when running elants_i2c as a module.
Comment 3 dirkneukirchen 2020-06-02 10:49:56 UTC
So effectively you blacklist the module because 
"The whole I2C is dead, when running elants_i2c as a module."

reads for me like elants_i2c no longer manages the touchpad.

What driver or connection is that input using now? / What dmesg looks when it finds the touchpad ?
Comment 4 dl3it 2020-06-02 11:21:33 UTC
Created attachment 289469 [details]
dmesg / kernel log
Comment 5 dl3it 2020-06-02 11:23:38 UTC
I fetched a kernel from kernel.org (5.6.14 and 5.7.0-rc7). 

make menuconfig

Device Drivers -> Input device support -> Touchscreens -> Elan eKTH I2C touchscreen  -->> set to m

rebuild kernel and install...

The driver is no longer loaded as built in, but as a module. This leads to a delay of ca. 3-4s. Somehow this seems to help.

The Touchpad/screen is connected via i2c1.

dl3it@IdeaPad:~$ dmesg | grep ELAN
[    1.583560] i2c_hid i2c-ELAN0001:00: supply vdd not found, using dummy regulator
[    1.583575] i2c_hid i2c-ELAN0001:00: supply vddl not found, using dummy regulator
[    1.646025] input: ELAN0001:00 04F3:3140 Mouse as /devices/platform/AMDI0010:01/i2c-1/i2c-ELAN0001:00/0018:04F3:3140.0001/input/input5
[    1.646257] input: ELAN0001:00 04F3:3140 Touchpad as /devices/platform/AMDI0010:01/i2c-1/i2c-ELAN0001:00/0018:04F3:3140.0001/input/input6
[    1.646347] hid-generic 0018:04F3:3140.0001: input,hidraw0: I2C HID v1.00 Mouse [ELAN0001:00 04F3:3140] on i2c-ELAN0001:00
[    4.456207] input: ELAN0001:00 04F3:3140 Mouse as /devices/platform/AMDI0010:01/i2c-1/i2c-ELAN0001:00/0018:04F3:3140.0001/input/input8
[    4.456459] input: ELAN0001:00 04F3:3140 Touchpad as /devices/platform/AMDI0010:01/i2c-1/i2c-ELAN0001:00/0018:04F3:3140.0001/input/input9
[    4.456574] hid-multitouch 0018:04F3:3140.0001: input,hidraw0: I2C HID v1.00 Mouse [ELAN0001:00 04F3:3140] on i2c-ELAN0001:00



dl3it@IdeaPad:~$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ ELAN0001:00 04F3:3140 Mouse             	id=11	[slave  pointer  (2)]
⎜   ↳ ELAN0001:00 04F3:3140 Touchpad          	id=12	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C         	id=9	[slave  keyboard (3)]
    ↳ Ideapad extra buttons                   	id=10	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=13	[slave  keyboard (3)]

libinput:

Device:           ELAN0001:00 04F3:3140 Mouse
Kernel:           /dev/input/event5
Group:            8
Seat:             seat0, default
Capabilities:     pointer
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   *button
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a

Device:           ELAN0001:00 04F3:3140 Touchpad
Kernel:           /dev/input/event6
Group:            8
Seat:             seat0, default
Size:             100x66mm
Capabilities:     pointer gesture
Tap-to-click:     disabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *two-finger edge
Click methods:    *button-areas clickfinger
Disable-w-typing: enabled
Accel profiles:   none
Rotation:         n/a


I'll add a dmesg and Xorg log...
Comment 6 dl3it 2020-06-02 11:24:58 UTC
Created attachment 289471 [details]
Xorg.0.log
Comment 7 dirkneukirchen 2020-06-02 13:27:44 UTC
In your working log the Touchpad is now using
 i2c_hid instead of elants_i2c

So compiling a new kernel only changed hardware probing order

a simple blacklisting of elants_i2c 

works according to a user on computerbase.de forum that experienced the same issue on his Ideapad 5
Comment 8 dirkneukirchen 2020-06-02 13:28:06 UTC
thank you for proving logs to help pinpoint the issue
Comment 9 dl3it 2020-06-02 14:10:05 UTC
Could you provide some more details on the blacklisting please ? I tried this first, but it didn't work. That's why I recompiled the kernel.
Btw, the elants_i2c module is still loaded automatically...
Comment 10 Nikla 2020-06-02 14:16:38 UTC
I blacklisted the elants_i2c modul with 

echo "blacklist elants_i2c" | sudo tee /etc/modprobe.d/unneeded-modules.conf

This solved the problem for me.
Comment 11 dl3it 2020-06-02 15:46:08 UTC
blacklisting does not work for me with ubuntu kernel and fix built in elants_i2c. I switched back to "my" kernel...
Comment 12 BL 2020-06-05 09:35:26 UTC
I have a new laptop, Lenovo IdeaPad 5 with AMD Ryzen and I have the same problem. I've installed Ubuntu 20.04, with the 5.4 kernel or even the latest 5.7 kernel the trackpad does not work.
I've tried to the solution to blacklist the elants_i2c module, but it did not work for me.
Comment 13 BL 2020-06-05 19:32:08 UTC
Just tried to build kernel 5.7, as per comment #5, and it works also for me.
Comment 14 Jan-Marek Glogowski 2020-06-06 16:26:12 UTC
Thanks for all the info. I saw these error messages and assumed some larger problem. And didn't register the messages were created by the touchpad actually, since this is the touchscreen driver.

And since I managed to brick my HW, I had other things to do (https://forums.lenovo.com/t5/Lenovo-IdeaPad-1xx-3xx-5xx-7xx-Edge-LaVie-Z-Flex-Notebooks/Unbricking-Ideapad-5-15ARE05/m-p/5019541), so I could just test this now.

Instead of a kernel rebuild, you can simply unbind the device for the built-in module. Just add some startup script doing:

modprobe i2c_hid
echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind

Now I'm wondering, what people with a notebook with an Elan touchscreen would do...

The elants_i2c wrongly claims the device. Either a driver bug or a wrong ACPI DSTD, which in the end the elants_i2c must work around :-(

And I already had decompiled the ACPI DSTD to have a look...
Comment 15 dl3it 2020-06-06 17:03:03 UTC
cool... Works great :-))

Thanks for this...
Comment 16 Jan-Marek Glogowski 2020-06-07 21:07:06 UTC
Just an addition: I added this to my /etc/rc.local, but it doesn't work more times then it does.

Currently I'm using this little script, which did work the last few boots:

echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
sleep 1.5
echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind

Anything less then 1.5s didn't work most times. And I'm on Ubuntu 20.04 / kernel 5.4 FWIW. Also tested the 5.6 and 5.7 Ubuntu mainline builds, which had the same problem.
Comment 17 dl3it 2020-06-08 09:32:02 UTC
I created 

/etc/systemd/system/touchscreen.service


[Unit]
Description=Move touchscreen to correct driver

[Service]
ExecStart=/etc/tsmove
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target


Add this to systemd environment.
It calls /etc/tsmove once at startup.

/etc/tsmove


#!/bin/bash
modprobe i2c_hid
echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind


Works for me perfectly; no issues on Ubuntu 20.04 and kernel 5.4.0-33.
Comment 18 Guilherme Lawless 2020-06-10 10:32:03 UTC
As expected, modifying the kernel per Comment #5 solved the touchpad issue as well (don't have touchscreen on my model).
Comment 19 Nikolaos Bezirgiannis 2020-06-12 11:18:07 UTC
I can confirm that this script did the trick on a running system:

```
#!/bin/bash
modprobe i2c_hid
echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind
```

What is positive is that:

1) this script fixes the `systemctl suspend`. Without this fix applied the system refused to suspend (go to sleep) with a dmesg:

```
[  588.472945] PM: dpm_run_callback(): acpi_subsys_suspend+0x0/0x60 returns -16
[  588.472948] PM: Device i2c-ELAN0001:00 failed to suspend: error -16
[  588.527849] PM: Some devices failed to suspend, or early wake event detected
```

2) I have the touchscreen model of this laptop and i can confirm that the touchscreen continues to operate fine next to the working touchpad, after the script is run.
Comment 20 Osmo 2020-06-15 09:59:56 UTC
Doesn't seem to work for me. Issue is earlier.

I try to point at xinput and result is following :

Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech Pebble Mouse                   	id=14	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C         	id=9	[slave  keyboard (3)]
    ↳ Ideapad extra buttons                   	id=10	[slave  keyboard (3)]
    ↳ Intel HID events                        	id=11	[slave  keyboard (3)]
    ↳ Intel HID 5 button array                	id=12	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=13	[slave  keyboard (3)]

I've no Elan touchpad listed in.
My laptop is Lenonvo Ideapad 14IIL05.

Have a try to kernel update. But doensn't work much better.
Any help to fix my trackpad issue is welcome
Comment 21 Jan-Marek Glogowski 2020-06-15 13:01:32 UTC
(In reply to Osmo from comment #20)
> Doesn't seem to work for me. Issue is earlier.
... 
> I've no Elan touchpad listed in.
> My laptop is Lenonvo Ideapad 14IIL05.

As far as I have read various Ideapad 14/15 related threads, the AMD (like my 15ARE05) and Intel (like your 14IIL05) have different touchpads.

My decoded DSDT contains two "ELAN" ids: ELAN901C and a ELAN0001. I didn't test, if adding that ELAN901C id to the elan_i2c driver would result in some "better" supported device, then the generic i2c_hid driver, as I don't see any missing functionality. And the i2c_hid claims the "ELAN0001" device, if the elants_i2c is build as a module. AFAIK it's common to share a common DSDT for a series of devices, and the correct parts are just activated by some smaller config ACPI data, or the like.

There is clearly something missing, because this driver rebinding is even needed in 5.7, as the elan touchscreen driver still claims the device, even if it doesn't have a touchscreen. Eventually, even the DSDT is buggy in some way, but then the driver still needs to work around it.

My Xorg.log has some EE entries for invalid values reported by the elants_i2c driver, so it should be possible for the elants_i2c to "bail out" from claiming the device in the detection, based on these values, and the later hid_i2c driver would "just work" - my assumption.

(EE) event4  - Elan Touchscreen: kernel bug: device has min == max on ABS_X
(II) event4  - Elan Touchscreen: was rejected
(II) event4  - not using input device '/dev/input/event4'.
(EE) libinput: Elan Touchscreen: Failed to create a device for /dev/input/event4
(EE) PreInit returned 2 for "Elan Touchscreen"
Comment 22 Matt Brady 2020-06-24 03:11:26 UTC
(In reply to Jan-Marek Glogowski from comment #14)
> Thanks for all the info. I saw these error messages and assumed some larger
> problem. And didn't register the messages were created by the touchpad
> actually, since this is the touchscreen driver.
> 
> And since I managed to brick my HW, I had other things to do
> (https://forums.lenovo.com/t5/Lenovo-IdeaPad-1xx-3xx-5xx-7xx-Edge-LaVie-Z-
> Flex-Notebooks/Unbricking-Ideapad-5-15ARE05/m-p/5019541), so I could just
> test this now.
> 
> Instead of a kernel rebuild, you can simply unbind the device for the
> built-in module. Just add some startup script doing:
> 
> modprobe i2c_hid
> echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
> echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind
> 
> Now I'm wondering, what people with a notebook with an Elan touchscreen
> would do...
> 
> The elants_i2c wrongly claims the device. Either a driver bug or a wrong
> ACPI DSTD, which in the end the elants_i2c must work around :-(
> 
> And I already had decompiled the ACPI DSTD to have a look...

Thank you! This script worked for me too. Ideapad 5 AMD Ryzen 7 4500u.
Comment 23 Matt Brady 2020-06-24 03:36:07 UTC
(In reply to dl3it from comment #17)
> I created 
> 
> /etc/systemd/system/touchscreen.service
> 
> 
> [Unit]
> Description=Move touchscreen to correct driver
> 
> [Service]
> ExecStart=/etc/tsmove
> Type=oneshot
> RemainAfterExit=yes
> 
> [Install]
> WantedBy=multi-user.target
> 
> 
> Add this to systemd environment.
> It calls /etc/tsmove once at startup.
> 
> /etc/tsmove
> 
> 
> #!/bin/bash
> modprobe i2c_hid
> echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
> echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind
> 
> 
> Works for me perfectly; no issues on Ubuntu 20.04 and kernel 5.4.0-33.

I couldn't seem to get this to work. 

I used this https://linuxconfig.org/how-to-run-script-on-startup-on-ubuntu-20-04-focal-fossa-server-desktop as a guide. 

Followed all steps and rebooted. Touchpad works now :) 

Kernel 5.7.5-050705-generic
Comment 24 Remco Luitwieler 2020-08-24 11:56:46 UTC
(In reply to Jan-Marek Glogowski from comment #21)
> (In reply to Osmo from comment #20)
> > Doesn't seem to work for me. Issue is earlier.
> ... 
> > I've no Elan touchpad listed in.
> > My laptop is Lenonvo Ideapad 14IIL05.
> 
> As far as I have read various Ideapad 14/15 related threads, the AMD (like
> my 15ARE05) and Intel (like your 14IIL05) have different touchpads.
> 
> My decoded DSDT contains two "ELAN" ids: ELAN901C and a ELAN0001. I didn't
> test, if adding that ELAN901C id to the elan_i2c driver would result in some
> "better" supported device, then the generic i2c_hid driver, as I don't see
> any missing functionality. And the i2c_hid claims the "ELAN0001" device, if
> the elants_i2c is build as a module. AFAIK it's common to share a common
> DSDT for a series of devices, and the correct parts are just activated by
> some smaller config ACPI data, or the like.
> 
> There is clearly something missing, because this driver rebinding is even
> needed in 5.7, as the elan touchscreen driver still claims the device, even
> if it doesn't have a touchscreen. Eventually, even the DSDT is buggy in some
> way, but then the driver still needs to work around it.
> 
> My Xorg.log has some EE entries for invalid values reported by the
> elants_i2c driver, so it should be possible for the elants_i2c to "bail out"
> from claiming the device in the detection, based on these values, and the
> later hid_i2c driver would "just work" - my assumption.
> 
> (EE) event4  - Elan Touchscreen: kernel bug: device has min == max on ABS_X
> (II) event4  - Elan Touchscreen: was rejected
> (II) event4  - not using input device '/dev/input/event4'.
> (EE) libinput: Elan Touchscreen: Failed to create a device for
> /dev/input/event4
> (EE) PreInit returned 2 for "Elan Touchscreen"

I am also using a 14IIL05 and can confirm that there is no ELAN id shown in the output of xinput, but a MSFT0001:00 04F3:3140 Mouse and MSFT0001:00 04F3:3140 Touchpad. When using Fedora 32 with 5.7.16-200 the Touchpad is working as expected, but the Touchscreen is not working at all (no hardware defect as it works with Windows).  I tried the hid-rmi patch for the kernel module as mentioned in comment #41 from https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1887190 but that is not working for me.
xinput test shows output for the TouchPad, but nothing for the TouchScreen although it seems recognized as a mouse.
Output from Xorg.0.log shows: 
MSFT0001:00 04F3:3140 Mouse: is tagged by udev as: Mouse Pointingstick
Output from lspci:
00:1f.4 SMBus: Intel Corporation Ice Lake-LP SMBus Controller (rev 30)
        Subsystem: Lenovo Device 3813
        Kernel driver in use: i801_smbus
        Kernel modules: i2c_i801
Output from dmesg:
[    1.397059] i2c_hid i2c-MSFT0001:00: supply vdd not found, using dummy regulator
[    1.397076] i2c_hid i2c-MSFT0001:00: supply vddl not found, using dummy regulator
[    1.419419] input: MSFT0001:00 04F3:3140 Mouse as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input5
[    1.419549] input: MSFT0001:00 04F3:3140 Touchpad as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input6
[    1.419621] hid-generic 0018:04F3:3140.0001: input,hidraw0: I2C HID v1.00 Mouse [MSFT0001:00 04F3:3140] on i2c-MSFT0001:00
[    1.594818] input: MSFT0001:00 04F3:3140 Mouse as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input7
[    1.594952] input: MSFT0001:00 04F3:3140 Touchpad as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input8
[    1.595035] hid-multitouch 0018:04F3:3140.0001: input,hidraw0: I2C HID v1.00 Mouse [MSFT0001:00 04F3:3140] on i2c-MSFT0001:00

To me it seems that the TouchPad and TouchScreen is one device, but only the TouchPad is working right now. Can't figure out where it exactly goes wrong and no idea what i could try next. In a clean install of Windows the TouchPad and TouchScreen didn't work and both started working after i installed the driver (Intel Serial-IO (SIO) Driver for Windows 10 (64-bit) - Flex 5-14IIL05, Flex 5-15IIL05). 
Did someone managed to get the TouchScreen and TouchPad working or knows what to do next?
Comment 25 Peiding CHEN 2020-09-09 12:49:04 UTC
Hi, I have Legion 15ARH05 with the same Touchpad 04F3:3140. Touchpad is not working either. I am curious why ideapad 15 has the same Touchpad ID and someone could solve the issue by blacklist elan-i2c but Legion 15ARH05 cannot, especially I didn't complied elan-i2c or elants-i2c. Legion 15ARH05 doesn't have touchscreen. 

dmesg | grep -i 04f3
[    2.095379] input: MSFT0001:00 04F3:3140 Mouse as /devices/platform/AMDI0010:03/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input16
[    2.095450] input: MSFT0001:00 04F3:3140 Touchpad as /devices/platform/AMDI0010:03/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input17
[    2.095506] hid-generic 0018:04F3:3140.0001: input,hidraw0: I2C HID v1.00 Mouse [MSFT0001:00 04F3:3140] on i2c-MSFT0001:00
[    2.589937] input: MSFT0001:00 04F3:3140 Mouse as /devices/platform/AMDI0010:03/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input19
[    2.590052] input: MSFT0001:00 04F3:3140 Touchpad as /devices/platform/AMDI0010:03/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input20
[    2.590112] hid-multitouch 0018:04F3:3140.0001: input,hidraw0: I2C HID v1.00 Mouse [MSFT0001:00 04F3:3140] on i2c-MSFT0001:00
Comment 26 lyntier 2020-09-09 18:53:20 UTC
Ideapad Flex 5
14IIL05
i5, 256GB drive, 8GB RAM

Touchpad works out of the box, Touch*screen* does not.

$ xinput
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ MSFT0001:00 04F3:4140 Mouse              	id=11	[slave  pointer  (2)]
⎜   ↳ MSFT0001:00 04F3:4140 Touchpad           	id=12	[slave  pointer  (2)]

Shows up twice in xinput; I assume once as touchpad, once as touchscreen, but identified as mouse. Scripts above don't change anything unfortunately, although touchpad keeps working. Haven't tried compiling yet; wasn't sure how to and I doubt it'd help if the driver-changing scripts don't.
Comment 27 armadillo 2020-10-04 18:15:49 UTC
I have the same issue as lyntier.

xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ USB Keyboard Mouse                      	id=14	[slave  pointer  (2)]
⎜   ↳ MSFT0001:00 06CB:CE2D Mouse             	id=16	[slave  pointer  (2)]
⎜   ↳ MSFT0001:00 06CB:CE2D Touchpad          	id=17	[slave  pointer  (2)]

I tried adopting the script as following:

#!/bin/bash
modprobe i2c_hid
echo "i2c-MSFT0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
echo "i2c-MSFT0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind

but the service was not able to run due to the script failing:

systemctl status touchscreen.service 
● touchscreen.service - Move touchscreen to correct driver
     Loaded: loaded (/etc/systemd/system/touchscreen.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2020-10-04 19:56:51 CEST; 16min ago
    Process: 792 ExecStart=/etc/tsmove (code=exited, status=1/FAILURE)
   Main PID: 792 (code=exited, status=1/FAILURE)

Oct 04 19:56:51 donat-flex-5 systemd[1]: Starting Move touchscreen to correct driver...
Oct 04 19:56:51 donat-flex-5 tsmove[792]: /etc/tsmove: line 3: echo: write error: No such device
Oct 04 19:56:51 donat-flex-5 tsmove[792]: /etc/tsmove: line 4: echo: write error: No such device
Oct 04 19:56:51 donat-flex-5 systemd[1]: touchscreen.service: Main process exited, code=exited, status=1/FAILURE
Oct 04 19:56:51 donat-flex-5 systemd[1]: touchscreen.service: Failed with result 'exit-code'.
Oct 04 19:56:51 donat-flex-5 systemd[1]: Failed to start Move touchscreen to correct driver.

but dmesg shows that the device is already using i2c_hid:

dmesg | grep MSFT
[    0.639245] i2c_hid i2c-MSFT0001:00: i2c-MSFT0001:00 supply vdd not found, using dummy regulator
[    0.639261] i2c_hid i2c-MSFT0001:00: i2c-MSFT0001:00 supply vddl not found, using dummy regulator
[    0.688182] input: MSFT0001:00 06CB:CE2D Mouse as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-1/i2c-MSFT0001:00/0018:06CB:CE2D.0001/input/input5
[    0.688257] input: MSFT0001:00 06CB:CE2D Touchpad as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-1/i2c-MSFT0001:00/0018:06CB:CE2D.0001/input/input6
[    0.688310] hid-generic 0018:06CB:CE2D.0001: input,hidraw0: I2C HID v1.00 Mouse [MSFT0001:00 06CB:CE2D] on i2c-MSFT0001:00
[    3.164826] input: MSFT0001:00 06CB:CE2D Mouse as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-1/i2c-MSFT0001:00/0018:06CB:CE2D.0001/input/input16
[    3.167199] input: MSFT0001:00 06CB:CE2D Touchpad as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-1/i2c-MSFT0001:00/0018:06CB:CE2D.0001/input/input17
[    3.168205] hid-multitouch 0018:06CB:CE2D.0001: input,hidraw0: I2C HID v1.00 Mouse [MSFT0001:00 06CB:CE2D] on i2c-MSFT0001:00


Could anybody please help me? I've installed Linux for the first time and just got this notebook.
Comment 28 Jan-Marek Glogowski 2020-10-04 19:08:26 UTC
To all the Intel *IIL05 users: please open a new bug report and handle the problems with that touchpad / touchscreen in there. It's different HW and needs completely different fixes.

Maybe the reporter can update the title of the bug report?

----

The whole bug was originally about the *touchpad* on the AMD version of the Lenovo Ideapad 5 15 AKA *ARE05, where the *touchscreen* elants_i2c driver wrongly claims the *touchpad* device.

For the AMD version AKA *ARE05 we have a working workaround in comment 17, that fixes:
1. the touchpad
2. suspend to RAM (comment 19)

The device eventually uses a different touchscreen driver, which was never affected (see comment 19 again).

The bug: the elants_i2c driver finds the device by the ACPI id ELAN0001. It then probes the device, to detect if it's actually working. It even fails in there, but instead of giving up on it, it offers a driver interface to flash the "broken" firmware to some working state, and keeps trying to decode messages. Flashing would obviously also fail in this case, as the device is no touchscreen, but a touchpad. So the driver still claims the device and get's really "confused" by all the unknown i2c HID touchpad messages.

Maybe the elants_i2c can detect the HID state of the device and then give up?
Comment 29 Remco Luitwieler 2020-10-05 20:02:34 UTC
(In reply to Jan-Marek Glogowski from comment #28)
> To all the Intel *IIL05 users: please open a new bug report and handle the
> problems with that touchpad / touchscreen in there. It's different HW and
> needs completely different fixes.
> 
> Maybe the reporter can update the title of the bug report?
> 
> ----
> 
> The whole bug was originally about the *touchpad* on the AMD version of the
> Lenovo Ideapad 5 15 AKA *ARE05, where the *touchscreen* elants_i2c driver
> wrongly claims the *touchpad* device.
> 
> For the AMD version AKA *ARE05 we have a working workaround in comment 17,
> that fixes:
> 1. the touchpad
> 2. suspend to RAM (comment 19)
> 
> The device eventually uses a different touchscreen driver, which was never
> affected (see comment 19 again).
> 
> The bug: the elants_i2c driver finds the device by the ACPI id ELAN0001. It
> then probes the device, to detect if it's actually working. It even fails in
> there, but instead of giving up on it, it offers a driver interface to flash
> the "broken" firmware to some working state, and keeps trying to decode
> messages. Flashing would obviously also fail in this case, as the device is
> no touchscreen, but a touchpad. So the driver still claims the device and
> get's really "confused" by all the unknown i2c HID touchpad messages.
> 
> Maybe the elants_i2c can detect the HID state of the device and then give up?

New bug report opened: https://bugzilla.kernel.org/show_bug.cgi?id=209521
Comment 30 Peiding CHEN 2020-10-06 12:23:08 UTC
Here there is walkaround for AMD Laptop
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1887190
Comment 31 Ivan Zakharyaschev 2020-10-17 18:29:01 UTC
I also experience the problem with the wrong binding of the "ELAN" touchpad device to the compiled-in driver elants_i2c -- https://bugs.launchpad.net/ubuntu/+source/linux-oem-5.6/+bug/1900254 .

(In reply to Jan-Marek Glogowski from comment #16)

> Currently I'm using this little script, which did work the last few boots:
> 
> echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
> sleep 1.5
> echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind


As a solution (until the binding of this device is fixed in the linux kernel), I blacklisted this compiled-in driver in the kernel command line, as described in https://unix.stackexchange.com/a/474552/4319 :

First, find function names which look like initialization functions of this module:

# fgrep elants /boot/System.map-5.8.0-23-generic | fgrep init
ffffffff818f3430 t elants_i2c_initialize
ffffffff818f40bf t elants_i2c_initialize.cold
ffffffff829253f5 t elants_i2c_driver_init
ffffffff82af7a30 t __initcall_elants_i2c_driver_init6
#

The last one (__initcall*) doesn't look like the one we are looking for.

Then add them to the kernel parameters in /etc/default/grub (on Ubuntu)

GRUB_CMDLINE_LINUX_DEFAULT="... initcall_blacklist=elants_i2c_initialize initcall_blacklist=elants_i2c_initialize.cold initcall_blacklist=elants_i2c_driver_init"

and run update-grub.
Comment 32 Hans de Goede 2021-02-25 10:54:05 UTC
Hi All,

Thank you for figuring out that the issue is the elants_i2c driver binding to the touchscreen while it should be handled by the i2c-hid driver, that helps a lot.

I've written a small patch for the elants_i2c driver to stop it from binding to i2c-hid compatible touchscreens, which should fix this. I'll attach the patch here.

I would appreciate it if one of you can build a kernel with this patch (see your distro's docs), remove your workaround and then let me know if this fixes things.

If any of you are running Fedora, let me know, then I can provide a pre-built kernel with the patch added.

Regards,

Hans
Comment 33 Hans de Goede 2021-02-25 10:54:44 UTC
Created attachment 295439 [details]
[PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
Comment 34 Hans de Goede 2021-02-25 11:01:22 UTC
I would also appreciate it if some of you can run:

sudo apcidump -o acpidump.lenovo-<full-model-name> 

And then attach the generated acpidump.lenovo-<full-model-name> file here.

For example run:

sudo apcidump -o acpidump.lenovo-Ideapad-5-15ARE05

And then attach the acpidump.lenovo-Ideapad-5-15ARE05 file here.

The reason I'm asking for this is because the fix which I wrote is somewhat simple. It should work, but there might be older touchscreens which actually need to use the Elan specific protocol implemented by elants_i2c.ko; while the ACPI-fwnode describing the touchscreen falsely contains one of the i2c-hid ACPI compatiblity-id strings. This would of course be a bug in the ACPI tables, but I have seen this before.

If it turns out this is indeed the case then some more elaborate fix may be necessary and the acpidump(s) may help with figuring that out.
Comment 35 Fibonacci 2021-03-01 23:29:19 UTC
Since 5.12rc1 the touchpad isn't working on my ideapad 5 and I have elants_i2c blacklisted. touchpad is working fine on 5.11
Comment 36 lukasbecker2 2021-03-02 09:26:00 UTC
Created attachment 295575 [details]
output of sudo apcidump -o acpidump.lenovo-Ideapad-5-15ARE05

Output of the requested command on my ideapad, with the command:
sudo apcidump -o acpidump.lenovo-Ideapad-5-15ARE05
Comment 37 Benjamin Tissoires 2021-03-02 09:44:12 UTC
@Fibonacci: in 5.12-rc1 there was a big refactoring of i2c-hid. Do you have `CONFIG_I2C_HID_ACPI=m` (or `y`) in you .config file?
Comment 38 Hans de Goede 2021-03-02 11:18:19 UTC
Thank you for the acpidump.

I'm still waiting on feedback on the patch which I attached here. It would be great if someone can test this and confirm that it fixes things, so that I can submit the fix upstream and we can get this fixed in the mainline kernel.
Comment 39 Hans de Goede 2021-03-02 11:39:04 UTC
So the acpidump made me realize that there is an extra check which we can do inside the elants_i2c driver's probe function. We can check for the I2C-HID spec's DSM (device-specific-method) to get the HID descriptor address. If that is not present then the device will not work with the I2C-HID driver. This should reduce the chance of my patch causing regressions for touchscreens which do actually need the elants_i2c driver.

I'll attach an updated patch here, please give this new version a try.
Comment 40 Hans de Goede 2021-03-02 11:42:26 UTC
Created attachment 295577 [details]
[PATCH] Input: elants_i2c - Do not bind to i2c-hid compatible ACPI instantiated devices
Comment 41 lukasbecker2 2021-03-02 11:47:37 UTC
Thank you, is it enough if I apply this patch to my distro kernel ? (arch linux, linux 5.11.2)
Comment 42 Hans de Goede 2021-03-02 11:52:09 UTC
(In reply to lukasbecker2 from comment #41)
> Thank you, is it enough if I apply this patch to my distro kernel ? (arch
> linux, linux 5.11.2)

Yes, if you can test your distro's 5.11.2 kernel with the patch added on top, that would be great, thank you.

p.s. Don't forget to disable any workarounds which you may have put in place when testing the patched kernel.
Comment 43 lukasbecker2 2021-03-02 12:07:52 UTC
The touchpad works now as expected with the patch (attatchment 295577),
kernel 5.11.2 arch linux  (I disabled the privious workaround, kernel param initcall_blacklist=elants_i2c_driver_init).
Comment 44 Hans de Goede 2021-03-02 14:51:45 UTC
(In reply to lukasbecker2 from comment #43)
> The touchpad works now as expected with the patch (attatchment 295577),
> kernel 5.11.2 arch linux  (I disabled the privious workaround, kernel param
> initcall_blacklist=elants_i2c_driver_init).

Great, thank you for testing. I've submitted the patch for this upstream, hopefully it will be merged into 5.12 sometime this cycle and then added to the stable kernel releases after that.
Comment 45 lukasbecker2 2021-03-05 12:03:56 UTC
(In reply to Hans de Goede from comment #44)
> (In reply to lukasbecker2 from comment #43)
> > The touchpad works now as expected with the patch (attatchment 295577),
> > kernel 5.11.2 arch linux  (I disabled the privious workaround, kernel param
> > initcall_blacklist=elants_i2c_driver_init).
> 
> Great, thank you for testing. I've submitted the patch for this upstream,
> hopefully it will be merged into 5.12 sometime this cycle and then added to
> the stable kernel releases after that.

Thank you for the patch, can you provide a link to the submitted patch so I can check the status form time to time ?
Comment 47 lukasbecker2 2021-03-05 12:34:47 UTC
(In reply to Hans de Goede from comment #46)
> https://lore.kernel.org/linux-input/YD6VL4CwudwKs5Vo@google.com/T/#t

Thank you, :)
Comment 48 Hans de Goede 2021-05-18 12:11:17 UTC
(In reply to Hans de Goede from comment #46)
> https://lore.kernel.org/linux-input/YD6VL4CwudwKs5Vo@google.com/T/#t

This patch has been merged into 5.13-rc1, so this bug can be closed now.
Comment 49 Hans de Goede 2021-05-26 11:16:14 UTC
The patch for this is now also available in the 5.12.6 and 5.10.39 stable kernel releases.
Comment 50 lukasbecker2 2021-05-30 12:26:08 UTC
Thank you :)
Comment 51 Lovesh 2021-08-01 08:55:32 UTC
(In reply to Jan-Marek Glogowski from comment #14)
> Thanks for all the info. I saw these error messages and assumed some larger
> problem. And didn't register the messages were created by the touchpad
> actually, since this is the touchscreen driver.
> 
> And since I managed to brick my HW, I had other things to do
> (https://forums.lenovo.com/t5/Lenovo-IdeaPad-1xx-3xx-5xx-7xx-Edge-LaVie-Z-
> Flex-Notebooks/Unbricking-Ideapad-5-15ARE05/m-p/5019541), so I could just
> test this now.
> 
> Instead of a kernel rebuild, you can simply unbind the device for the
> built-in module. Just add some startup script doing:
> 
> modprobe i2c_hid
> echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind
> echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/i2c_hid/bind
> 
> Now I'm wondering, what people with a notebook with an Elan touchscreen
> would do...
> 
> The elants_i2c wrongly claims the device. Either a driver bug or a wrong
> ACPI DSTD, which in the end the elants_i2c must work around :-(
> 
> And I already had decompiled the ACPI DSTD to have a look...

I am on Kubuntu 21.04 and I think my touchpad is ELAN1203 (based on dmesg outputs) and I have the same issue, reported issue here https://bugzilla.kernel.org/show_bug.cgi?id=213857.

I tried to unbind with (using root) 

echo "i2c-ELAN0001:00" > /sys/bus/i2c/drivers/elants_i2c/unbind

But i get the error

-bash: echo: write error: No such device

Also, I see 2 i2c_hid like modules in lsmod

$ lsmod | grep i2c_hid
i2c_hid_acpi           16384  0
i2c_hid                28672  1 i2c_hid_acpi
hid                   135168  3 i2c_hid,usbhid,hid_generic
Comment 52 Hans de Goede 2021-08-01 09:01:48 UTC
(In reply to Lovesh from comment #51)
> I am on Kubuntu 21.04 and I think my touchpad is ELAN1203 (based on dmesg
> outputs) and I have the same issue, reported issue here
> https://bugzilla.kernel.org/show_bug.cgi?id=213857.

Looking at bug 213857 you are having an issue with the kernel not being able to configure the GPIO pin which is used for the touchpad, which is an entirely different issue.

Lets continue discussing this in bug 213857.
Comment 53 Lovesh 2021-08-01 09:34:40 UTC
(In reply to Hans de Goede from comment #52)
> (In reply to Lovesh from comment #51)
> > I am on Kubuntu 21.04 and I think my touchpad is ELAN1203 (based on dmesg
> > outputs) and I have the same issue, reported issue here
> > https://bugzilla.kernel.org/show_bug.cgi?id=213857.
> 
> Looking at bug 213857 you are having an issue with the kernel not being able
> to configure the GPIO pin which is used for the touchpad, which is an
> entirely different issue.
> 
> Lets continue discussing this in bug 213857.

Sounds good. Thank you.