Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 2020 22:41:28 +0000 (UTC)
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r362208 - in stable/12: share/man/man4 sys/dev/atkbdc
Message-ID:  <202006152241.05FMfST2042865@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wulf
Date: Mon Jun 15 22:41:28 2020
New Revision: 362208
URL: https://svnweb.freebsd.org/changeset/base/362208

Log:
  MFC r361715:
  
  [psm] Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled
  
  PR:		246117
  Reported by:	Alexander Sieg <ports@xanderio.de>
  
  MFC r361718:
  
  [psm] Workaround active PS/2 multiplexor hang
  
  which happens on some laptops after returning to legacy multiplexing mode
  at initialization stage.
  
  PR:		242542
  Reported by:	Felix Palmen <felix@palmen-it.de>

Modified:
  stable/12/share/man/man4/psm.4
  stable/12/sys/dev/atkbdc/psm.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/psm.4
==============================================================================
--- stable/12/share/man/man4/psm.4	Mon Jun 15 22:35:39 2020	(r362207)
+++ stable/12/share/man/man4/psm.4	Mon Jun 15 22:41:28 2020	(r362208)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 26, 2016
+.Dd June 2, 2020
 .Dt PSM 4
 .Os
 .Sh NAME
@@ -361,6 +361,15 @@ the sysctl with the same name and by restarting
 .Xr moused 8
 using
 .Pa /etc/rc.d/moused .
+.Pp
+Active multiplexing support can be disabled by setting
+.Va hw.psm.mux_disabled
+to
+.Em 1
+at boot-time.
+This will prevent
+.Nm
+from enabling active multiplexing mode needed for some Synaptics touchpads.
 .Sh IOCTLS
 There are a few
 .Xr ioctl 2

Modified: stable/12/sys/dev/atkbdc/psm.c
==============================================================================
--- stable/12/sys/dev/atkbdc/psm.c	Mon Jun 15 22:35:39 2020	(r362207)
+++ stable/12/sys/dev/atkbdc/psm.c	Mon Jun 15 22:41:28 2020	(r362208)
@@ -516,6 +516,7 @@ static int verbose = PSM_DEBUG;
 static int synaptics_support = 1;
 static int trackpoint_support = 1;
 static int elantech_support = 1;
+static int mux_disabled = 0;
 
 /* for backward compatibility */
 #define	OLD_MOUSE_GETHWINFO	_IOR('M', 1, old_mousehw_t)
@@ -2984,6 +2985,9 @@ SYSCTL_INT(_hw_psm, OID_AUTO, trackpoint_support, CTLF
 SYSCTL_INT(_hw_psm, OID_AUTO, elantech_support, CTLFLAG_RDTUN,
     &elantech_support, 0, "Enable support for Elantech touchpads");
 
+SYSCTL_INT(_hw_psm, OID_AUTO, mux_disabled, CTLFLAG_RDTUN,
+    &mux_disabled, 0, "Disable active multiplexing");
+
 static void
 psmintr(void *arg)
 {
@@ -4436,7 +4440,7 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, m
 	*x = *y = *z = 0;
 	ms->button = ms->obutton;
 
-	if (sc->syninfo.touchpad_off)
+	if (sc->syninfo.touchpad_off && pkt != ELANTECH_PKT_TRACKPOINT)
 		return (0);
 
 	/* Common legend
@@ -6252,6 +6256,9 @@ enable_synaptics_mux(struct psm_softc *sc, enum probea
 	int active_ports_count = 0;
 	int active_ports_mask = 0;
 
+	if (mux_disabled != 0)
+		return (FALSE);
+
 	version = enable_aux_mux(kbdc);
 	if (version == -1)
 		return (FALSE);
@@ -6288,6 +6295,21 @@ enable_synaptics_mux(struct psm_softc *sc, enum probea
 
 	/* IRQ handler does not support active multiplexing mode */
 	disable_aux_mux(kbdc);
+
+	/* Is MUX still alive after switching back to legacy mode? */
+	if (!enable_aux_dev(kbdc) || !disable_aux_dev(kbdc)) {
+		/*
+		 * On some laptops e.g. Lenovo X121e dead AUX MUX can be
+		 * brought back to life with resetting of keyboard.
+		 */
+		reset_kbd(kbdc);
+		if (!enable_aux_dev(kbdc) || !disable_aux_dev(kbdc)) {
+			printf("psm%d: AUX MUX hang detected!\n", sc->unit);
+			printf("Consider adding hw.psm.mux_disabled=1 to "
+			    "loader tunables\n");
+		}
+	}
+	empty_both_buffers(kbdc, 10);	/* remove stray data if any */
 
 	return (probe);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006152241.05FMfST2042865>