Bug 249987 - Lenovo X120e touchpad failing
Summary: Lenovo X120e touchpad failing
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-09-29 16:42 UTC by Jason W. Bacon
Modified: 2020-11-20 00:13 UTC (History)
2 users (show)

See Also:


Attachments
disable_mux_probe_on_lenovo.patch (2.60 KB, patch)
2020-11-04 22:14 UTC, Vladimir Kondratyev
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason W. Bacon freebsd_committer 2020-09-29 16:42:11 UTC
Since a few months ago, /dev/psm0 sometimes does not get created on boot and sometimes disappears after boot, often after a suspend/resume cycle.  The only workaround I've found is to power off the machine and restart, which brings back touchpad functionality only sometimes.

I did  fresh 12.2-BETA3 install before filing a PR to see if the issue may have been resolved, but it has not and in fact a new issue has appeared: Tapping no longer works as a left-button click.

I've added hw.psm.mux_disabled=1 per syslog suggestion and will report back after a testing period once I know if it helped.

Data from 12-2-BETA3:

dmesg:

kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model Synaptics Touchpad, device ID 0

dmidecode:

Handle 0x0005, DMI type 8, 9 bytes
Port Connector Information
        Internal Reference Designator: J1900
        Internal Connector Type: None
        External Reference Designator: Touch Pad
        External Connector Type: PS/2
        Port Type: Mouse Port

/var/log/messages:

Sep 28 20:16:55 quagga kernel: psm0: <PS/2 Mouse> irq 12 on atkbdc0
Sep 28 20:16:55 quagga kernel: psm0: [GIANT-LOCKED]
Sep 28 20:16:55 quagga kernel: psm0: model Synaptics Touchpad, device ID 0
Sep 28 20:26:32 quagga kernel: psm0: AUX MUX hang detected!
Sep 28 20:26:32 quagga kernel: Consider adding hw.psm.mux_disabled=1 to loader tunables
Sep 28 20:26:32 quagga kernel: psm0: failed to get status (doinitialize).
Sep 28 20:26:32 quagga kernel: psm0: failed to enable the device (doopen).
Sep 28 20:26:32 quagga kernel: psm0: failed to enable the device (reinitialize).
Comment 1 Jason W. Bacon freebsd_committer 2020-09-30 14:43:07 UTC
More info:

After enabling moused, I found that touchpad tapping actually works in a VT screen, but not in X11.

Behavior is the same in X11 with or without moused, with or without synaptics support enabled.  The basic features all work except for tapping.  This was not an issue under 12.1-RELEASE.
Comment 2 Jason W. Bacon freebsd_committer 2020-10-04 00:58:32 UTC
Update: No change in 12.2-RC1
Comment 3 Jason W. Bacon freebsd_committer 2020-10-04 01:05:17 UTC
Adding hw.psm.mux_disabled=1 to /boot/loader.conf seems to work around the vanishing psm0 issue.  No problems in the last 4 days, which is far longer than psm0 has lasted recently.
Comment 4 Jason W. Bacon freebsd_committer 2020-10-05 16:12:49 UTC
I just upgraded an X201 to 12.2-RC1 and tapping no longer works under Xorg there either.  So the tapping problem seems to be more widespread.
Comment 5 Vladimir Kondratyev freebsd_committer 2020-10-29 08:38:04 UTC
(In reply to Jason W. Bacon from comment #4)
Starting from xorg-server 21 taps are not processed by psm(4) driver anymore. X.Org server does it on its own with xf86-input-synaptics or libinput means. So you should check your DE touchpad preferences as some DE e.g. XFCE sets them wrongly by default.
Also you can return to something close to previous behavior with setting kern.evdev.rcpt_mask=3 in /etc/sysctl.conf but it is not generally recommended.
Comment 6 Jason W. Bacon freebsd_committer 2020-10-29 13:55:47 UTC
I found 2 ways to restore tapping on 12.2:

1. xinput --set-prop 10 'libinput Tapping Enabled' 1

which I added to a script sourced by my Xsession file.

2. Add something like the following to /etc/X11/xorg.conf.d/30-tap.conf.  ( Actual filename is not important as long as it's in xorg.conf.d and readable to all users. )

Section "InputClass"
Identifier "touchpad"
Driver "libinput"
  MatchIsTouchpad "on"
  Option "Tapping" "on"
  Option "NaturalScrolling" "on"
  Option "ClickMethod" "clickfinger"
EndSection

I'm don't understand why tapping is off by default under 12.2 and on under 12.1 when they both use the same Xorg packages.
Comment 7 Jason W. Bacon freebsd_committer 2020-10-29 14:25:22 UTC
(In reply to Vladimir Kondratyev from comment #5)

Thanks for the info, but why would behavior differ between 12.1-RELEASE and 12.2-RC2?

Also, I'm not using 21 yet:

FreeBSD mako.acadix  bacon ~ 1005: pkg info | grep xorg-server
xorg-server-1.20.9,1           X.Org X server and related programs

I'm not up on the internal details of Xorg, but I'm thinking the libinput tweak should work universally.  If I find out otherwise during testing I'll report back.
Comment 8 Vladimir Kondratyev freebsd_committer 2020-10-29 17:40:07 UTC
(In reply to Jason W. Bacon from comment #7)
> why would behavior differ between 12.1-RELEASE and 12.2-RC2?
12.1-RELEASE still has kern.evdev.rcpt_mask=3 by default as it predates xorg-server 1.20 (wrongly mentioned by me as 1.21) import to ports tree. Really, X.Org version does not matter. Evdev-awared xorg autoconfiguration backend was added to server at the same moment, that changed its behavior. Old value of kern.evdev.rcpt_mask sysctl in 12.1-RELEASE just hided that for some time with forcing libinput to get touchpad events through mouse emulation support in psm(4) driver.
Comment 9 Jason W. Bacon freebsd_committer 2020-10-29 18:14:19 UTC
Got it, thanks.

The tapping issue is resolved from my perspective, though I suspect that many would want tapping enabled by default as before.

So back to the original problem, that hw.psm.mux_disabled=1 is needed to make /dev/psm stable.  How might we fix this?
Comment 10 Vladimir Kondratyev freebsd_committer 2020-10-29 18:56:54 UTC
(In reply to Jason W. Bacon from comment #9)
> So back to the original problem, that hw.psm.mux_disabled=1
> is needed to make /dev/psm stable.  How might we fix this?
Most probably, we should blacklist AUX MUX probing on all IBMs/Lenovos based on SMBIOS system maker property. We have had similar problems with Lenovo X121e in the past: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242542

What is 'kenv smbios.system.maker' output of your laptop?
Comment 11 Jason W. Bacon freebsd_committer 2020-10-30 14:13:37 UTC
I've used a few different ThinkPads (T42, T61, X201, T400) and the X120e is the only one with this issue.  Also, the problem only began a few months ago after having no touchpad issues for years, and it's intermittent.

Note that the X120e and X121e are both very low power "ultraportables". Maybe there's something common to this line that provides a clue.

kenv smbios.system.maker
LENOVO

Thanks...
Comment 12 Vladimir Kondratyev freebsd_committer 2020-10-31 23:56:01 UTC
(In reply to Jason W. Bacon from comment #11)
> Maybe there's something common to this line that provides a clue.
They both have unused PS/2 AUX-port multiplexer which stops transfer packets from KBDC to device and vice versa after switching from active to legacy mode.
For Lenovo X121e workaround was found. Resetting of keyboard restores it, but it does not work for X120e.
Comment 13 Jason W. Bacon freebsd_committer 2020-11-01 13:52:34 UTC
Maybe unrelated, but the X120e has always had an issue with starting the keyboard after cold boot. The keyboard does not respond until about 1 second after the first key is pressed.  Any keystrokes entered within that first second are lost.
Comment 14 Vladimir Kondratyev freebsd_committer 2020-11-04 22:14:47 UTC
Created attachment 219363 [details]
disable_mux_probe_on_lenovo.patch

This patch disables AUX MUX probing on LENOVOs by default.

Could you test it?
Comment 15 Jason W. Bacon freebsd_committer 2020-11-11 03:44:58 UTC
(In reply to Vladimir Kondratyev from comment #14)

The patch almost works.  It doesn't apply cleanly to 12.2, but I entered the changes manually where needed.

Also, kbdc->quirks causes a "not a structure member" error.  Based on other code, I guessed you meant kbdcp(kbdc)->quirks.  With that the kernel built cleanly and the patch seems to function.

FreeBSD quagga.acadix  bacon ~ 142: sysctl -a|grep mux
device	kbdmux
kern.evdev.input.0.phys: kbdmux0
hw.psm.mux_enabled: -1
Comment 16 Jason W. Bacon freebsd_committer 2020-11-11 13:17:22 UTC
(In reply to Jason W. Bacon from comment #15)

Also I'd suggest adding a comment to the patch citing the X120e as the sole reason for the quirk, in case someone cares about multiplexing enough to try to make it work on other Lenovos.
Comment 17 commit-hook freebsd_committer 2020-11-20 00:13:57 UTC
A commit references this bug:

Author: wulf
Date: Fri Nov 20 00:13:31 UTC 2020
New revision: 367854
URL: https://svnweb.freebsd.org/changeset/base/367854

Log:
  psm(4): Disable AUX multiplexer probing on all Lenovo laptops.

  Rudimentary AUX multiplexing support was added to kernel to make possible
  touchpad initialization on some HP EliteBook laptops with trackpoint.

  Disable multiplexer probing on all Lenovo laptops now as they use touchpad
  pass-through port rather than AUX multiplexer to connect trackpoint and
  at least two model (X120e and X121e) is known for getting PS/2 AUX port
  dysfunctional after switching back to hidden multiplexing mode.

  AUX MUX probing can be reenabled with setting of hw.psm.mux_disabled loader
  tunable to 0.

  PR:		249987
  Reported by:	jwb
  MFC after:	2 weeks

Changes:
  head/sys/dev/atkbdc/atkbdc.c
  head/sys/dev/atkbdc/atkbdcreg.h
  head/sys/dev/atkbdc/psm.c