aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-07-26 01:37:15 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-07-26 17:03:13 -0400
commit40e8f53bffe074e6cd409cf484e4b55c114c93d6 (patch)
tree817d57a759b1d434a9ed1778b90fdfed715bda59
parent20bea68bd1a5c783a23ad9e9de15ffb1b036f3a4 (diff)
Input: alps - process_bitmap: don't invert the Y-axis on Rushmore
Rushmore models don't have the Y-axis data in the bitmap inverted. Since we now have 2 different Y orientations, make the Y bitmap data processing use a forward loop like the X bitmap data processing, unifying the 2, and invert the data later, except on Rushmore. So far no-one has noticed this because the synaptics driver only uses the non mt coordinates (except on clickpads, and there are no alps clickpads using process_bitmap). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/mouse/alps.c17
-rw-r--r--drivers/input/mouse/alps.h4
2 files changed, 12 insertions, 9 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index cc197d7473c9..abe9f9bdf69a 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -99,6 +99,7 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
99#define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ 99#define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */
100#define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with 100#define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with
101 6-byte ALPS packet */ 101 6-byte ALPS packet */
102#define ALPS_IS_RUSHMORE 0x100 /* device is a rushmore */
102 103
103static const struct alps_model_info alps_model_data[] = { 104static const struct alps_model_info alps_model_data[] = {
104 { { 0x32, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ 105 { { 0x32, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */
@@ -376,15 +377,10 @@ static int alps_process_bitmap(struct alps_data *priv,
376 prev_bit = bit; 377 prev_bit = bit;
377 } 378 }
378 379
379 /*
380 * y bitmap is reversed for what we need (lower positions are in
381 * higher bits), so we process from the top end.
382 */
383 y_map = y_map << (sizeof(y_map) * BITS_PER_BYTE - priv->y_bits);
384 prev_bit = 0; 380 prev_bit = 0;
385 point = &y_low; 381 point = &y_low;
386 for (i = 0; y_map != 0; i++, y_map <<= 1) { 382 for (i = 0; y_map != 0; i++, y_map >>= 1) {
387 bit = y_map & (1 << (sizeof(y_map) * BITS_PER_BYTE - 1)); 383 bit = y_map & 1;
388 if (bit) { 384 if (bit) {
389 if (!prev_bit) { 385 if (!prev_bit) {
390 point->start_bit = i; 386 point->start_bit = i;
@@ -435,6 +431,12 @@ static int alps_process_bitmap(struct alps_data *priv,
435 (2 * y_high.start_bit + y_high.num_bits - 1)) / 431 (2 * y_high.start_bit + y_high.num_bits - 1)) /
436 (2 * (priv->y_bits - 1)); 432 (2 * (priv->y_bits - 1));
437 433
434 /* y-bitmap order is reversed, except on rushmore */
435 if (!(priv->flags & ALPS_IS_RUSHMORE)) {
436 *y1 = priv->y_max - *y1;
437 *y2 = priv->y_max - *y2;
438 }
439
438 return fingers; 440 return fingers;
439} 441}
440 442
@@ -1981,6 +1983,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
1981 priv->decode_fields = alps_decode_rushmore; 1983 priv->decode_fields = alps_decode_rushmore;
1982 priv->x_bits = 16; 1984 priv->x_bits = 16;
1983 priv->y_bits = 12; 1985 priv->y_bits = 12;
1986 priv->flags |= ALPS_IS_RUSHMORE;
1984 1987
1985 /* hack to make addr_command, nibble_command available */ 1988 /* hack to make addr_command, nibble_command available */
1986 psmouse->private = priv; 1989 psmouse->private = priv;
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index 03f88b6940c7..6d2666c0d63a 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -46,7 +46,7 @@ struct alps_model_info {
46 unsigned char command_mode_resp; 46 unsigned char command_mode_resp;
47 unsigned char proto_version; 47 unsigned char proto_version;
48 unsigned char byte0, mask0; 48 unsigned char byte0, mask0;
49 unsigned char flags; 49 int flags;
50}; 50};
51 51
52/** 52/**
@@ -142,7 +142,7 @@ struct alps_data {
142 int addr_command; 142 int addr_command;
143 unsigned char proto_version; 143 unsigned char proto_version;
144 unsigned char byte0, mask0; 144 unsigned char byte0, mask0;
145 unsigned char flags; 145 int flags;
146 int x_max; 146 int x_max;
147 int y_max; 147 int y_max;
148 int x_bits; 148 int x_bits;