linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Phoenix" <phoenix@emc.com.tw>
To: "'Dmitry Torokhov'" <dmitry.torokhov@gmail.com>,
	"'Jonathan Denose'" <jdenose@google.com>
Cc: "'LKML'" <linux-kernel@vger.kernel.org>,
	<linux-input@vger.kernel.org>,
	"'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>,
	"'Jeffery Miller'" <jefferymiller@google.com>,
	"'Hans de Goede'" <hdegoede@redhat.com>,
	"'Josh.Chen'" <josh.chen@emc.com.tw>, <jingle.wu@emc.com.tw>
Subject: RE: [PATCH] Input: elantech - fix touchpad state on resume for Lenovo N24
Date: Thu, 2 May 2024 18:52:54 +0800	[thread overview]
Message-ID: <003301da9c7e$e28cedb0$a7a6c910$@emc.com.tw> (raw)
In-Reply-To: <ZjKV44wZWH4MBCrF@google.com>

Loop Josh, Jingle

-----Original Message-----
From: Dmitry Torokhov <dmitry.torokhov@gmail.com> 
Sent: Thursday, May 2, 2024 3:20 AM
To: Jonathan Denose <jdenose@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>; linux-input@vger.kernel.org; Greg
Kroah-Hartman <gregkh@linuxfoundation.org>; Jeffery Miller
<jefferymiller@google.com>; Phoenix Huang <phoenix@emc.com.tw>; Hans de
Goede <hdegoede@redhat.com>
Subject: Re: [PATCH] Input: elantech - fix touchpad state on resume for
Lenovo N24

On Wed, May 01, 2024 at 02:02:32PM +0000, 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 <jdenose@google.com>

Adding a couple more folks to take a look at this...

> ---
> 
>  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
> 

-- 
Dmitry


  reply	other threads:[~2024-05-02 10:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01 14:02 [PATCH] Input: elantech - fix touchpad state on resume for Lenovo N24 Jonathan Denose
2024-05-01 19:20 ` Dmitry Torokhov
2024-05-02 10:52   ` Phoenix [this message]
2024-05-02 17:29 ` kernel test robot
2024-05-02 19:03 ` kernel test robot
2024-05-02 19:57 ` kernel test robot
2024-05-02 23:13 ` Dmitry Torokhov
2024-05-03 16:12   ` [PATCH v2] " Jonathan Denose
2024-05-15 15:29     ` Jonathan Denose
2024-05-15 22:28       ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003301da9c7e$e28cedb0$a7a6c910$@emc.com.tw' \
    --to=phoenix@emc.com.tw \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=jdenose@google.com \
    --cc=jefferymiller@google.com \
    --cc=jingle.wu@emc.com.tw \
    --cc=josh.chen@emc.com.tw \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).