From owner-svn-src-head@freebsd.org Tue Jun 2 01:04:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BFB42F8E7E; Tue, 2 Jun 2020 01:04:50 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49bYjZ14x1z4K1L; Tue, 2 Jun 2020 01:04:50 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 064A01482E; Tue, 2 Jun 2020 01:04:50 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05214n8w021741; Tue, 2 Jun 2020 01:04:49 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05214nfQ021740; Tue, 2 Jun 2020 01:04:49 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202006020104.05214nfQ021740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Tue, 2 Jun 2020 01:04:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361718 - in head: share/man/man4 sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/atkbdc X-SVN-Commit-Revision: 361718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2020 01:04:50 -0000 Author: wulf Date: Tue Jun 2 01:04:49 2020 New Revision: 361718 URL: https://svnweb.freebsd.org/changeset/base/361718 Log: [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 MFC after: 1 week Modified: head/share/man/man4/psm.4 head/sys/dev/atkbdc/psm.c Modified: head/share/man/man4/psm.4 ============================================================================== --- head/share/man/man4/psm.4 Tue Jun 2 00:57:48 2020 (r361717) +++ head/share/man/man4/psm.4 Tue Jun 2 01:04:49 2020 (r361718) @@ -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: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Tue Jun 2 00:57:48 2020 (r361717) +++ head/sys/dev/atkbdc/psm.c Tue Jun 2 01:04:49 2020 (r361718) @@ -517,6 +517,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) @@ -2989,6 +2990,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) { @@ -6293,6 +6297,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); @@ -6329,6 +6336,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); }