Received: by 2002:ab2:7a09:0:b0:1f8:46dc:890e with SMTP id k9csp90777lqo; Wed, 15 May 2024 08:31:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVczafMj2hQ6jQgelL3o6cOWiSBsYttUIlDPum2vn7SdXAwnlbjbcA8m7RFuV3QQdAs06E65yJBbRYD7rS11CQSP+2+1E2OjuG8kLlKMw== X-Google-Smtp-Source: AGHT+IH8lQLXMsYVZphln/+UNrYwQ0g9xRxCdiILJYifOzqrdnYoUlhUHJW5iJ2EvdZdkXqZvYui X-Received: by 2002:a17:90a:c7ce:b0:2b8:c813:1696 with SMTP id 98e67ed59e1d1-2b8c8132169mr9664486a91.10.1715787070699; Wed, 15 May 2024 08:31:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715787070; cv=pass; d=google.com; s=arc-20160816; b=q02aPR5iINA5X/pUUhVXDOPQq4VFj7OvgDYGDqQk61OcFq67+sxyZ0RInlzMTuUbf2 UVsquM4z6J/mo+InyWXJOkIMe3kU0snlM6jQcE4YtOOiHxyBtz81qJpixyu5W5ssG0m8 upUm+WXhILAqJzczDTI7TLpk1KVAko7ZPK2APw7SdXMkk9vF+aOQePxNb0QrDouyPTMo QAt3KhhiMuoNQ0/vkEVdXF0yR1DjGDZyYoI3aHv/4laSuLq2I4A0+HBR2qy/d37gQ/UY C3+QZclH33HK/DEg9crtdnWRpQBBZgC2phbPBmO3RvED+kgp2ci0yQqojPSWoCT6xDuc 6w2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=wWQRenWjdpHYMXaannQIn7Uf7C7Qw+cYZ1N3+xFMxeM=; fh=vf0+Fc6Oa+SkICaL6RME2guxpEcisVKoF3CCk4HbZbU=; b=sNIH2ZpopxmWItcc5gItLoYcYnZS6J1HzH7M5qVgBfWlw2gqPI4gaZqWBrTuE40he9 7TajZhGLnTF++Nv07LsrZLLdr+705NjOB3vhxyTKIGhDOheMqvrV/8s+4HCeUeda2Si3 i+ub70iYVjo1Fg6rZe8gn7B9kHYinxPE0Z+H6AsRqpNxmRCqZPfdrbBk5ykr7nL8FjwW xrrVB32+dclApfNXl2sqxatToOZm8S0QZF2Rw2rp/S+MFyT4WN+K1T3JCMBahc0MjDFC L3ZGx0EQLb3NULTIT7KixPH8CMK746TKG0F1M6KEgXi7XDskCIHNtWB6rJCPnOhNYDx7 ZS0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Cg70LgCK; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-180074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180074-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b6d3647b0csi12748633a91.6.2024.05.15.08.31.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 08:31:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Cg70LgCK; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-180074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180074-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 35CBE284960 for ; Wed, 15 May 2024 15:30:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E016155A56; Wed, 15 May 2024 15:30:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Cg70LgCK" Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 5E4EE155723 for ; Wed, 15 May 2024 15:30:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715787013; cv=none; b=AKw1Nsv79i0CdgcUhEyxAJN19I6WSqBNCzoaXmiFIBGVPJDtzUuyavAYeCTFcBzyXNiaCYHBkPSH6L5CvlZzUGvtcMzJ+sIszTeoU/fVuGqXsC1KzuzpEi7/2LBrYYEh0sFvDR3BZO8iSkhEbP6vVJu7L47j/7CUqxABIUOMELU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715787013; c=relaxed/simple; bh=iN8matYjyvj8EmXmPi1mXOrlyGDmDH19/5Kdt0+yZnw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=JdjL1K3/pq6IXG58NkmSG8f9wJfrZui/G+IpPQCGwc3dnUFI/sDB7zkTqo50qHHgBEYUprwwRIwYPs+0OanpRL3EkelKASq3S3Wr56ZLsFwz9IwaYJf+NJojh0TqLjYRFkhlzcLaAjvxpv2FdDSUHfSHxqQazTRjgrQEdg373og= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Cg70LgCK; arc=none smtp.client-ip=209.85.160.180 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=google.com Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-43dfa9a98d2so767981cf.1 for ; Wed, 15 May 2024 08:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715787010; x=1716391810; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wWQRenWjdpHYMXaannQIn7Uf7C7Qw+cYZ1N3+xFMxeM=; b=Cg70LgCKhsiiTD6OG0VZUNlLHjaIijTPnLTa+9hM6u6KCDJdyRmmqE3JDwKijlPjYW gdQ8RzpNhsxO+Wc5Rpfyyb9Ane8QbQ+OR/H9tXadZOhYkHsvXoAV91CP080mL9LeZ+Ww ybLnfwfgzo5/5F+mavAZ7RHD/vMVuztVMG9kR67kxKwmiAuzQhVMhj+3E5+gAf9nyU0M hBWUufY5fp3u5RTeD7H4HgOrEbif+bkAULrwBJ8BtpS/Cm/bMLXLccVBvOhWKDcyiS/x PV9zveW2nUVTxMt6cAPS2r2vK6jLrFzqwWbCS8gLjfWzW4T9zIP5pnXqgCtnCwHG16So cVUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715787010; x=1716391810; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wWQRenWjdpHYMXaannQIn7Uf7C7Qw+cYZ1N3+xFMxeM=; b=kLOwKKfcfhH6gpDPuNYzJCV/wNLQKZrbhbV8jSynd4qvd3N5RxkfBTP+pBmGnaw+lu pKYDSEfjFPFEP0eqA/3ojVcOAjLV1UU7rBsEsAZibq2KM865s99Ie6IIPymExv/7NTto dk2sZCjwvfIANFrxZZ42akmsRPPmqpVBnbT8yFeJBxHbq2uAE4NpeYGB3tbKnUblx3fv DGDKiYxhL14ZkQm9tTSHanvBusGRE2joqv8CX9AU5snWzsKr425z8qDKlnzA/q/pu0Nj zZoiE7ddRea8O9ebFiaTGFUuSSVAOdTJC2g+CZBXzkO4b3ZZxXmdZEqpwxGFlWyPhWX5 jcRw== X-Forwarded-Encrypted: i=1; AJvYcCXZYkxpfhuvpqx+TZQYUzcRPNLhMX/twXApzreeW3LuBew7XvXLgHWW0li4w1jbWBO1jDGrgpk+7xy0m1dPih4PfH6LzPd4y7kE51s5 X-Gm-Message-State: AOJu0Yx1pinct8/VIAJNKm4Lq7gv7WLlMKXKQWVuWO6apSQrSm8aiYUg AnW33N66jL5UydWYhdbcAnvqOxNtlYtEyq7ZT+2WFhgBKp0TVOi7qTg9Z3qag1gwDCkEjpE3753 e+9nD7QebsHq3muM40ppkz21b7OYd7hQEnh8Y X-Received: by 2002:a05:622a:1dcb:b0:43d:dfa2:216f with SMTP id d75a77b69052e-43e094d0189mr11430441cf.6.1715787010055; Wed, 15 May 2024 08:30:10 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240503155020.v2.1.Ifa0e25ebf968d8f307f58d678036944141ab17e6@changeid> In-Reply-To: <20240503155020.v2.1.Ifa0e25ebf968d8f307f58d678036944141ab17e6@changeid> From: Jonathan Denose Date: Wed, 15 May 2024 10:29:58 -0500 Message-ID: Subject: Re: [PATCH v2] Input: elantech - fix touchpad state on resume for Lenovo N24 To: dmitry.torokhov@gmail.com Cc: gregkh@linuxfoundation.org, jefferymiller@google.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 3, 2024 at 11:12=E2=80=AFAM Jonathan Denose wrote: > > 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 > --- > > Changes in v2: > - change ps2_sendbyte() calls to ps2_command() > > drivers/input/mouse/elantech.c | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantec= h.c > index 4e38229404b4b..18f26315cae25 100644 > --- a/drivers/input/mouse/elantech.c > +++ b/drivers/input/mouse/elantech.c > @@ -1476,6 +1476,23 @@ static void elantech_disconnect(struct psmouse *ps= mouse) > psmouse->private =3D 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[] =3D { > +#if defined(CONFIG_DMI) && defined(CONFIG_X86) > + { > + /* Lenovo N24 */ > + .matches =3D { > + 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 *psmo= use) > if (elantech_detect(psmouse, 0)) > return -1; > > + if (dmi_check_system(elantech_needs_reenable)) { > + int err; > + > + err =3D ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_D= ISABLE); > + > + if (err) > + psmouse_warn(psmouse, "Failed to deactivate mouse= on %s: %d\n", > + psmouse->ps2dev.serio->phys, err)= ; > + > + err =3D ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_E= NABLE); > + > + 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 mo= de.\n"); > -- > 2.45.0.rc1.225.g2a3ae87e7f-goog > Hello, Is there anything else needed from me? --=20 Jonathan