MSFT Touchpad not working on Lenovo Legion-5 15ARH05

Bug #1887190 reported by Nicolas Rogues on 2020-07-10
362
This bug affects 63 people
Affects Status Importance Assigned to Milestone
Pop!_OS
Undecided
Unassigned
linux (Arch Linux)
Fix Committed
Undecided
Unassigned
linux (Fedora)
Confirmed
Undecided
Unassigned
linux (Ubuntu)
Undecided
Phan Thanh Long
linux (openSUSE)
New
Undecided
Unassigned
xserver-xorg-input-libinput (Ubuntu)
Undecided
Unassigned

Bug Description

Update (based on #296)
=============

The latest kernel tree (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git) has the complete solution to fix this bug. So we can expect kernel v5.11 to fix this issue without any additional work.

Before the release of v5.11, you are suggested to use #189 to save your touchpad. Note that for distributions like Ubuntu and Fedora, the pinctrl-amd driver is built into the initramfs. So you have to rebuild the initramfs after replacing the old module with new one.
On Fedora, run `sudo dracut --force`; On ubuntu, run `sudo update-initramfs -u`.

The complete solution is three patches,
 - 47a0001436352c9853d72bf2071e85b316d688a2 ("pinctrl: amd: remove debounce filter setting in IRQ type setting")
 - 06abe8291bc31839950f7d0362d9979edc88a666 ("pinctrl: amd: fix incorrect way to disable debounce filter")
 - 8dcb7a15a585b6d0fee15751ce11d7a68cfedd56 ("gpiolib: acpi: Take into account debounce settings")

The first two patches has reached the stable tree. If the last one is also backported to LTS kernel, you won't need to install kernel 5.11. But I don't know when this will happen.

Original bug report
===================

Hello

The MSFT touchpad of this Lenovo Legion-5 15ARH05 laptop is not reacting at all (pointer and click never move when touchpad is touched). This has been reported by other users in various websites, with various linux systems including other Ubuntu systems, but I saw no launchpad bug so I post one. Example of websites covering the issue :
- https://askubuntu.com/questions/1253830/lenovo-legion-5-touchpad (exactly the same laptop)
- https://www.linux.org/threads/lenovo-legion-5-touchpad.29536/ (similar laptop)

xinput indentifies it as MSFT0001:00 04F3:3140

Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ MSFT0001:00 04F3:3140 Touchpad id=17 [slave pointer (2)]
⎜ ↳ MSFT0001:00 04F3:3140 Mouse id=16 [slave pointer (2)]
⎜ ↳ ITE Tech. Inc. ITE Device(8910) Consumer Control id=12 [slave pointer (2)]
⎜ ↳ Logitech USB Optical Mouse id=11 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
    ↳ Ideapad extra buttons id=15 [slave keyboard (3)]
    ↳ Power Button id=6 [slave keyboard (3)]
    ↳ Integrated Camera: Integrated C id=10 [slave keyboard (3)]
    ↳ Video Bus id=7 [slave keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8910) Consumer Control id=19 [slave keyboard (3)]
    ↳ Power Button id=9 [slave keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8910) Wireless Radio Control id=13 [slave keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8910) Keyboard id=14 [slave keyboard (3)]
    ↳ AT Translated Set 2 keyboard id=18 [slave keyboard (3)]
    ↳ Video Bus id=8 [slave keyboard (3)]

Thanks a lot for your time. It does not help, but I can confirm what was reported on askubuntu by another user : the touchpad does work on Windows.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: linux-image-5.4.0-40-generic 5.4.0-40.44
ProcVersionSignature: Ubuntu 5.4.0-40.44-generic 5.4.44
Uname: Linux 5.4.0-40-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu27.3
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: nicolas 1567 F.... pulseaudio
 /dev/snd/controlC1: nicolas 1567 F.... pulseaudio
 /dev/snd/controlC2: nicolas 1567 F.... pulseaudio
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Fri Jul 10 20:14:25 2020
InstallationDate: Installed on 2020-07-02 (8 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
MachineType: LENOVO 82B5
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=fr_FR.UTF-8
 SHELL=/bin/bash
ProcFB: 0 EFI VGA
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-5.4.0-40-generic root=UUID=d8898017-2821-434e-ab52-fec76ac93106 ro quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-5.4.0-40-generic N/A
 linux-backports-modules-5.4.0-40-generic N/A
 linux-firmware 1.187.1
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 05/12/2020
dmi.bios.vendor: LENOVO
dmi.bios.version: EUCN19WW
dmi.board.asset.tag: NO Asset Tag
dmi.board.name: LNVNB161216
dmi.board.vendor: LENOVO
dmi.board.version: SDK0J40709 WIN
dmi.chassis.asset.tag: NO Asset Tag
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Lenovo Legion 5 15ARH05
dmi.modalias: dmi:bvnLENOVO:bvrEUCN19WW:bd05/12/2020:svnLENOVO:pn82B5:pvrLenovoLegion515ARH05:rvnLENOVO:rnLNVNB161216:rvrSDK0J40709WIN:cvnLENOVO:ct10:cvrLenovoLegion515ARH05:
dmi.product.family: Legion 5 15ARH05
dmi.product.name: 82B5
dmi.product.sku: LENOVO_MT_82B5_BU_idea_FM_Legion 5 15ARH05
dmi.product.version: Lenovo Legion 5 15ARH05
dmi.sys.vendor: LENOVO
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.3
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
DistroRelease: Ubuntu 20.04
InstallationDate: Installed on 2020-07-02 (12 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
Package: linux (not installed)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=fr_FR.UTF-8
 SHELL=/bin/bash
Tags: focal
Uname: Linux 5.8.0-050800rc5-generic x86_64
UnreportableReason: The running kernel is not an Ubuntu kernel
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
_MarkForUpload: True

Nicolas Rogues (nrogues) wrote :

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Kai-Heng Feng (kaihengfeng) wrote :
You-Sheng Yang (vicamo) on 2020-07-14
tags: added: hwe-touchpad

apport information

tags: added: apport-collected
description: updated
Nicolas Rogues (nrogues) wrote :

Hello

Kernel 5.8-rc5 from https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.8-rc5/ does not resolve the problem.

I tried to use below command to reattach all apport files, but it only attached one file, let me know if you need more files (and provide the appropriate command line !)
apport-collect 1887190

Thanks
Nicolas

Helmut Stult (helmut-stult) wrote :

The link provides all the necessary information:

https://linux-hardware.org/?probe=59d2f291d6

Helmut Stult (helmut-stult) wrote :

Controlling the screen brightness with Fn + F5 / F6 also does not work

Stefano Galassi (iltoga) wrote :

my lenovo legion 5 15ARH05 has same issues:
touchpad shows up under input devices as 'MSFT0001:00 04F3:3140 Touchpad' but doesn't work on linux (on windows it does work perfectly)
screen brightness control doesn't work too

https://linux-hardware.org/?probe=a8dfb4b56d

You-Sheng Yang (vicamo) wrote :
Download full text (3.6 KiB)

@Helmut, from your Xorg.log and dmesg, MSFT0001 has beend detected and enabled in kernel, but somehow it failed to be enabled in xorg:

[ 74.771] (II) config/udev: Adding input device MSFT0001:00 04F3:3140 Mouse (/dev/input/event16)
[ 74.771] (**) MSFT0001:00 04F3:3140 Mouse: Applying InputClass "evdev pointer catchall"
[ 74.771] (**) MSFT0001:00 04F3:3140 Mouse: Applying InputClass "libinput pointer catchall"
[ 74.771] (II) Using input driver 'libinput' for 'MSFT0001:00 04F3:3140 Mouse'
[ 74.771] (**) MSFT0001:00 04F3:3140 Mouse: always reports core events
[ 74.771] (**) Option "Device" "/dev/input/event16"
[ 74.771] (**) Option "_source" "server/udev"
[ 74.772] (II) event16 - MSFT0001:00 04F3:3140 Mouse: is tagged by udev as: Mouse Pointingstick
[ 74.772] (II) event16 - MSFT0001:00 04F3:3140 Mouse: device is a pointer
[ 74.772] (II) event16 - MSFT0001:00 04F3:3140 Mouse: device removed
[ 74.836] (**) Option "config_info" "udev:/sys/devices/platform/AMDI0010:03/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input18/event16"
[ 74.836] (II) XINPUT: Adding extended input device "MSFT0001:00 04F3:3140 Mouse" (type: MOUSE, id 16)
[ 74.836] (**) Option "AccelerationScheme" "none"
[ 74.836] (**) MSFT0001:00 04F3:3140 Mouse: (accel) selected scheme none/0
[ 74.836] (**) MSFT0001:00 04F3:3140 Mouse: (accel) acceleration factor: 2.000
[ 74.836] (**) MSFT0001:00 04F3:3140 Mouse: (accel) acceleration threshold: 4
[ 74.837] (II) event16 - MSFT0001:00 04F3:3140 Mouse: is tagged by udev as: Mouse Pointingstick
[ 74.837] (II) event16 - MSFT0001:00 04F3:3140 Mouse: device is a pointer
[ 74.838] (II) config/udev: Adding input device MSFT0001:00 04F3:3140 Mouse (/dev/input/mouse0)
[ 74.838] (II) No input driver specified, ignoring this device.
[ 74.838] (II) This device may have been added with another device file.
[ 74.839] (II) config/udev: Adding input device MSFT0001:00 04F3:3140 Touchpad (/dev/input/event17)
[ 74.839] (**) MSFT0001:00 04F3:3140 Touchpad: Applying InputClass "evdev touchpad catchall"
[ 74.839] (**) MSFT0001:00 04F3:3140 Touchpad: Applying InputClass "libinput touchpad catchall"
[ 74.839] (II) Using input driver 'libinput' for 'MSFT0001:00 04F3:3140 Touchpad'
[ 74.839] (**) MSFT0001:00 04F3:3140 Touchpad: always reports core events
[ 74.839] (**) Option "Device" "/dev/input/event17"
[ 74.839] (**) Option "_source" "server/udev"
[ 74.839] (II) event17 - MSFT0001:00 04F3:3140 Touchpad: is tagged by udev as: Touchpad
[ 74.840] (II) event17 - MSFT0001:00 04F3:3140 Touchpad: device is a touchpad
[ 74.840] (II) event17 - MSFT0001:00 04F3:3140 Touchpad: device removed
[ 74.916] (**) Option "config_info" "udev:/sys/devices/platform/AMDI0010:03/i2c-0/i2c-MSFT0001:00/0018:04F3:3140.0001/input/input19/event17"
[ 74.917] (II) XINPUT: Adding extended input device "MSFT0001:00 04F3:3140 Touchpad" (type: TOUCHPAD, id 17)
[ 74.917] (**) Option "AccelerationScheme" "none"
[ 74.917] (**) MSFT0001:00 04F3:3140 Touchpad: (accel) selected scheme none/0
[ 74.917] (**) MSFT0001:00 04F3:3140 Touchpad: (accel) acceleration factor: 2.000
[ 74.917] (**) MSF...

Read more...

You-Sheng Yang (vicamo) wrote :

Please file screen brightness control as another bug (and maybe comment the url for that new bug) and let's focus on touchpad here.

Kai-Heng Feng (kaihengfeng) wrote :
Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Nicolas Rogues (nrogues) wrote :

Hello,

The kernel 5.4.0-42-generic from https://people.canonical.com/~khfeng/lp1887190/ does not work either.

Thanks

Nicolas

Kai-Heng Feng (kaihengfeng) wrote :

Can you please attach dmesg? Thanks!

Nicolas Rogues (nrogues) wrote :

Here you go
Nicolas

Kai-Heng Feng (kaihengfeng) wrote :

Please run `watch -n0 cat /proc/interrupts`, put finger on the touchpad and see "AMDI0010:03", "pinctrl_amd" or "MSFT0001:00" increase the interrupt count rapidly.

Nicolas Rogues (nrogues) wrote :

AMDI0010:03 and pinctrl_amd are present but the count does not move when I move finger or click on the touchpad.

Please note I tried to remove my USB Mouse which is responsible for the high counts on one of xhci_hcd. For this mouse it's moving rapidly.

Two screen captures enclosed.

This bug also affects my laptop touchpad
Lenvo Legion 5-ARH05 5.7.1 Kernel
https://linux-hardware.org/?probe=d449a0b248

Stefano Galassi (iltoga) wrote :

I manually patched that file on 5.7.8-AMD kernel, but touchpad is still dead..

https://linux-hardware.org/?probe=50272ea6ea

thank you

Kai-Heng Feng (kaihengfeng) wrote :

Please raise the issue to the following email address:
Jarkko Nikula <email address hidden> (maintainer:SYNOPSYS DESIGNWARE I2C DRIVER)
Andy Shevchenko <email address hidden> (reviewer:SYNOPSYS DESIGNWARE I2C DRIVER)
Mika Westerberg <email address hidden> (reviewer:SYNOPSYS DESIGNWARE I2C DRIVER)
Philipp Zabel <email address hidden> (maintainer:RESET CONTROLLER FRAMEWORK)
<email address hidden> (open list:SYNOPSYS DESIGNWARE I2C DRIVER)
<email address hidden> (open list)

Kai-Heng Feng (kaihengfeng) wrote :

Possible dupe of lp: #1884981, with different error though.

Nicolas Rogues (nrogues) wrote :

done today

got an error from vger.kernel.org (policy analysis reported: your address is not liked source for email) but not from other recipients, so if any of the other affected users has an approved email address with this server, I will be glad to provide the initial email for forwarding

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xserver-xorg-input-libinput (Ubuntu):
status: New → Confirmed
Didi Kohen (kohen-d) wrote :

I think I have the same issue on my Idea Pad 5, before I got i2c controller timed out errors, but after a firmware upgrade, I don't see any errors, I'll try to revert my firmware settings to see if I can restore the previous state (where after windows is started, touchpad workd on the next boot)
I'll try the kernels given here afterwards (since it did work before)

Didi Kohen (kohen-d) wrote :

OK, this is really strange, after tons of reboots to Ubuntu and Win 10, it started working again after I disabled the legacy boot option.
Still would like a solution to the timeouts other than rebooting twice, though.
I'm a developer, so if there are multiple code changes that need to be tested, I could make them and compile to check, but right now I don't know where to start. (I'm used to working on storage, not HID)

Nicolas Rogues (nrogues) wrote :

Hello Didi,

The issue we face could be different : on the Lenovo Legion-5 15ARH05 (which is the object of this bug report) there is no working trick to boot on Windows then Ubuntu : it just never worked under Linux on the two BIOS tested (factory I think EUCN16WW and June update EUCN19WW), in UEFI mode, no matters if Windows was used before reboot and grub to Ubuntu (I have a dual-boot setup).

As a remark, the touchpad does work in the UEFI BIOS, before any OS is loaded.

Ben T (derrotmax) wrote :

Touchpad MSFT0001:00 04F3:3140 is dead on 5.8 rc5 as well.

Helmut Stult (helmut-stult) wrote :

I have found the cause so far that the touchpad MSFT0001: 00 04F3: 3140 is recognized, but no suitable driver is found.

With the touchpad ELAN0001: 00 04F3: 3140 it seems to work with a few tricks.
ELAN is also available in the kernel config, but MSFT is not.

I just don't understand why there are two different names (ELAN and MFST) under the same hardware ID - what did Lenovo do?

Nicolas Rogues (nrogues) wrote :

It's a good question.

In my understanding, the Legion R7000 is the name for China of the Legion-5 15ARH05. In the Lenovo forum, the Lenovo employee has no access to the equipment and indicates it's a kernel issue, suggesting it used to work prior to 5.4 kernel. That looks strange.

https://forums.lenovo.com/topic/view/2713/5020793

Also in this thread a member of the Lenovo forum points out to a blog, unfortunately in Chinese, of a guy who may have found a workaround. I tried to google translate it but was not sure of the result to try anything :

https://www.cnblogs.com/mikeguan/p/13126497.html

Helmut Stult (helmut-stult) wrote :

I am a Manjaro developer and we have kernels 4.4 / 4.9 / 4.14 / 4.19 / 5.4 / 5.7 / 5.8
The touchpad doesn't work with one of the kernels.
Screen brightness only works with AMD- or nouveau-Driver, not with the proprietary driver, like 440.100
The brightness display works, but nothing changes.
.

Ben T (derrotmax) wrote :

Nicolas -- I've seen the R7000 Chinese post (https://www.cnblogs.com/mikeguan/p/13126497.html), and what it basically entails is blacklisting hid_multitouch (or disabling it in the kernel and recompiling), which according to other forums seems to have an effect on some touchpads, but has no effect on the MSFT0001:00 04F3:3140 touchpad we have. I attempted his suggestions anyways, and saw the same lack of results -- the touchpad remained dead.

Nicolas Rogues (nrogues) wrote :

Thanks Helmut and Ben. These are very precise information and better than any post elsewhere.
I got no reply from the email contacts provided by Kai-Heng yet...
Anyone with a Lenovo connection ?

Helmut Stult (helmut-stult) wrote :

Just repeat again - the fix works where an incorrect driver is detected.
However, no driver is found at all for the LEGION 5 and the touchpad is therefore not activated.

Helmut Stult (helmut-stult) wrote :

These are my latest LOG files

https://linux-hardware.org/?probe=27a5d47256

Helmut Stult (helmut-stult) wrote :

As long as no solution is found, here is another solution.

https://gitlab.manjaro.org/packages/community/lenopow

Since it is only a script, this should work in every distribution ;-)

Nicolas Rogues (nrogues) on 2020-07-27
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Stefano Galassi (iltoga) on 2020-08-01
Changed in linux (Arch Linux):
status: New → Confirmed
Changed in linux (Fedora):
status: New → Confirmed
Stefano Galassi (iltoga) wrote :

is there anyone workin on this yet?

daleli (daleli) wrote :

is there anyone workin on this yet?

Stefano Galassi (iltoga) wrote :

it seems not yet... :(

no longer affects: linux
information type: Public → Public Security
information type: Public Security → Public
Eugene (zhekehz) on 2020-08-26
information type: Public → Public Security
information type: Public Security → Private Security
information type: Private Security → Public
juziy (jukz) on 2020-08-28
no longer affects: linux
tags: added: patch
Changed in linux (Arch Linux):
status: Confirmed → Fix Committed
265 comments hidden view all 345 comments
Piotr Tomaszewski (nfm886) wrote :

@Robin Windey (r0wi), I will try it. Thanks for the info

Azizkhan (injkgz) wrote :

Robin Windey (r0wi), I tried to do this via ur instructions and via Mainline utility, but my touchpad isn't working...

albertoiNET (albertoinet) wrote :

On Ubuntu 20.10 I installed with kernel 5.10.1 with your instructions @Robin Windey (r0wi) and neither works touchpad

Piotr Tomaszewski (nfm886) wrote :

@Robin Windey (r0wi), unfortunately it does not works with my touchpad. Tried kernel you linked on PopOS 20.10 and Ubuntu 20.04.1. Both results are same, touchpad not works. What is yours touchpad?

Robin Windey (r0wi) wrote :

Could you try to boot in recovery mode and then resume the normal boot process? I think i have the MSFT0001:00 06CB:7F28 touchpad installed but i'll check these days.

wangjun (biggerchina) wrote :
Download full text (15.1 KiB)

on fedora 33,with kernel 5.10.2 , i use this patch ,then touchpad work!

diff -Narup a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
--- a/drivers/gpio/gpiolib-acpi.c 2020-12-14 06:41:30.000000000 +0800
+++ b/drivers/gpio/gpiolib-acpi.c 2020-12-22 14:31:53.078877803 +0800
@@ -205,6 +205,68 @@ static void acpi_gpiochip_request_irqs(s
   acpi_gpiochip_request_irq(acpi_gpio, event);
 }

+static enum gpiod_flags
+acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio, int polarity)
+{
+ /* GpioInt() implies input configuration */
+ if (agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT)
+ return GPIOD_IN;
+
+ switch (agpio->io_restriction) {
+ case ACPI_IO_RESTRICT_INPUT:
+ return GPIOD_IN;
+ case ACPI_IO_RESTRICT_OUTPUT:
+ /*
+ * ACPI GPIO resources don't contain an initial value for the
+ * GPIO. Therefore we deduce that value from the pull field
+ * and the polarity instead. If the pin is pulled up we assume
+ * default to be high, if it is pulled down we assume default
+ * to be low, otherwise we leave pin untouched. For active low
+ * polarity values will be switched. See also
+ * Documentation/firmware-guide/acpi/gpio-properties.rst.
+ */
+ switch (agpio->pin_config) {
+ case ACPI_PIN_CONFIG_PULLUP:
+ return polarity == GPIO_ACTIVE_LOW ? GPIOD_OUT_LOW : GPIOD_OUT_HIGH;
+ case ACPI_PIN_CONFIG_PULLDOWN:
+ return polarity == GPIO_ACTIVE_LOW ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * Assume that the BIOS has configured the direction and pull
+ * accordingly.
+ */
+ return GPIOD_ASIS;
+}
+
+static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
+ struct acpi_resource_gpio *agpio,
+ unsigned int index,
+ const char *label)
+{
+ int polarity = GPIO_ACTIVE_HIGH;
+ enum gpiod_flags flags = acpi_gpio_to_gpiod_flags(agpio, polarity);
+ unsigned int pin = agpio->pin_table[index];
+ struct gpio_desc *desc;
+ int ret;
+
+ desc = gpiochip_request_own_desc(chip, pin, label, polarity, flags);
+ if (IS_ERR(desc))
+ return desc;
+
+ ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout);
+ if (ret)
+ gpiochip_free_own_desc(desc);
+
+ return ret ? ERR_PTR(ret) : desc;
+}
+
 static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in)
 {
  const char *controller, *pin_str;
@@ -290,8 +352,8 @@ static acpi_status acpi_gpiochip_alloc_e
  if (!handler)
   return AE_OK;

- desc = gpiochip_request_own_desc(chip, pin, "ACPI:Event",
- GPIO_ACTIVE_HIGH, GPIOD_IN);
+ desc = acpi_request_own_gpiod(chip, agpio, 0, "ACPI:Event");
+
  if (IS_ERR(desc)) {
   dev_err(chip->parent,
    "Failed to request GPIO for pin 0x%04X, err %ld\n",
@@ -526,39 +588,6 @@ static bool acpi_get_driver_gpio_data(st
  return false;
 }

-static enum gpiod_flags
-acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio)
-{
- switch (agpio->io_restriction) {
- case ACPI_IO_RESTRICT_INPUT:
- return GPIOD_IN;
- case ACPI_IO_RESTRICT_OUTPUT:
- /*
- * ACPI GPIO resources don't contain an initial value for the
- * GPIO. Therefore we deduce that value from the pull field
- * instead. If the pin is pulled up...

wangjun (biggerchina) wrote :

all the changes are extract from the master branch of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git .

Robin Windey (r0wi) wrote :

@Piotr Tomaszewski (nfm886) can confirm my touchpad is the MSFT0001:00 06CB:7F28. I booted kernel 5.10.1 into recovery and then resumed regular boot and my touchpad works.

Piotr Tomaszewski (nfm886) wrote :

@Robin Windey (r0wi), I booted intro recovery mode to the root prompt then systemctl reboot. Nothing changed. Touhchpad still does not works.
My touchpad is: MSFT0001:00 04F3:3140

Robin Windey (r0wi) wrote :

@Piotr Tomaszewski (nfm886) according to #109 it seems like you have the "Elan" touchpad (mine is the "Synaptic" one) so it might behave a little different?

Piotr Tomaszewski (nfm886) wrote :

@Robin Windey (r0wi), maybe. I hope kernel 5.11 will make Elan's touchpad to work.

Helmut Stult (helmut-stult) wrote :

@Piotr Tomaszewski

If you use Manjaro Linux, this link should help you ;-)

https://drive.google.com/drive/folders/1f_gSUdyGZIONSbawBG4h9ED11CO0musP

Otherwise look here (are the two patches and the PKGBUILD)

https://drive.google.com/drive/folders/1chjkq-z-qaCd--ALi2ZGAE7EZW0SA8QH

Helmut (schinfo)

manjaro - ENJOY THE SIMPLICITY

Piotr Tomaszewski (nfm886) wrote :

Thanks @Helmut Stult (helmut-stult), kernel from first link works as it should :)

koen (kmaris) wrote :

Installed ubuntu 20.10 on ARH05, the gpio workaround makes the mouse work.
Left click and right click button works

koen (kmaris) wrote :

Ubuntu 20.10 with kernel :
Linux legion5 5.9.16-050916-generic #202012211331 SMP Mon Dec 21 14:11:13 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Touchpad works without any work around

Someone knows when the patch will be merged in the main repo?
I am using Kubuntu 20.04 LTS with 5.4.0-58-generic kernel and the touchpad is not working and I don't want to start changing the kernel "manually"

Touchpad works on 20.10 and kernel 5.10.2 only after doing that on each start :

cd /sys/class/gpio/
echo 386 > export
gpio]# cd gpio386
echo out > direction

uname -a : Linux Legion 5.10.2-051002-generic #202012210832 SMP Mon Dec 21 13:52:42 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

boudicca (shazh) wrote :

#322 confirmed works as sudo or root

cd /sys/class/gpio/
echo 386 > export
cd gpio386
echo out > direction

boudicca (shazh) wrote :

ignore sudo in #323 echo 386 > export only as root

Coiby Xu (coiby) on 2020-12-25
description: updated
koen (kmaris) wrote :

Touchpad works without workaround on
Ubuntu 20.04 with Kernel 5.9.16
Same goes for ubuntu 20.10.
Easiest way is to use the workaround, install mainline(alternative for ukuu) install kernel 5.9.16
Reboot and relax

Robin Windey (r0wi) wrote :

Had access to another Ideapad with touchpad MSFT0001:00 04F3:3140 installed. Kernel 5.10.2-051002-generic #202012210832 did not work out of the box but in combination with #322 it worked so i can confirm, too.

Hi Kai-Heng Feng,

On Sun, Dec 20, 2020 at 07:30:12AM -0000, Kai-Heng Feng wrote:
>8dcb7a15a585b6d0fee15751ce11d7a68cfedd56 ("gpiolib: acpi: Take into
>account debounce settings") is part of a series with 18 patches, so it's
>safer to only bakcport it for 5.10 kernels.

Although it's part of a patch set, it's rather an independent patch
because it's filling a missing implementation of the ACPI specs. I guess
Windows have already implemented it and that's why the touchpad works
for Windows.

Coiby Xu (coiby) wrote :

Hi Robin Windey (r0wi) and Stéphane Roussel (stephane-roussel),

On Fri, Dec 25, 2020 at 08:52:35PM -0000, Robin Windey wrote:
>Had access to another Ideapad with touchpad MSFT0001:00 04F3:3140
>installed. Kernel 5.10.2-051002-generic #202012210832 did not work out
>of the box but in combination with #322 it worked so i can confirm, too.

We shouldn't use #322 because it's equivalent of keeping polling the
touchpad.

koen (kmaris) wrote :

@robin Windey

I had no luck with kernel 5.10.2, try 5.9.16

wangjun (biggerchina) wrote :

@koen (kmaris) , with kernel 5.10.2 ,you can try #311

wangjun (biggerchina) wrote :

and #311 also work with kernel 5.10.3

Changed in linux (Ubuntu):
assignee: nobody → Phan Thanh Long (phanlong2811)
Robin Windey (r0wi) wrote :

@wangjun (biggerchina) i can confirm that #311 is working without any workarounds when applied on 5.10.3 with touchpad MSFT0001:00 04F3:3140 and Ubuntu 20.04, thanks!

If anyone on a Debian based system is interested: i've uploaded the patched version as .deb-packages here https://drive.google.com/drive/folders/1ICZmuBx3ecwxtwufhSHbYmfnv9Prw-kc?usp=sharing

@Coiby Xu (coiby) Phan Thanh Long (phanlong2811) any chance to get #311 backported to 5.10?

Ethan Reker (abaga129) wrote :

I can also confirm #322 works on manjaro after installing Linux 5.10.rc5.d1122 through the "Manjaro Settings Manager". Thanks!

wangjun (biggerchina) wrote :
Download full text (14.7 KiB)

with kernel 5.10.4 , this patch work on fedora 33.

diff -Narup a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
--- a/drivers/gpio/gpiolib-acpi.c 2020-12-14 06:41:30.000000000 +0800
+++ b/drivers/gpio/gpiolib-acpi.c 2020-12-22 14:31:53.078877000 +0800
@@ -205,6 +205,68 @@ static void acpi_gpiochip_request_irqs(s
   acpi_gpiochip_request_irq(acpi_gpio, event);
 }

+static enum gpiod_flags
+acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio, int polarity)
+{
+ /* GpioInt() implies input configuration */
+ if (agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT)
+ return GPIOD_IN;
+
+ switch (agpio->io_restriction) {
+ case ACPI_IO_RESTRICT_INPUT:
+ return GPIOD_IN;
+ case ACPI_IO_RESTRICT_OUTPUT:
+ /*
+ * ACPI GPIO resources don't contain an initial value for the
+ * GPIO. Therefore we deduce that value from the pull field
+ * and the polarity instead. If the pin is pulled up we assume
+ * default to be high, if it is pulled down we assume default
+ * to be low, otherwise we leave pin untouched. For active low
+ * polarity values will be switched. See also
+ * Documentation/firmware-guide/acpi/gpio-properties.rst.
+ */
+ switch (agpio->pin_config) {
+ case ACPI_PIN_CONFIG_PULLUP:
+ return polarity == GPIO_ACTIVE_LOW ? GPIOD_OUT_LOW : GPIOD_OUT_HIGH;
+ case ACPI_PIN_CONFIG_PULLDOWN:
+ return polarity == GPIO_ACTIVE_LOW ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * Assume that the BIOS has configured the direction and pull
+ * accordingly.
+ */
+ return GPIOD_ASIS;
+}
+
+static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
+ struct acpi_resource_gpio *agpio,
+ unsigned int index,
+ const char *label)
+{
+ int polarity = GPIO_ACTIVE_HIGH;
+ enum gpiod_flags flags = acpi_gpio_to_gpiod_flags(agpio, polarity);
+ unsigned int pin = agpio->pin_table[index];
+ struct gpio_desc *desc;
+ int ret;
+
+ desc = gpiochip_request_own_desc(chip, pin, label, polarity, flags);
+ if (IS_ERR(desc))
+ return desc;
+
+ ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout);
+ if (ret)
+ gpiochip_free_own_desc(desc);
+
+ return ret ? ERR_PTR(ret) : desc;
+}
+
 static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in)
 {
  const char *controller, *pin_str;
@@ -290,8 +352,8 @@ static acpi_status acpi_gpiochip_alloc_e
  if (!handler)
   return AE_OK;

- desc = gpiochip_request_own_desc(chip, pin, "ACPI:Event",
- GPIO_ACTIVE_HIGH, GPIOD_IN);
+ desc = acpi_request_own_gpiod(chip, agpio, 0, "ACPI:Event");
+
  if (IS_ERR(desc)) {
   dev_err(chip->parent,
    "Failed to request GPIO for pin 0x%04X, err %ld\n",
@@ -526,39 +588,6 @@ static bool acpi_get_driver_gpio_data(st
  return false;
 }

-static enum gpiod_flags
-acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio)
-{
- switch (agpio->io_restriction) {
- case ACPI_IO_RESTRICT_INPUT:
- return GPIOD_IN;
- case ACPI_IO_RESTRICT_OUTPUT:
- /*
- * ACPI GPIO resources don't contain an initial value for the
- * GPIO. Therefore we deduce that value from the pull field
- * instead. If the pin is pulled up we assume default to ...

王紫晸 (liliadamth) wrote :

As a rookie, I just want to know how to use it. I just came into contact with Linux and installed ubuntu20.04.1 (20.04.1 with core 5.10.3) on my r7000. Thanks.

Robin Windey (r0wi) wrote :

If you like you can dowload the patched 5.10.3 kernel from the link i posted in #332. Just download the two files and install them via dpkg -i *.deb

Gerald Bachner (geri1403) wrote :

Tested kernel 5.11.rc1 on Manjaro. Touchpad MSFT0001:00 04F3:3140 works out of the box.
Thanks!

王紫晸 (liliadamth) wrote :

@Robin Windey (r0wi)
Thank you very much, it does work. I tried it just now. However, it only works under Nvidia mode (with brightness problems). If I use AMD Graphics mode, it brings a black screen.

Piotr Tomaszewski (nfm886) wrote :

Ubuntu with kernel 5.11-rc2 from mainline - touchpad MSFT0001:00 04F3:3140 Touchpad - works out of the box. There is only problem with nvidia drivers...

Coiby Xu (coiby) wrote :

Hi Mike Boruta (maridius),

> On Sun, Nov 29, 2020 at 08:07:43PM -0000, Mike Boruta wrote:
> >@Coiby Xu (coiby)
> >
> >Hello Coiby, had some time today so I compiled 5.7.19 from ubuntu
> >mainline (https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7.19/) with
> >pinctrl_amd configured as a module, applied the patch in #171, and ran
> >the command you provided:
> >
> >$ sudo cat /sys/kernel/debug/gpio | grep -A1 pin130
> >pin130 Level trigger| Active low| interrupt is enabled| interrupt is unmasked| disable wakeup in S0i3 state| disable wakeup in S3 state|
> > disable wakeup in S4/S5 state| input is high| pull-up is disabled| Pull-down is disabled| output is disabled| 0x51bc8
> >
> Obviously, the patch in #171 didn't take into effect because 0x51bc8 means
> debounce filter is enabled and the debounce timeout is set to 124.8ms.
> So my best guess is
> /lib/modules/`uname -r`/kernel/drivers/pinctrl/pinctrl-amd.ko.xz
> hasn't been replaced by the patched one.

I had the same issue when using Fedora and find out it's caused by the pinctrl-amd driver being stored into the initramfs. Maybe the same thing happened to ubuntu. You can try re-building the initramfs by running `sudo update-initramfs -u' after replacing the old module with the new one.

Coiby Xu (coiby) on 2021-01-05
description: updated
Eamon O Callaghan (eamonoc) wrote :

Thank you everyone for fixing this, I've been following this thread for the last few weeks and today is the first time I've managed to get it working.

For any noobs like me that are on Ubuntu this is the guide that I followed to upgrade to kernel 5.11 and everything works perfectly for me, both the touchpad and the brightness controls.

Upgrade kernel

    Change current directory to /tmp
    cd /tmp

    Download the latest mainline kernel from 5.11.x branch by copying and pasting this:

    wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11-rc2/amd64/linux-headers-5.11.0-051100rc2_5.11.0-051100rc2.202101032030_all.deb
    wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11-rc2/amd64/linux-headers-5.11.0-051100rc2-generic_5.11.0-051100rc2.202101032030_amd64.deb
    wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11-rc2/amd64/linux-image-unsigned-5.11.0-051100rc2-generic_5.11.0-051100rc2.202101032030_amd64.deb
    wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11-rc2/amd64/linux-modules-5.11.0-051100rc2-generic_5.11.0-051100rc2.202101032030_amd64.deb

Install new kernel
sudo dpkg -i *.deb

Reboot the system
sudo shutdown -r now

    Update packages list
    sudo apt-get update

    Upgrade packages
    sudo apt-get upgrade

    Reboot the system if needed
    sudo shutdown -r now

    Check the OS distro
    lsb_release -a

    Check kernel version
    uname -r

That's it, now you should be running on the Linux Kernel 5.11rc2

Guide taken from this wonderful page:
https://sypalo.com/how-to-upgrade-ubuntu

Thanks to everyone for their hard work, sorry for posting this noob guide here but it took me weeks to figure out an easy way to do it (patching was beyond my abilities).

Mike Boruta (maridius) wrote :

Hello Coiby Xu (coiby), thanks a lot for this information! Will definitely try this should I encounter a similar error again; and its just generally good knowledge. Completely forgot about the initramfs.

Von (straeker) wrote :

MSFT0001:00 06CB:7F28 Touchpad works with kernel but it's very difficult to do a middle click using the default hid-i2c driver. middle click and right click works better with i2c-hid_standalone.

Von (straeker) wrote :

*kernel above 5.9

Displaying first 40 and last 40 comments. View all 345 comments or add a comment.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.