diff mbox series

elan_i2c trackpad on T480s not reporting as clickpad

Message ID 961c2ef9-7917-2c32-d764-7089d8cb3480@in04.sg (mailing list archive)
State New, archived
Headers show
Series elan_i2c trackpad on T480s not reporting as clickpad | expand

Commit Message

Tee Hao Wei Sept. 6, 2018, 8:01 a.m. UTC
Hi,

I have a Lenovo T480s with an Elantech one-button trackpad (aka clickpad) but
for some reason the kernel is not reporting it as a clickpad.

It appears that the module checks the SM version for a bit and reports it as a
clickpad if the bit is set, but my trackpad is reporting a SM version of 0, so
the flag on L184 here[1] is false.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/tree/drivers/input/mouse/elan_i2c_smbus.c#n168

I am wondering if there is some other flag in some other field that may indicate
this is a clickpad.

Here is the other information reported by the trackpad:

     elan_i2c 6-0015: Elan Touchpad: Module ID: 0x0020, Firmware: 0x0001, Sample: 0x0000, IAP: 0x0000
     elan_i2c 6-0015: Elan Touchpad Extra Information:
                         Max ABS X,Y:   3052,1888
                         Width X,Y:   127,125
                         Resolution X,Y:   31,31 (dots/mm)
                         ic type: 0x20
                         info pattern: 0x0

This crude patch setting `clickpad = 1` works fine on my T480s. I'm pretty sure
there is some way to actually check for a clickpad instead of special-casing this
particular module/product ID.

--

Has anyone else run into this issue, or does anyone know anything about this?

Thanks.

--
Hao Wei

Comments

廖崇榮 Sept. 13, 2018, 9:38 a.m. UTC | #1
Hi Hao Wei,

Sorry for later reply.

I check with FW team, Smbus won’t support information fetch in recent trackpad.
I ever discuss this issue with Linux pro and tell them that all information should be fetched by PS/2 bus
SMbus only for report data

I will check if the fixed patch upaload.

B.R
KT

-----Original Message-----
From: Hao Wei Tee [mailto:angelsl@in04.sg] 
Sent: Thursday, September 06, 2018 4:01 PM
To: linux-input@vger.kernel.org
Cc: 廖崇榮
Subject: elan_i2c trackpad on T480s not reporting as clickpad

Hi,

I have a Lenovo T480s with an Elantech one-button trackpad (aka clickpad) but for some reason the kernel is not reporting it as a clickpad.

It appears that the module checks the SM version for a bit and reports it as a clickpad if the bit is set, but my trackpad is reporting a SM version of 0, so the flag on L184 here[1] is false.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/tree/drivers/input/mouse/elan_i2c_smbus.c#n168

I am wondering if there is some other flag in some other field that may indicate this is a clickpad.

Here is the other information reported by the trackpad:

     elan_i2c 6-0015: Elan Touchpad: Module ID: 0x0020, Firmware: 0x0001, Sample: 0x0000, IAP: 0x0000
     elan_i2c 6-0015: Elan Touchpad Extra Information:
                         Max ABS X,Y:   3052,1888
                         Width X,Y:   127,125
                         Resolution X,Y:   31,31 (dots/mm)
                         ic type: 0x20
                         info pattern: 0x0

This crude patch setting `clickpad = 1` works fine on my T480s. I'm pretty sure there is some way to actually check for a clickpad instead of special-casing this particular module/product ID.

diff --git a/elan_i2c_core.c b/elan_i2c_core.c index f5ae248..718cb19 100644
--- a/elan_i2c_core.c
+++ b/elan_i2c_core.c
@@ -241,6 +241,16 @@ static int elan_check_ASUS_special_fw(struct elan_tp_data *data)
  	return false;
  }

+static void elan_check_clickpad(struct elan_tp_data *data) {
+	if (data->ic_type == 0x20
+		&& data->product_id == 0x20
+		&& data->sm_version == 0) {
+		data->clickpad = 1;
+	}
+	return;
+}
+
  static int __elan_initialize(struct elan_tp_data *data)
  {
  	struct i2c_client *client = data->client; @@ -257,6 +267,8 @@ static int __elan_initialize(struct elan_tp_data *data)
  	if (error)
  		return error;

+	elan_check_clickpad(data);
+
  	/*
  	 * Some ASUS devices were shipped with firmware that requires
  	 * touchpads to be woken up first, before attempting to switch
--

Has anyone else run into this issue, or does anyone know anything about this?

Thanks.

--
Hao Wei
Dmitry Torokhov Sept. 13, 2018, 6:46 p.m. UTC | #2
Hi KT,

On Thu, Sep 13, 2018 at 2:49 AM 廖崇榮 <kt.liao@emc.com.tw> wrote:
>
> Hi Hao Wei,
>
> Sorry for later reply.
>
> I check with FW team, Smbus won’t support information fetch in recent trackpad.
> I ever discuss this issue with Linux pro and tell them that all information should be fetched by PS/2 bus
> SMbus only for report data

Is this true for a particular firmware version, or for all future
firmwares from Elan? What about firmware flash procedure that
implemented in elan_i2c_smbus? Can you enumerate exactly what data
should be fetched via PS/2 access versus SMbus?

I must say it is unfortunately that we are introducing even more
dependencies on PS/2 here...

>
> I will check if the fixed patch upaload.
>
> B.R
> KT
>
> -----Original Message-----
> From: Hao Wei Tee [mailto:angelsl@in04.sg]
> Sent: Thursday, September 06, 2018 4:01 PM
> To: linux-input@vger.kernel.org
> Cc: 廖崇榮
> Subject: elan_i2c trackpad on T480s not reporting as clickpad
>
> Hi,
>
> I have a Lenovo T480s with an Elantech one-button trackpad (aka clickpad) but for some reason the kernel is not reporting it as a clickpad.
>
> It appears that the module checks the SM version for a bit and reports it as a clickpad if the bit is set, but my trackpad is reporting a SM version of 0, so the flag on L184 here[1] is false.
>
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/tree/drivers/input/mouse/elan_i2c_smbus.c#n168
>
> I am wondering if there is some other flag in some other field that may indicate this is a clickpad.
>
> Here is the other information reported by the trackpad:
>
>      elan_i2c 6-0015: Elan Touchpad: Module ID: 0x0020, Firmware: 0x0001, Sample: 0x0000, IAP: 0x0000
>      elan_i2c 6-0015: Elan Touchpad Extra Information:
>                          Max ABS X,Y:   3052,1888
>                          Width X,Y:   127,125
>                          Resolution X,Y:   31,31 (dots/mm)
>                          ic type: 0x20
>                          info pattern: 0x0
>
> This crude patch setting `clickpad = 1` works fine on my T480s. I'm pretty sure there is some way to actually check for a clickpad instead of special-casing this particular module/product ID.
>
> diff --git a/elan_i2c_core.c b/elan_i2c_core.c index f5ae248..718cb19 100644
> --- a/elan_i2c_core.c
> +++ b/elan_i2c_core.c
> @@ -241,6 +241,16 @@ static int elan_check_ASUS_special_fw(struct elan_tp_data *data)
>         return false;
>   }
>
> +static void elan_check_clickpad(struct elan_tp_data *data) {
> +       if (data->ic_type == 0x20
> +               && data->product_id == 0x20
> +               && data->sm_version == 0) {
> +               data->clickpad = 1;
> +       }
> +       return;
> +}
> +
>   static int __elan_initialize(struct elan_tp_data *data)
>   {
>         struct i2c_client *client = data->client; @@ -257,6 +267,8 @@ static int __elan_initialize(struct elan_tp_data *data)
>         if (error)
>                 return error;
>
> +       elan_check_clickpad(data);
> +
>         /*
>          * Some ASUS devices were shipped with firmware that requires
>          * touchpads to be woken up first, before attempting to switch
> --
>
> Has anyone else run into this issue, or does anyone know anything about this?
>
> Thanks.
>
> --
> Hao Wei
>

Thanks.
廖崇榮 Sept. 17, 2018, 6:19 a.m. UTC | #3
Hi Dmitry,

-----Original Message-----
From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] 
Sent: Friday, September 14, 2018 2:47 AM
To: 廖崇榮
Cc: angelsl@in04.sg; linux-input@vger.kernel.org
Subject: Re: elan_i2c trackpad on T480s not reporting as clickpad

Hi KT,

On Thu, Sep 13, 2018 at 2:49 AM 廖崇榮 <kt.liao@emc.com.tw> wrote:
>
> Hi Hao Wei,
>
> Sorry for later reply.
>
> I check with FW team, Smbus won’t support information fetch in recent trackpad.
> I ever discuss this issue with Linux pro and tell them that all 
> information should be fetched by PS/2 bus SMbus only for report data

Is this true for a particular firmware version, or for all future firmwares from Elan? What about firmware flash procedure that implemented in elan_i2c_smbus? Can you enumerate exactly what data should be fetched via PS/2 access versus SMbus?

I must say it is unfortunately that we are introducing even more dependencies on PS/2 here...

Our fw team has removed SMBus command from last year if device's flash size is not sufficient.
Some FW just removed function and keep SMBus communication. It cause no error in SMbus but fetch the wrong information.

We suggest all information should be fetched from PS/2 and SMbus just handle hello package and 32bytes report.

I never try FW update by SMbus, I will try it once I find a test platform.


>
> I will check if the fixed patch upaload.
>
> B.R
> KT
>
> -----Original Message-----
> From: Hao Wei Tee [mailto:angelsl@in04.sg]
> Sent: Thursday, September 06, 2018 4:01 PM
> To: linux-input@vger.kernel.org
> Cc: 廖崇榮
> Subject: elan_i2c trackpad on T480s not reporting as clickpad
>
> Hi,
>
> I have a Lenovo T480s with an Elantech one-button trackpad (aka clickpad) but for some reason the kernel is not reporting it as a clickpad.
>
> It appears that the module checks the SM version for a bit and reports it as a clickpad if the bit is set, but my trackpad is reporting a SM version of 0, so the flag on L184 here[1] is false.
>
> [1]: 
> https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/tree/dr
> ivers/input/mouse/elan_i2c_smbus.c#n168
>
> I am wondering if there is some other flag in some other field that may indicate this is a clickpad.
>
> Here is the other information reported by the trackpad:
>
>      elan_i2c 6-0015: Elan Touchpad: Module ID: 0x0020, Firmware: 0x0001, Sample: 0x0000, IAP: 0x0000
>      elan_i2c 6-0015: Elan Touchpad Extra Information:
>                          Max ABS X,Y:   3052,1888
>                          Width X,Y:   127,125
>                          Resolution X,Y:   31,31 (dots/mm)
>                          ic type: 0x20
>                          info pattern: 0x0
>
> This crude patch setting `clickpad = 1` works fine on my T480s. I'm pretty sure there is some way to actually check for a clickpad instead of special-casing this particular module/product ID.
>
> diff --git a/elan_i2c_core.c b/elan_i2c_core.c index f5ae248..718cb19 
> 100644
> --- a/elan_i2c_core.c
> +++ b/elan_i2c_core.c
> @@ -241,6 +241,16 @@ static int elan_check_ASUS_special_fw(struct elan_tp_data *data)
>         return false;
>   }
>
> +static void elan_check_clickpad(struct elan_tp_data *data) {
> +       if (data->ic_type == 0x20
> +               && data->product_id == 0x20
> +               && data->sm_version == 0) {
> +               data->clickpad = 1;
> +       }
> +       return;
> +}
> +
>   static int __elan_initialize(struct elan_tp_data *data)
>   {
>         struct i2c_client *client = data->client; @@ -257,6 +267,8 @@ static int __elan_initialize(struct elan_tp_data *data)
>         if (error)
>                 return error;
>
> +       elan_check_clickpad(data);
> +
>         /*
>          * Some ASUS devices were shipped with firmware that requires
>          * touchpads to be woken up first, before attempting to switch
> --
>
> Has anyone else run into this issue, or does anyone know anything about this?
>
> Thanks.
>
> --
> Hao Wei
>

Thanks.

--
Dmitry
diff mbox series

Patch

diff --git a/elan_i2c_core.c b/elan_i2c_core.c
index f5ae248..718cb19 100644
--- a/elan_i2c_core.c
+++ b/elan_i2c_core.c
@@ -241,6 +241,16 @@  static int elan_check_ASUS_special_fw(struct elan_tp_data *data)
  	return false;
  }

+static void elan_check_clickpad(struct elan_tp_data *data)
+{
+	if (data->ic_type == 0x20
+		&& data->product_id == 0x20
+		&& data->sm_version == 0) {
+		data->clickpad = 1;
+	}
+	return;
+}
+
  static int __elan_initialize(struct elan_tp_data *data)
  {
  	struct i2c_client *client = data->client;
@@ -257,6 +267,8 @@  static int __elan_initialize(struct elan_tp_data *data)
  	if (error)
  		return error;

+	elan_check_clickpad(data);
+
  	/*
  	 * Some ASUS devices were shipped with firmware that requires
  	 * touchpads to be woken up first, before attempting to switch