diff mbox

Input: ALPS - Report v3 pinnacle trackstick device only if is present

Message ID 1427032068-13066-1-git-send-email-pali.rohar@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Pali Rohár March 22, 2015, 1:47 p.m. UTC
This patch move v3 pinnacle code for trackstick detection from alps_hw_init_v3()
to alps_set_protocol() so ALPS_DUALPOINT flag can be cleared before registering
trackstick input device in kernel.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/input/mouse/alps.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Hans de Goede March 23, 2015, 11:42 a.m. UTC | #1
Hi,

On 22-03-15 14:47, Pali Rohár wrote:
> This patch move v3 pinnacle code for trackstick detection from alps_hw_init_v3()
> to alps_set_protocol() so ALPS_DUALPOINT flag can be cleared before registering
> trackstick input device in kernel.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>

Looks good:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>   drivers/input/mouse/alps.c |   12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index c9cd27a..d24e98d 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -1877,15 +1877,12 @@ error:
>
>   static int alps_hw_init_v3(struct psmouse *psmouse)
>   {
> +	struct alps_data *priv = psmouse->private;
>   	struct ps2dev *ps2dev = &psmouse->ps2dev;
>   	int reg_val;
>   	unsigned char param[4];
>
> -	reg_val = alps_probe_trackstick_v3_v7(psmouse, ALPS_REG_BASE_PINNACLE);
> -	if (reg_val == -EIO)
> -		goto error;
> -
> -	if (reg_val == 0 &&
> +	if ((priv->flags & ALPS_DUALPOINT) &&
>   	    alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
>   		goto error;
>
> @@ -2249,6 +2246,11 @@ static int alps_set_protocol(struct psmouse *psmouse,
>   		priv->decode_fields = alps_decode_pinnacle;
>   		priv->nibble_commands = alps_v3_nibble_commands;
>   		priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
> +
> +		if (alps_probe_trackstick_v3_v7(psmouse,
> +						ALPS_REG_BASE_PINNACLE) < 0)
> +			priv->flags &= ~ALPS_DUALPOINT;
> +
>   		break;
>
>   	case ALPS_PROTO_V3_RUSHMORE:
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pali Rohár Jan. 5, 2016, 4:54 p.m. UTC | #2
On Monday 23 March 2015 12:42:25 Hans de Goede wrote:
> Hi,
> 
> On 22-03-15 14:47, Pali Rohár wrote:
> >This patch move v3 pinnacle code for trackstick detection from alps_hw_init_v3()
> >to alps_set_protocol() so ALPS_DUALPOINT flag can be cleared before registering
> >trackstick input device in kernel.
> >
> >Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> 
> Looks good:
> 
> Acked-by: Hans de Goede <hdegoede@redhat.com>
> 
> Regards,
> 
> Hans
> 

Hi Hans! I would like to remind this patch as it stays here on ML.

> 
> >---
> >  drivers/input/mouse/alps.c |   12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> >
> >diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> >index c9cd27a..d24e98d 100644
> >--- a/drivers/input/mouse/alps.c
> >+++ b/drivers/input/mouse/alps.c
> >@@ -1877,15 +1877,12 @@ error:
> >
> >  static int alps_hw_init_v3(struct psmouse *psmouse)
> >  {
> >+	struct alps_data *priv = psmouse->private;
> >  	struct ps2dev *ps2dev = &psmouse->ps2dev;
> >  	int reg_val;
> >  	unsigned char param[4];
> >
> >-	reg_val = alps_probe_trackstick_v3_v7(psmouse, ALPS_REG_BASE_PINNACLE);
> >-	if (reg_val == -EIO)
> >-		goto error;
> >-
> >-	if (reg_val == 0 &&
> >+	if ((priv->flags & ALPS_DUALPOINT) &&
> >  	    alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
> >  		goto error;
> >
> >@@ -2249,6 +2246,11 @@ static int alps_set_protocol(struct psmouse *psmouse,
> >  		priv->decode_fields = alps_decode_pinnacle;
> >  		priv->nibble_commands = alps_v3_nibble_commands;
> >  		priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
> >+
> >+		if (alps_probe_trackstick_v3_v7(psmouse,
> >+						ALPS_REG_BASE_PINNACLE) < 0)
> >+			priv->flags &= ~ALPS_DUALPOINT;
> >+
> >  		break;
> >
> >  	case ALPS_PROTO_V3_RUSHMORE:
> >
Dmitry Torokhov Jan. 7, 2016, midnight UTC | #3
On Tue, Jan 05, 2016 at 05:54:19PM +0100, Pali Rohár wrote:
> On Monday 23 March 2015 12:42:25 Hans de Goede wrote:
> > Hi,
> > 
> > On 22-03-15 14:47, Pali Rohár wrote:
> > >This patch move v3 pinnacle code for trackstick detection from alps_hw_init_v3()
> > >to alps_set_protocol() so ALPS_DUALPOINT flag can be cleared before registering
> > >trackstick input device in kernel.
> > >
> > >Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > 
> > Looks good:
> > 
> > Acked-by: Hans de Goede <hdegoede@redhat.com>
> > 
> > Regards,
> > 
> > Hans
> > 
> 
> Hi Hans! I would like to remind this patch as it stays here on ML.

Applied, thank you.

> 
> > 
> > >---
> > >  drivers/input/mouse/alps.c |   12 +++++++-----
> > >  1 file changed, 7 insertions(+), 5 deletions(-)
> > >
> > >diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> > >index c9cd27a..d24e98d 100644
> > >--- a/drivers/input/mouse/alps.c
> > >+++ b/drivers/input/mouse/alps.c
> > >@@ -1877,15 +1877,12 @@ error:
> > >
> > >  static int alps_hw_init_v3(struct psmouse *psmouse)
> > >  {
> > >+	struct alps_data *priv = psmouse->private;
> > >  	struct ps2dev *ps2dev = &psmouse->ps2dev;
> > >  	int reg_val;
> > >  	unsigned char param[4];
> > >
> > >-	reg_val = alps_probe_trackstick_v3_v7(psmouse, ALPS_REG_BASE_PINNACLE);
> > >-	if (reg_val == -EIO)
> > >-		goto error;
> > >-
> > >-	if (reg_val == 0 &&
> > >+	if ((priv->flags & ALPS_DUALPOINT) &&
> > >  	    alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
> > >  		goto error;
> > >
> > >@@ -2249,6 +2246,11 @@ static int alps_set_protocol(struct psmouse *psmouse,
> > >  		priv->decode_fields = alps_decode_pinnacle;
> > >  		priv->nibble_commands = alps_v3_nibble_commands;
> > >  		priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
> > >+
> > >+		if (alps_probe_trackstick_v3_v7(psmouse,
> > >+						ALPS_REG_BASE_PINNACLE) < 0)
> > >+			priv->flags &= ~ALPS_DUALPOINT;
> > >+
> > >  		break;
> > >
> > >  	case ALPS_PROTO_V3_RUSHMORE:
> > >
> 
> -- 
> Pali Rohár
> pali.rohar@gmail.com
diff mbox

Patch

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index c9cd27a..d24e98d 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1877,15 +1877,12 @@  error:
 
 static int alps_hw_init_v3(struct psmouse *psmouse)
 {
+	struct alps_data *priv = psmouse->private;
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
 	int reg_val;
 	unsigned char param[4];
 
-	reg_val = alps_probe_trackstick_v3_v7(psmouse, ALPS_REG_BASE_PINNACLE);
-	if (reg_val == -EIO)
-		goto error;
-
-	if (reg_val == 0 &&
+	if ((priv->flags & ALPS_DUALPOINT) &&
 	    alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
 		goto error;
 
@@ -2249,6 +2246,11 @@  static int alps_set_protocol(struct psmouse *psmouse,
 		priv->decode_fields = alps_decode_pinnacle;
 		priv->nibble_commands = alps_v3_nibble_commands;
 		priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
+
+		if (alps_probe_trackstick_v3_v7(psmouse,
+						ALPS_REG_BASE_PINNACLE) < 0)
+			priv->flags &= ~ALPS_DUALPOINT;
+
 		break;
 
 	case ALPS_PROTO_V3_RUSHMORE: