All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org, "Pali Rohár" <pali.rohar@gmail.com>
Cc: Yunkang Tang <yunkang.tang@cn.alps.com>,
	Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 2/6] Input: ALPS - make Rushmore a separate protocol
Date: Wed, 14 Jan 2015 14:55:50 -0800	[thread overview]
Message-ID: <1421276154-8689-3-git-send-email-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <1421276154-8689-1-git-send-email-dmitry.torokhov@gmail.com>

Even though Rushmore is very close to V3 protocol it is sufficiently
different to warrant it's own protocol name.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/alps.c | 26 ++++++++++++++++----------
 drivers/input/mouse/alps.h |  1 +
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index d995523..80aa6f8 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -99,7 +99,6 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
 #define ALPS_FOUR_BUTTONS	0x40	/* 4 direction button present */
 #define ALPS_PS2_INTERLEAVED	0x80	/* 3-byte PS/2 packet interleaved with
 					   6-byte ALPS packet */
-#define ALPS_IS_RUSHMORE	0x100	/* device is a rushmore */
 #define ALPS_BUTTONPAD		0x200	/* device is a clickpad */
 
 static const struct alps_model_info alps_model_data[] = {
@@ -412,7 +411,7 @@ static int alps_process_bitmap(struct alps_data *priv,
 		(2 * (priv->y_bits - 1));
 
 	/* y-bitmap order is reversed, except on rushmore */
-	if (!(priv->flags & ALPS_IS_RUSHMORE)) {
+	if (priv->proto_version != ALPS_PROTO_V3_RUSHMORE) {
 		fields->mt[0].y = priv->y_max - fields->mt[0].y;
 		fields->mt[1].y = priv->y_max - fields->mt[1].y;
 	}
@@ -1275,7 +1274,7 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
 			    psmouse->pktcnt - 1,
 			    psmouse->packet[psmouse->pktcnt - 1]);
 
-		if (priv->proto_version == ALPS_PROTO_V3 &&
+		if (priv->proto_version == ALPS_PROTO_V3_RUSHMORE &&
 		    psmouse->pktcnt == psmouse->pktsize) {
 			/*
 			 * Some Dell boxes, such as Latitude E6440 or E7440
@@ -2182,6 +2181,7 @@ static void alps_set_defaults(struct alps_data *priv)
 		priv->x_max = 1023;
 		priv->y_max = 767;
 		break;
+
 	case ALPS_PROTO_V3:
 		priv->hw_init = alps_hw_init_v3;
 		priv->process_packet = alps_process_packet_v3;
@@ -2190,6 +2190,18 @@ static void alps_set_defaults(struct alps_data *priv)
 		priv->nibble_commands = alps_v3_nibble_commands;
 		priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
 		break;
+
+	case ALPS_PROTO_V3_RUSHMORE:
+		priv->hw_init = alps_hw_init_rushmore_v3;
+		priv->process_packet = alps_process_packet_v3;
+		priv->set_abs_params = alps_set_abs_params_mt;
+		priv->decode_fields = alps_decode_rushmore;
+		priv->nibble_commands = alps_v3_nibble_commands;
+		priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
+		priv->x_bits = 16;
+		priv->y_bits = 12;
+		break;
+
 	case ALPS_PROTO_V4:
 		priv->hw_init = alps_hw_init_v4;
 		priv->process_packet = alps_process_packet_v4;
@@ -2313,15 +2325,9 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 
 		return 0;
 	} else if (ec[0] == 0x88 && ec[1] == 0x08) {
-		priv->proto_version = ALPS_PROTO_V3;
+		priv->proto_version = ALPS_PROTO_V3_RUSHMORE;
 		alps_set_defaults(priv);
 
-		priv->hw_init = alps_hw_init_rushmore_v3;
-		priv->decode_fields = alps_decode_rushmore;
-		priv->x_bits = 16;
-		priv->y_bits = 12;
-		priv->flags |= ALPS_IS_RUSHMORE;
-
 		/* hack to make addr_command, nibble_command available */
 		psmouse->private = priv;
 
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index 94645bf..f19908a 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -17,6 +17,7 @@
 #define ALPS_PROTO_V1		0x100
 #define ALPS_PROTO_V2		0x200
 #define ALPS_PROTO_V3		0x300
+#define ALPS_PROTO_V3_RUSHMORE	0x310
 #define ALPS_PROTO_V4		0x400
 #define ALPS_PROTO_V5		0x500
 #define ALPS_PROTO_V6		0x600
-- 
2.2.0.rc0.207.ga3a616c


  parent reply	other threads:[~2015-01-14 22:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 22:55 [PATCH 0/6] Fixes for ALPS trackstick Dmitry Torokhov
2015-01-14 22:55 ` [PATCH 1/6] Input: ALPS - renumber protocol numbers Dmitry Torokhov
2015-01-14 22:55 ` Dmitry Torokhov [this message]
2015-01-14 22:55 ` [PATCH 3/6] Input: ALPS - split protocol data from model info Dmitry Torokhov
2015-01-14 22:55 ` [PATCH 4/6] Input: ALPS - consolidate setting protocol parameters Dmitry Torokhov
2015-01-14 22:55 ` [PATCH 5/6] Input: ALPS - fix trackstick detection on some Dell Latitudes Dmitry Torokhov
2015-01-15 20:21   ` Pali Rohár
2015-01-15 21:00     ` Dmitry Torokhov
2015-01-17 10:26   ` Pali Rohár
2015-02-02  5:34     ` Dmitry Torokhov
2015-02-02 10:51       ` Pali Rohár
2015-01-14 22:55 ` [PATCH 6/6] Input: ALPS - mix trackstick and external PS/2 mouse data Dmitry Torokhov
2015-01-15 20:34   ` Pali Rohár
2015-01-15 21:00     ` Dmitry Torokhov
2015-01-18  9:45   ` Pali Rohár
2015-01-15 10:49 ` [PATCH 0/6] Fixes for ALPS trackstick Pali Rohár
2015-01-15 18:18   ` Dmitry Torokhov
2015-01-15 19:19     ` Pali Rohár
2015-01-15 19:38       ` Dmitry Torokhov
2015-01-15 20:28         ` Pali Rohár
2015-01-15 21:02           ` Dmitry Torokhov
2015-01-17 10:01             ` Pali Rohár
2015-01-18  7:22               ` Dmitry Torokhov
2015-01-18  9:47                 ` Pali Rohár
2015-01-24 22:20                   ` Pali Rohár
2015-02-02  5:49                   ` Dmitry Torokhov
2015-02-02 10:49                     ` Pali Rohár
2015-02-02 14:27                       ` Pali Rohár
2015-02-08 12:26                         ` Pali Rohár
2015-02-10  6:32                           ` Dmitry Torokhov
2015-02-11 18:13                             ` Pali Rohár
2015-02-12  7:52                           ` Dmitry Torokhov
2015-02-12 20:25                             ` Pali Rohár
2015-02-05 11:41                     ` Pali Rohár

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=1421276154-8689-3-git-send-email-dmitry.torokhov@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=yunkang.tang@cn.alps.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.