Author: wulf
Date: Mon Jun 15 22:43:46 2020
New Revision: 362209
URL: https://svnweb.freebsd.org/changeset/base/362209

Log:
  MFC r361715:
  
  [psm] Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled
  
  PR:           246117
  Reported by:  Alexander Sieg <po...@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 <fe...@palmen-it.de>

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

Modified: stable/11/share/man/man4/psm.4
==============================================================================
--- stable/11/share/man/man4/psm.4      Mon Jun 15 22:41:28 2020        
(r362208)
+++ stable/11/share/man/man4/psm.4      Mon Jun 15 22:43:46 2020        
(r362209)
@@ -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/11/sys/dev/atkbdc/psm.c
==============================================================================
--- stable/11/sys/dev/atkbdc/psm.c      Mon Jun 15 22:41:28 2020        
(r362208)
+++ stable/11/sys/dev/atkbdc/psm.c      Mon Jun 15 22:43:46 2020        
(r362209)
@@ -515,6 +515,7 @@ static int verbose = PSM_DEBUG;
 static int synaptics_support = 0;
 static int trackpoint_support = 0;
 static int elantech_support = 0;
+static int mux_disabled = 0;
 
 /* for backward compatibility */
 #define        OLD_MOUSE_GETHWINFO     _IOR('M', 1, old_mousehw_t)
@@ -2991,6 +2992,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)
 {
@@ -4439,7 +4443,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
@@ -6246,6 +6250,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);
@@ -6282,6 +6289,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);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to