linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: fix Cypress PS/2 Trackpad in Dell XPS12
@ 2013-02-21 18:55 Kamal Mostafa
  2013-02-21 19:56 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Kamal Mostafa @ 2013-02-21 18:55 UTC (permalink / raw)
  To: linux-input, linux-kernel, Dmitry Torokhov, Henrik Rydberg
  Cc: Dudley Du, Kamal Mostafa, Kyle Fazzari

Avoid firmware glitch in Cypress PS/2 Trackpad firmware version 11
(as observed in Dell XPS12) which prevents driver from recognizing
the trackpad.

BugLink: http://launchpad.net/bugs/1103594

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Cc: Dudley Du <dudl@cypress.com>
---
 drivers/input/mouse/cypress_ps2.c |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index 1673dc6..f51765f 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -236,6 +236,13 @@ static int cypress_read_fw_version(struct psmouse *psmouse)
 	cytp->fw_version = param[2] & FW_VERSION_MASX;
 	cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0;
 
+	/*
+	 * Trackpad fw_version 11 (in Dell XPS12) yields a bogus response to
+	 * CYTP_CMD_READ_TP_METRICS so do not try to use it. LP: #1103594.
+	 */
+	if (cytp->fw_version >= 11)
+		cytp->tp_metrics_supported = 0;
+
 	psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version);
 	psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n",
 		 cytp->tp_metrics_supported);
@@ -258,6 +265,9 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
 	cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width;
 	cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high;
 
+	if (!cytp->tp_metrics_supported)
+		return 0;
+
 	memset(param, 0, sizeof(param));
 	if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) {
 		/* Update trackpad parameters. */
@@ -315,18 +325,15 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
 
 static int cypress_query_hardware(struct psmouse *psmouse)
 {
-	struct cytp_data *cytp = psmouse->private;
 	int ret;
 
 	ret = cypress_read_fw_version(psmouse);
 	if (ret)
 		return ret;
 
-	if (cytp->tp_metrics_supported) {
-		ret = cypress_read_tp_metrics(psmouse);
-		if (ret)
-			return ret;
-	}
+	ret = cypress_read_tp_metrics(psmouse);
+	if (ret)
+		return ret;
 
 	return 0;
 }
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: fix Cypress PS/2 Trackpad in Dell XPS12
  2013-02-21 18:55 [PATCH] Input: fix Cypress PS/2 Trackpad in Dell XPS12 Kamal Mostafa
@ 2013-02-21 19:56 ` Dmitry Torokhov
  2013-02-21 20:02   ` Kamal Mostafa
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2013-02-21 19:56 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: linux-input, linux-kernel, Henrik Rydberg, Dudley Du,
	Kyle Fazzari

On Thu, Feb 21, 2013 at 10:55:55AM -0800, Kamal Mostafa wrote:
> Avoid firmware glitch in Cypress PS/2 Trackpad firmware version 11
> (as observed in Dell XPS12) which prevents driver from recognizing
> the trackpad.
> 
> BugLink: http://launchpad.net/bugs/1103594
> 
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> Cc: Dudley Du <dudl@cypress.com>
> ---
>  drivers/input/mouse/cypress_ps2.c |   19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
> index 1673dc6..f51765f 100644
> --- a/drivers/input/mouse/cypress_ps2.c
> +++ b/drivers/input/mouse/cypress_ps2.c
> @@ -236,6 +236,13 @@ static int cypress_read_fw_version(struct psmouse *psmouse)
>  	cytp->fw_version = param[2] & FW_VERSION_MASX;
>  	cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0;
>  
> +	/*
> +	 * Trackpad fw_version 11 (in Dell XPS12) yields a bogus response to
> +	 * CYTP_CMD_READ_TP_METRICS so do not try to use it. LP: #1103594.
> +	 */
> +	if (cytp->fw_version >= 11)
> +		cytp->tp_metrics_supported = 0;
> +

Isn't this the only chunk that is actually needed to fix the issue?

Thanks.

>  	psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version);
>  	psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n",
>  		 cytp->tp_metrics_supported);
> @@ -258,6 +265,9 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
>  	cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width;
>  	cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high;
>  
> +	if (!cytp->tp_metrics_supported)
> +		return 0;
> +
>  	memset(param, 0, sizeof(param));
>  	if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) {
>  		/* Update trackpad parameters. */
> @@ -315,18 +325,15 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
>  
>  static int cypress_query_hardware(struct psmouse *psmouse)
>  {
> -	struct cytp_data *cytp = psmouse->private;
>  	int ret;
>  
>  	ret = cypress_read_fw_version(psmouse);
>  	if (ret)
>  		return ret;
>  
> -	if (cytp->tp_metrics_supported) {
> -		ret = cypress_read_tp_metrics(psmouse);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = cypress_read_tp_metrics(psmouse);
> +	if (ret)
> +		return ret;
>  
>  	return 0;
>  }
> -- 
> 1.7.10.4
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: fix Cypress PS/2 Trackpad in Dell XPS12
  2013-02-21 19:56 ` Dmitry Torokhov
@ 2013-02-21 20:02   ` Kamal Mostafa
  2013-02-21 21:09     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Kamal Mostafa @ 2013-02-21 20:02 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-kernel, Henrik Rydberg, Dudley Du,
	Kyle Fazzari

[-- Attachment #1: Type: text/plain, Size: 2900 bytes --]

On Thu, 2013-02-21 at 11:56 -0800, Dmitry Torokhov wrote:
> On Thu, Feb 21, 2013 at 10:55:55AM -0800, Kamal Mostafa wrote:
> > Avoid firmware glitch in Cypress PS/2 Trackpad firmware version 11
> > (as observed in Dell XPS12) which prevents driver from recognizing
> > the trackpad.
> > 
> > BugLink: http://launchpad.net/bugs/1103594
> > 
> > Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> > Cc: Dudley Du <dudl@cypress.com>
> > ---
> >  drivers/input/mouse/cypress_ps2.c |   19 +++++++++++++------
> >  1 file changed, 13 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
> > index 1673dc6..f51765f 100644
> > --- a/drivers/input/mouse/cypress_ps2.c
> > +++ b/drivers/input/mouse/cypress_ps2.c
> > @@ -236,6 +236,13 @@ static int cypress_read_fw_version(struct psmouse *psmouse)
> >  	cytp->fw_version = param[2] & FW_VERSION_MASX;
> >  	cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0;
> >  
> > +	/*
> > +	 * Trackpad fw_version 11 (in Dell XPS12) yields a bogus response to
> > +	 * CYTP_CMD_READ_TP_METRICS so do not try to use it. LP: #1103594.
> > +	 */
> > +	if (cytp->fw_version >= 11)
> > +		cytp->tp_metrics_supported = 0;
> > +
> 
> Isn't this the only chunk that is actually needed to fix the issue?

No, the other parts are needed also:  The handling of
tp_metrics_supported gets moved so that the default values now get set
first, then overridden only if tp_metrics_supported is true.
Previously, the defaults wouldn't get set if it wasn't true (which was a
bug that never manifested).

 -Kamal


> Thanks.
> 
> >  	psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version);
> >  	psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n",
> >  		 cytp->tp_metrics_supported);
> > @@ -258,6 +265,9 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
> >  	cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width;
> >  	cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high;
> >  
> > +	if (!cytp->tp_metrics_supported)
> > +		return 0;
> > +
> >  	memset(param, 0, sizeof(param));
> >  	if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) {
> >  		/* Update trackpad parameters. */
> > @@ -315,18 +325,15 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
> >  
> >  static int cypress_query_hardware(struct psmouse *psmouse)
> >  {
> > -	struct cytp_data *cytp = psmouse->private;
> >  	int ret;
> >  
> >  	ret = cypress_read_fw_version(psmouse);
> >  	if (ret)
> >  		return ret;
> >  
> > -	if (cytp->tp_metrics_supported) {
> > -		ret = cypress_read_tp_metrics(psmouse);
> > -		if (ret)
> > -			return ret;
> > -	}
> > +	ret = cypress_read_tp_metrics(psmouse);
> > +	if (ret)
> > +		return ret;
> >  
> >  	return 0;
> >  }
> > -- 
> > 1.7.10.4
> > 
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: fix Cypress PS/2 Trackpad in Dell XPS12
  2013-02-21 20:02   ` Kamal Mostafa
@ 2013-02-21 21:09     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2013-02-21 21:09 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: linux-input, linux-kernel, Henrik Rydberg, Dudley Du,
	Kyle Fazzari

On Thu, Feb 21, 2013 at 12:02:46PM -0800, Kamal Mostafa wrote:
> On Thu, 2013-02-21 at 11:56 -0800, Dmitry Torokhov wrote:
> > On Thu, Feb 21, 2013 at 10:55:55AM -0800, Kamal Mostafa wrote:
> > > Avoid firmware glitch in Cypress PS/2 Trackpad firmware version 11
> > > (as observed in Dell XPS12) which prevents driver from recognizing
> > > the trackpad.
> > > 
> > > BugLink: http://launchpad.net/bugs/1103594
> > > 
> > > Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> > > Cc: Dudley Du <dudl@cypress.com>
> > > ---
> > >  drivers/input/mouse/cypress_ps2.c |   19 +++++++++++++------
> > >  1 file changed, 13 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
> > > index 1673dc6..f51765f 100644
> > > --- a/drivers/input/mouse/cypress_ps2.c
> > > +++ b/drivers/input/mouse/cypress_ps2.c
> > > @@ -236,6 +236,13 @@ static int cypress_read_fw_version(struct psmouse *psmouse)
> > >  	cytp->fw_version = param[2] & FW_VERSION_MASX;
> > >  	cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0;
> > >  
> > > +	/*
> > > +	 * Trackpad fw_version 11 (in Dell XPS12) yields a bogus response to
> > > +	 * CYTP_CMD_READ_TP_METRICS so do not try to use it. LP: #1103594.
> > > +	 */
> > > +	if (cytp->fw_version >= 11)
> > > +		cytp->tp_metrics_supported = 0;
> > > +
> > 
> > Isn't this the only chunk that is actually needed to fix the issue?
> 
> No, the other parts are needed also:  The handling of
> tp_metrics_supported gets moved so that the default values now get set
> first, then overridden only if tp_metrics_supported is true.
> Previously, the defaults wouldn't get set if it wasn't true (which was a
> bug that never manifested).

OK, fair enough.

BTW, can you tell me what server you published your PGP key to? It does
not seem to be present on the usual ones...

Thanks,
Dmitry

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-21 21:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-21 18:55 [PATCH] Input: fix Cypress PS/2 Trackpad in Dell XPS12 Kamal Mostafa
2013-02-21 19:56 ` Dmitry Torokhov
2013-02-21 20:02   ` Kamal Mostafa
2013-02-21 21:09     ` Dmitry Torokhov

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