From nobody Tue Sep 19 16:45:11 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RqnZv3MVVz4v82q; Tue, 19 Sep 2023 16:45:11 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RqnZv2rp2z4tSl; Tue, 19 Sep 2023 16:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695141911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vpq6eDLhjr478+/gAq60JhRx1oGwq9jWsMmE4dwauhU=; b=lcQ9dc+dOjKv0fVKuFJ/bJyFL2Tw3srpepweeh30dDpGHbBUUXdL3zKSvXU+I759bh0AaI eUBpqRM7d3N3+cdE6rlmi0Lw4u5SQCfVSmH5JqcXaP+1f+CLABkFZpL5tfnQCte0cZNBLZ LN+OmSm26/tdRmlgCO/T/8Aqqi8zqni1sli8lKmvHxycIM5EQpBqHm+JX26BJPHg7uVmpi ieIcOd8V7qI7rxzFznHJwMae7xI/vy3QMjEyWoxBGN4I7L8QQsFlAkZoVbMhvWHrX48sRg Z3tgFCwlAJ1SqJnyekZ9OJ/qeo7yg9eCK5J5BicqA/zT1F86KQzW8TQNHRTNuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695141911; a=rsa-sha256; cv=none; b=mweoP6SSdO1cFojyHpVSbp+OsIGz/9QbSniPZs5O5Reqpan8/gCr9GQsh/70X6/WupPGOH 9DjTfU2M5Jzd/2rsDtHsqxihoqR0BvxtSow1d+XBspfPI47eawTuJYp2mDMGZrtpZKTCpq fuIIUNK10vZ//czhdi1iGFo8iRtrjGQ8dX8d4xj4kyDcNOl/1QbNRpm70jfKXsGhcnZI8K UcmsmWUjO8R42lkavl1nGdCGA4ZJL1ZSpiWPsXTX//1ZCRaMnDY/RtyeRZ3KYGg3mFQX3Y WW8xRZrj7RsVQIh1y2Qu+FkE/OD+I10S41gINHf6MDwStRYE3RhsnQ/GAnV6PA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695141911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vpq6eDLhjr478+/gAq60JhRx1oGwq9jWsMmE4dwauhU=; b=iwZCMsn04aNJdrvmuVBqchVjc0yY/6uu0lBt3PSYTsL5p9hGaP0Eb/JyNJbdbK9WU/YeZq fLqIz+lcievobK6Tm3vWw4ixmxA/eXn1bLOO6H9QwqeSgrt+3ic4f8NuHT9vmwK9/4DS6T 303bikTTXKM5CgT7QtUoJN7MNHpp6wIHYotuZIpXsiVRbQgSOrVXgEyy0VVMmPcIImA2UF bud2QCbJNcbNAO3jrLDU6/erC6a250oEMNqWDW1uLBgz/AgQ3P8Jmsk8onW8l18Dj5lQga +mjMyAuCGVlOWs9GuKlyOoDqLCskUjVqgm7fywo31ckpHHiPkP6IAFGTRAZKtg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RqnZv1qZKz61N; Tue, 19 Sep 2023 16:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38JGjBjB024118; Tue, 19 Sep 2023 16:45:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38JGjBA1024115; Tue, 19 Sep 2023 16:45:11 GMT (envelope-from git) Date: Tue, 19 Sep 2023 16:45:11 GMT Message-Id: <202309191645.38JGjBA1024115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 2bcef59d428a - main - psm: recognize post-IBM trackpoints on Thinkpads List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bcef59d428a672a9144c574b4b4f42f5f0e5b2a Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=2bcef59d428a672a9144c574b4b4f42f5f0e5b2a commit 2bcef59d428a672a9144c574b4b4f42f5f0e5b2a Author: Gleb Smirnoff AuthorDate: 2023-09-19 16:41:04 +0000 Commit: Gleb Smirnoff CommitDate: 2023-09-19 16:41:04 +0000 psm: recognize post-IBM trackpoints on Thinkpads Newer Thinkpads come with trackpoints from different vendors. They are mostly compatible with the original one. Not sure all features are going to work, but at least this fixes resume operation. Tested on: Thinkpad X1 Carbon 7th Gen Reviewed by: wulf, imp Diffrential Revision: https://reviews.FreeBSD.org/D41871 --- sys/dev/atkbdc/psm.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 318112e2e3e5..1a02dbcec020 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -297,6 +297,16 @@ enum { typedef struct trackpointinfo { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; + enum { + TRACKPOINT_VENDOR_IBM = 0x01, + TRACKPOINT_VENDOR_ALPS = 0x02, + TRACKPOINT_VENDOR_ELAN = 0x03, + TRACKPOINT_VENDOR_NXP = 0x04, + TRACKPOINT_VENDOR_JYT = 0x05, + TRACKPOINT_VENDOR_SYNAPTICS = 0x06, + TRACKPOINT_VENDOR_UNKNOWN = 0x07, + } vendor; + int firmware; int sensitivity; int inertia; int uplateau; @@ -431,7 +441,6 @@ struct psm_softc { /* Driver status information */ gesture_t gesture; /* Gesture context */ elantechhw_t elanhw; /* Elantech hardware information */ elantechaction_t elanaction; /* Elantech action context */ - int tphw; /* TrackPoint hardware information */ trackpointinfo_t tpinfo; /* TrackPoint configuration */ mousemode_t mode; /* operation mode */ mousemode_t dflt_mode; /* default operation mode */ @@ -1995,7 +2004,7 @@ psmattach(device_t dev) sc->config |= PSM_CONFIG_INITAFTERSUSPEND; break; default: - if (sc->synhw.infoMajor >= 4 || sc->tphw > 0) + if (sc->synhw.infoMajor >= 4 || sc->tpinfo.sysctl_tree != NULL) sc->config |= PSM_CONFIG_INITAFTERSUSPEND; break; } @@ -6950,7 +6959,7 @@ static int enable_trackpoint(struct psm_softc *sc, enum probearg arg) { KBDC kbdc = sc->kbdc; - int id; + int vendor, firmware; /* * If called from enable_synaptics(), make sure that passthrough @@ -6962,14 +6971,14 @@ enable_trackpoint(struct psm_softc *sc, enum probearg arg) if (sc->synhw.capPassthrough) synaptics_passthrough_on(sc); - if (send_aux_command(kbdc, 0xe1) != PSM_ACK || - read_aux_data(kbdc) != 0x01) + if (send_aux_command(kbdc, 0xe1) != PSM_ACK) goto no_trackpoint; - id = read_aux_data(kbdc); - if (id < 0x01) + vendor = read_aux_data(kbdc); + if (vendor <= 0 || vendor >= TRACKPOINT_VENDOR_UNKNOWN) + goto no_trackpoint; + firmware = read_aux_data(kbdc); + if (firmware < 0x01) goto no_trackpoint; - if (arg == PROBE) - sc->tphw = id; if (!trackpoint_support) goto no_trackpoint; @@ -6983,9 +6992,13 @@ enable_trackpoint(struct psm_softc *sc, enum probearg arg) * a guest device. */ if (!sc->synhw.capPassthrough) { - sc->hw.hwid = id; + sc->hw.hwid = firmware; sc->hw.buttons = 3; } + VDLOG(2, sc->dev, LOG_NOTICE, "Trackpoint v=0x%x f=0x%x", + vendor, firmware); + sc->tpinfo.vendor = vendor; + sc->tpinfo.firmware = firmware; } set_trackpoint_parameters(sc);