Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp490814lqm; Wed, 1 May 2024 07:03:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8JhxXtX1veiW7Bv0HXvz4pwt/3J3RBc3ZaxE2HDK9vP4svj8N2sHU0TzQr/c6PBQneMudiXlfJn3U/oiWYOut0S+++Ye4/8e3zuFJ3w== X-Google-Smtp-Source: AGHT+IGuOtvbCmRREun5GrnYX2/VihxipSlOeMueViZDeVepuFed2cwqnI1WgSCLyAkwL6Uy0207 X-Received: by 2002:a05:6214:19c8:b0:6a0:cd3e:aeb3 with SMTP id j8-20020a05621419c800b006a0cd3eaeb3mr3194450qvc.32.1714572193745; Wed, 01 May 2024 07:03:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714572193; cv=pass; d=google.com; s=arc-20160816; b=XMWG5N6QW5h3ly1WnJPRaSQcxompytGSxfT/h9P8N68TUwTra1kX86bsnNycnpy1rO nXLnvbVjWMbTstV6tR12vXrDjMyHPRxPxnvuJC93uucZC1r12GCcFCV96v4N20wv48Gc 4wIYfjl3pmb0sIe//nuIEh1Vea8Kr3QJoP530wCsb8bQIDO+wV0vVviA+/L1JFAzcYkC mpjjGY1Dk16FVvBw7Ojn59o2mJz4g/DbaVfmgONPCDuHMT9+f46Mg63kAPRUgtdpujHp HpNxTP9wocqjrER8d0yocMXCM0EceAaThbxr3pgYtLAPGkRZEdmjkOnyorsK7o6sTRTP ztrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=WEz7e1nQ37hCn/3Xwr+FGVChoRELfC0yh3iJRprUV14=; fh=z/NSfuxtm8UYRzEyXqzHdZBiaiZHul8h2KgbwMCN8Vc=; b=xTCFqX6uhPHuJFoiavRXUPefX3CxwVQvjSF0OPfieLVWNN4FFlYQ1ICmmNHrSsdJ5C m4yU0NQ28bg+uU+AizTd9Uud968gPQFft0IU8pcYxYNumz0Kr+soU+b3RxktbRQsu/KM WhsXrSyaqmKFh0ZnWGoEuFsXbY6Iz8fMMm/lEqi9bA9M/Fr0LRCOn64cmGbirL5xJRKM i0ju8Z3WFc9sgxR7VJupoh1DLv+c634pquWIMMKfJ6l0kWz4gMns7v61+BIYRNe/h3W/ oLk5y0e5TKUNVz5pkqzFBvzbiX+xX/+sQCoLWQDDumDSPkC74i0m85VHD2qzBuKkZ6va oxYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OPqw6FoH; arc=pass (i=1 spf=pass spfdomain=flex--jdenose.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-165354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r11-20020a0562140c8b00b006a046b63898si9628211qvr.82.2024.05.01.07.03.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 07:03:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OPqw6FoH; arc=pass (i=1 spf=pass spfdomain=flex--jdenose.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-165354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 740F31C20ADB for ; Wed, 1 May 2024 14:03:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7439812EBEE; Wed, 1 May 2024 14:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OPqw6FoH" Received: from mail-io1-f74.google.com (mail-io1-f74.google.com [209.85.166.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5702212DDB0 for ; Wed, 1 May 2024 14:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714572186; cv=none; b=HJKh7kqLo1RzYJQYJCbuv4gP4xc8pGQSLAlnfE5Vqf7Uu0y5ep6PKKfZh0ro6OT6580kSemHVKN9c3mfqVp1rHALO4oCB9+A4b3aNIVZE0J6ogS8wok+WFhMAg4Fie1RhYDu6NEfxfrsNLIh2VD2SUFHuPYBO9uk+4dCW+Znguk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714572186; c=relaxed/simple; bh=hflhYB4Noj4nERICqWqd6RQ5KHGcpSWf8R1+rSb3bnQ=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=E7KdafJVVmZzUj19wWflvDxiDzivDPw8cb+rMUmZYMqdTU7gzASJ/zcfGKjU3ZKAaF3Epo0Xa6NutVAPDzWWIs3//9WewP8uCaExEpWyjGB9NCtZikERVVlc94LncP7KWhpW2vl726rNBYvrd//KkDX5fR6w2vLVK0a/vKRJ6Hk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jdenose.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=OPqw6FoH; arc=none smtp.client-ip=209.85.166.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jdenose.bounces.google.com Received: by mail-io1-f74.google.com with SMTP id ca18e2360f4ac-7dabc125bddso740663139f.1 for ; Wed, 01 May 2024 07:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714572184; x=1715176984; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=WEz7e1nQ37hCn/3Xwr+FGVChoRELfC0yh3iJRprUV14=; b=OPqw6FoHZzr/b7RVyXVf9O2zlSARYPggemxysk6k1oDULs2scfW7pnDbT0DonJeUqW qXPx2WEz3lWL0Q7bpqswqLMCI67hxm6JNMNItHnMojU5zcc2TZYkN7Np0ayvuH1vWA/A 5zFSrEdcoacb7rBsGsTRtetGgOk8zj/b5YqJPXUBCTOOJvdwzOkFlbWIOOKoSaYS6gLE ZSrl6kjRcv6gzzcnj825RwwC4Mu1ymTlJjkZBt+GvgJi0j2W6E1KLoMVSnDgX5u/Ib97 utIsPhTrl+txJWndBXXsO7tHTPmLrV7DNpkDnJuejJsE8n3LXYbY4mXVMEHAs4V2oARC e/4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714572184; x=1715176984; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=WEz7e1nQ37hCn/3Xwr+FGVChoRELfC0yh3iJRprUV14=; b=n6BfYtHEsGxl8CjZvVQX5fS0WoM3g/jtdNR771CCUfEbP/AsHEQCEpdj64EIar1kkR HDoOe50XXos5kk0Zo50h419fZz+zlhUZlFNigHUvBQn2R6UxadW/S5LAAxfzSyxMz5X1 iox8WrJ6oj9bNLzNpiHzAfiSU14TDKu93Jp/WsqwF89wNss+gU//nfgD/XSWtpjYu4VH /01i0bbJQM5/XDjqLfyZF0acJmtfPNVp8qjm6AcuFmRThl4VxoedHlSozGhWSMIp3Y4I eWiSdYWvS4HmHoyfdwX5sQpkG+dGLp0/C90ObIRd2WLs8xfAdEcARX57/zqj36o82NkM qqHw== X-Gm-Message-State: AOJu0YxivOssY/ukBgR8Rigu48iK0CZae8u3JLCn8RDbi33Z77UglCCA PLzWujmmLEyunu5rZposy3zxQVyrx73zQ849D3dAWD7Knt7lADfvkuhO91m42D05/DATsSa43Jt Cr4NNPBEU4GnKLiPMGo7kxS95fdj4NYbrhGaFpoX5kB8klt7sqJwg83Y9dz3VF2j4WOYtJVoT2q uKzJ/IspMcv3y5MrEKIMXuMLG9kZrD6FLl6e8MKlqYbVx8rw== X-Received: from dynamight.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:17a]) (user=jdenose job=sendgmr) by 2002:a05:6638:8c15:b0:487:8cf0:df03 with SMTP id jl21-20020a0566388c1500b004878cf0df03mr77559jab.5.1714572184397; Wed, 01 May 2024 07:03:04 -0700 (PDT) Date: Wed, 1 May 2024 14:02:32 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog Message-ID: <20240501140231.1.Ifa0e25ebf968d8f307f58d678036944141ab17e6@changeid> Subject: [PATCH] Input: elantech - fix touchpad state on resume for Lenovo N24 From: Jonathan Denose To: LKML Cc: linux-input@vger.kernel.org, Jonathan Denose , Dmitry Torokhov , Greg Kroah-Hartman , Jeffery Miller Content-Type: text/plain; charset="UTF-8" The Lenovo N24 on resume becomes stuck in a state where it sends incorrect packets, causing elantech_packet_check_v4 to fail. The only way for the device to resume sending the correct packets is for it to be disabled and then re-enabled. This change adds a dmi check to trigger this behavior on resume. Signed-off-by: Jonathan Denose --- drivers/input/mouse/elantech.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 4e38229404b4b..e0f3095b4227e 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -1476,6 +1476,23 @@ static void elantech_disconnect(struct psmouse *psmouse) psmouse->private = NULL; } +/* + * Some hw_version 4 models fail to properly activate absolute mode on + * resume without going through disable/enable cycle. + */ +static const struct dmi_system_id elantech_needs_reenable[] = { +#if defined(CONFIG_DMI) && defined(CONFIG_X86) + { + /* Lenovo N24 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "81AF"), + }, + }, +#endif + { } +}; + /* * Put the touchpad back into absolute mode when reconnecting */ @@ -1486,6 +1503,22 @@ static int elantech_reconnect(struct psmouse *psmouse) if (elantech_detect(psmouse, 0)) return -1; + if (dmi_check_system(elantech_needs_reenable)) { + int err; + + err = ps2_sendbyte(&psmouse->ps2dev, PSMOUSE_CMD_DISABLE, NULL); + + if (err) + psmouse_warn(psmouse, "Failed to deactivate mouse on %s: %d\n", + psmouse->ps2dev.serio->phys, err); + + err = ps2_sendbyte(&psmouse->ps2dev, PSMOUSE_CMD_ENABLE, NULL); + + if (err) + psmouse_warn(psmouse, "Failed to reactivate mouse on %s: %d\n", + psmouse->ps2dev.serio->phys, err); + } + if (elantech_set_absolute_mode(psmouse)) { psmouse_err(psmouse, "failed to put touchpad back into absolute mode.\n"); -- 2.45.0.rc0.197.gbae5840b3b-goog