Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1414922 > unrolled thread

[PATCH 0/5] Input: alps - cleanup

Started byPali Rohár <pali.rohar@gmail.com>
First post2016-06-06 13:30 +0200
Last post2016-06-06 13:40 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5] Input: alps - cleanup Pali Rohár <pali.rohar@gmail.com> - 2016-06-06 13:30 +0200
    [PATCH 4/5] Input: alps - warn about unsupported ALPS V9 touchpad Pali Rohár <pali.rohar@gmail.com> - 2016-06-06 13:30 +0200
    [PATCH 1/5] Input: alps - move ALPS_PROTO_V6 out of alps_model_data table Pali Rohár <pali.rohar@gmail.com> - 2016-06-06 13:30 +0200
    [PATCH 5/5] Input: alps - cleanup ALPS_PROTO_V2 detection Pali Rohár <pali.rohar@gmail.com> - 2016-06-06 13:30 +0200
    Re: [PATCH 0/5] Input: alps - cleanup Hans de Goede <hdegoede@redhat.com> - 2016-06-06 13:40 +0200

#1414922 — [PATCH 0/5] Input: alps - cleanup

FromPali Rohár <pali.rohar@gmail.com>
Date2016-06-06 13:30 +0200
Subject[PATCH 0/5] Input: alps - cleanup
Message-ID<rH0Tf-4eU-3@gated-at.bofh.it>
This patch series cleanup usage of alps_model_data table.

Pali Rohár (5):
  Input: alps - move ALPS_PROTO_V6 out of alps_model_data table
  Input: alps - move ALPS_PROTO_V4 out of alps_model_data table
  Input: alps - move ALPS_PROTO_V1 out of alps_model_data table
  Input: alps - warn about unsupported ALPS V9 touchpad
  Input: alps - cleanup ALPS_PROTO_V2 detection

 drivers/input/mouse/alps.c |   99 ++++++++++++++++++++++++++------------------
 drivers/input/mouse/alps.h |   10 ++---
 2 files changed, 62 insertions(+), 47 deletions(-)

-- 
1.7.9.5

[toc] | [next] | [standalone]


#1414923 — [PATCH 4/5] Input: alps - warn about unsupported ALPS V9 touchpad

FromPali Rohár <pali.rohar@gmail.com>
Date2016-06-06 13:30 +0200
Subject[PATCH 4/5] Input: alps - warn about unsupported ALPS V9 touchpad
Message-ID<rH0Tf-4eU-15@gated-at.bofh.it>
In reply to#1414922
Support for devices with ALPS_PROTO_V9 is not implemented yet but we can
detect these alps touchpads and warn users about it.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/input/mouse/alps.c |    9 +++++++++
 drivers/input/mouse/alps.h |    1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 4e6d76e..3618320 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -169,6 +169,10 @@ static const struct alps_protocol_info alps_v8_protocol_data = {
 	ALPS_PROTO_V8, 0x18, 0x18, 0
 };
 
+static const struct alps_protocol_info alps_v9_protocol_data = {
+	ALPS_PROTO_V9, 0xc8, 0xc8, 0
+};
+
 /*
  * Some v2 models report the stick buttons in separate bits
  */
@@ -2783,6 +2787,11 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 		} else if (e7[0] == 0x73 && e7[1] == 0x03 &&
 			   e7[2] == 0x14 && ec[1] == 0x02) {
 			protocol = &alps_v8_protocol_data;
+		} else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0xc8) {
+			protocol = &alps_v9_protocol_data;
+			psmouse_warn(psmouse,
+				     "Unsupported ALPS V9 touchpad: E7=%3ph, EC=%3ph\n", e7, ec);
+			return -EINVAL;
 		} else {
 			psmouse_dbg(psmouse,
 				    "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec);
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index d37f814..fd0a359 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -23,6 +23,7 @@
 #define ALPS_PROTO_V6		0x600
 #define ALPS_PROTO_V7		0x700	/* t3btl t4s */
 #define ALPS_PROTO_V8		0x800	/* SS4btl SS4s */
+#define ALPS_PROTO_V9		0x900	/* ss3btl */
 
 #define MAX_TOUCHES	4
 
-- 
1.7.9.5

[toc] | [prev] | [next] | [standalone]


#1414926 — [PATCH 1/5] Input: alps - move ALPS_PROTO_V6 out of alps_model_data table

FromPali Rohár <pali.rohar@gmail.com>
Date2016-06-06 13:30 +0200
Subject[PATCH 1/5] Input: alps - move ALPS_PROTO_V6 out of alps_model_data table
Message-ID<rH0Tg-4eU-35@gated-at.bofh.it>
In reply to#1414922
Like for other protocols create alps_v6_protocol_data and use it in
alps_identify() function.

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

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 936f07a..eb0c57b 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -133,7 +133,6 @@ static const struct alps_model_info alps_model_data[] = {
 	/* Dell Latitude E5500, E6400, E6500, Precision M4400 */
 	{ { 0x62, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf,
 		ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } },
-	{ { 0x73, 0x00, 0x14 }, 0x00, { ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT } },		/* Dell XT2 */
 	{ { 0x73, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS } },	/* Dell Vostro 1400 */
 	{ { 0x52, 0x01, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff,
 		ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } },				/* Toshiba Tecra A11-11L */
@@ -152,6 +151,10 @@ static const struct alps_protocol_info alps_v5_protocol_data = {
 	ALPS_PROTO_V5, 0xc8, 0xd8, 0
 };
 
+static const struct alps_protocol_info alps_v6_protocol_data = {
+	ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT
+};
+
 static const struct alps_protocol_info alps_v7_protocol_data = {
 	ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT
 };
@@ -2756,6 +2759,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 		if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 &&
 			   ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) {
 			protocol = &alps_v5_protocol_data;
+		} else if (e7[0] == 0x73 && e7[1] == 0x00 && e7[2] == 0x14) {
+			protocol = &alps_v6_protocol_data;
 		} else if (ec[0] == 0x88 &&
 			   ((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0)) {
 			protocol = &alps_v7_protocol_data;
-- 
1.7.9.5

[toc] | [prev] | [next] | [standalone]


#1414927 — [PATCH 5/5] Input: alps - cleanup ALPS_PROTO_V2 detection

FromPali Rohár <pali.rohar@gmail.com>
Date2016-06-06 13:30 +0200
Subject[PATCH 5/5] Input: alps - cleanup ALPS_PROTO_V2 detection
Message-ID<rH0Tg-4eU-45@gated-at.bofh.it>
In reply to#1414922
Table alps_model_data is now used only for ALPS_PROTO_V2, so add "v2"
indentifier to all relevant functions/variables/structures. Sort all
devices by signature and remove command_mode_resp which is not used
anymore.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/input/mouse/alps.c |   66 ++++++++++++++++++++------------------------
 drivers/input/mouse/alps.h |    9 ++----
 2 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 3618320..7dc49c1e 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -104,37 +104,35 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
 #define ALPS_STICK_BITS		0x100	/* separate stick button bits */
 #define ALPS_BUTTONPAD		0x200	/* device is a clickpad */
 
-static const struct alps_model_info alps_model_data[] = {
-	{ { 0x32, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },	/* Toshiba Salellite Pro M10 */
-	{ { 0x53, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
-	{ { 0x53, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
-	{ { 0x60, 0x03, 0xc8 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },				/* HP ze1115 */
-	{ { 0x63, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
-	{ { 0x63, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
-	{ { 0x63, 0x02, 0x28 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } },		/* Fujitsu Siemens S6010 */
-	{ { 0x63, 0x02, 0x3c }, 0x00, { ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL } },		/* Toshiba Satellite S2400-103 */
-	{ { 0x63, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 } },		/* NEC Versa L320 */
-	{ { 0x63, 0x02, 0x64 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
-	{ { 0x63, 0x03, 0xc8 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },	/* Dell Latitude D800 */
-	{ { 0x73, 0x00, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT } },		/* ThinkPad R61 8918-5QG */
-	{ { 0x73, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
-	{ { 0x73, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } },		/* Ahtec Laptop */
-
+static const struct alps_v2_model_info alps_v2_model_data[] = {
 	/*
 	 * XXX This entry is suspicious. First byte has zero lower nibble,
 	 * which is what a normal mouse would report. Also, the value 0x0e
 	 * isn't valid per PS/2 spec.
 	 */
-	{ { 0x20, 0x02, 0x0e }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },
-
-	{ { 0x22, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },
-	{ { 0x22, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT } },	/* Dell Latitude D600 */
-	/* Dell Latitude E5500, E6400, E6500, Precision M4400 */
-	{ { 0x62, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf,
-		ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } },
-	{ { 0x73, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS } },	/* Dell Vostro 1400 */
-	{ { 0x52, 0x01, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff,
+	{ { 0x20, 0x02, 0x0e }, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },
+
+	{ { 0x22, 0x02, 0x0a }, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },
+	{ { 0x22, 0x02, 0x14 }, { ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT } },	/* Dell Latitude D600 */
+	{ { 0x32, 0x02, 0x14 }, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },	/* Toshiba Salellite Pro M10 */
+	{ { 0x52, 0x01, 0x14 }, { ALPS_PROTO_V2, 0xff, 0xff,
 		ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } },				/* Toshiba Tecra A11-11L */
+	{ { 0x53, 0x02, 0x0a }, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
+	{ { 0x53, 0x02, 0x14 }, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
+	{ { 0x60, 0x03, 0xc8 }, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },				/* HP ze1115 */
+	{ { 0x62, 0x02, 0x14 }, { ALPS_PROTO_V2, 0xcf, 0xcf,
+		ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } },				/* Dell Latitude E5500, E6400, E6500, Precision M4400 */
+	{ { 0x63, 0x02, 0x0a }, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
+	{ { 0x63, 0x02, 0x14 }, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
+	{ { 0x63, 0x02, 0x28 }, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } },			/* Fujitsu Siemens S6010 */
+	{ { 0x63, 0x02, 0x3c }, { ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL } },			/* Toshiba Satellite S2400-103 */
+	{ { 0x63, 0x02, 0x50 }, { ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 } },			/* NEC Versa L320 */
+	{ { 0x63, 0x02, 0x64 }, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
+	{ { 0x63, 0x03, 0xc8 }, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },	/* Dell Latitude D800 */
+	{ { 0x73, 0x00, 0x0a }, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT } },		/* ThinkPad R61 8918-5QG */
+	{ { 0x73, 0x02, 0x0a }, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
+	{ { 0x73, 0x02, 0x14 }, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } },			/* Ahtec Laptop */
+	{ { 0x73, 0x02, 0x50 }, { ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS } },		/* Dell Vostro 1400 */
 };
 
 static const struct alps_protocol_info alps_v1_protocol_data = {
@@ -2714,21 +2712,17 @@ static int alps_set_protocol(struct psmouse *psmouse,
 	return 0;
 }
 
-static const struct alps_protocol_info *alps_match_table(unsigned char *e7,
-							 unsigned char *ec)
+static const struct alps_protocol_info *alps_v2_match_table(unsigned char *e7,
+							    unsigned char *ec)
 {
-	const struct alps_model_info *model;
+	const struct alps_v2_model_info *model;
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(alps_model_data); i++) {
-		model = &alps_model_data[i];
-
-		if (!memcmp(e7, model->signature, sizeof(model->signature)) &&
-		    (!model->command_mode_resp ||
-		     model->command_mode_resp == ec[2])) {
+	for (i = 0; i < ARRAY_SIZE(alps_v2_model_data); i++) {
+		model = &alps_v2_model_data[i];
 
+		if (!memcmp(e7, model->signature, sizeof(model->signature)))
 			return &model->protocol_info;
-		}
 	}
 
 	return NULL;
@@ -2764,7 +2758,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 	    alps_exit_command_mode(psmouse))
 		return -EIO;
 
-	protocol = alps_match_table(e7, ec);
+	protocol = alps_v2_match_table(e7, ec);
 	if (!protocol) {
 		if (e7[0] == 0x33 && e7[1] == 0x02 && e7[2] == 0x0a) {
 			protocol = &alps_v1_protocol_data;
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index fd0a359..8b56169 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -139,21 +139,16 @@ struct alps_protocol_info {
 };
 
 /**
- * struct alps_model_info - touchpad ID table
+ * struct alps_v2_model_info - touchpad ID table
  * @signature: E7 response string to match.
- * @command_mode_resp: For V3/V4 touchpads, the final byte of the EC response
- *   (aka command mode response) identifies the firmware minor version.  This
- *   can be used to distinguish different hardware models which are not
- *   uniquely identifiable through their E7 responses.
  * @protocol_info: information about protcol used by the device.
  *
  * Many (but not all) ALPS touchpads can be identified by looking at the
  * values returned in the "E7 report" and/or the "EC report."  This table
  * lists a number of such touchpads.
  */
-struct alps_model_info {
+struct alps_v2_model_info {
 	u8 signature[3];
-	u8 command_mode_resp;
 	struct alps_protocol_info protocol_info;
 };
 
-- 
1.7.9.5

[toc] | [prev] | [next] | [standalone]


#1414930

FromHans de Goede <hdegoede@redhat.com>
Date2016-06-06 13:40 +0200
Message-ID<rH12W-4it-5@gated-at.bofh.it>
In reply to#1414922
Hi,

On 06-06-16 13:23, Pali Rohár wrote:
> This patch series cleanup usage of alps_model_data table.
>
> Pali Rohár (5):
>   Input: alps - move ALPS_PROTO_V6 out of alps_model_data table
>   Input: alps - move ALPS_PROTO_V4 out of alps_model_data table
>   Input: alps - move ALPS_PROTO_V1 out of alps_model_data table
>   Input: alps - warn about unsupported ALPS V9 touchpad
>   Input: alps - cleanup ALPS_PROTO_V2 detection
>
>  drivers/input/mouse/alps.c |   99 ++++++++++++++++++++++++++------------------
>  drivers/input/mouse/alps.h |   10 ++---
>  2 files changed, 62 insertions(+), 47 deletions(-)

Series looks good to me:

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

Thanks & Regards,

Hans

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web