Bug 207759 - Elan Touchscreen not working on Lenovo IdeaPad 5 15
Summary: Elan Touchscreen not working on Lenovo IdeaPad 5 15
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_input-devices
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-16 16:51 UTC by dl3it
Modified: 2020-07-20 13:22 UTC (History)
11 users (show)

See Also:
Kernel Version: 5.6.13
Tree: Mainline
Regression: No


Attachments
dmesg / kernel log (82.23 KB, text/plain)
2020-06-02 11:21 UTC, dl3it
Details
Xorg.0.log (27.54 KB, text/plain)
2020-06-02 11:24 UTC, dl3it
Details

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

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