aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/mouse/alps.c60
1 files changed, 24 insertions, 36 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index e15daea56864..cc197d7473c9 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -407,23 +407,20 @@ static int alps_process_bitmap(struct alps_data *priv,
407 fingers = max(fingers_x, fingers_y); 407 fingers = max(fingers_x, fingers_y);
408 408
409 /* 409 /*
410 * If total fingers is > 1 but either axis reports only a single 410 * If an axis reports only a single contact, we have overlapping or
411 * contact, we have overlapping or adjacent fingers. For the 411 * adjacent fingers. Divide the single contact between the two points.
412 * purposes of creating a bounding box, divide the single contact
413 * (roughly) equally between the two points.
414 */ 412 */
415 if (fingers > 1) { 413 if (fingers_x == 1) {
416 if (fingers_x == 1) { 414 i = x_low.num_bits / 2;
417 i = x_low.num_bits / 2; 415 x_low.num_bits = x_low.num_bits - i;
418 x_low.num_bits = x_low.num_bits - i; 416 x_high.start_bit = x_low.start_bit + i;
419 x_high.start_bit = x_low.start_bit + i; 417 x_high.num_bits = max(i, 1);
420 x_high.num_bits = max(i, 1); 418 }
421 } else if (fingers_y == 1) { 419 if (fingers_y == 1) {
422 i = y_low.num_bits / 2; 420 i = y_low.num_bits / 2;
423 y_low.num_bits = y_low.num_bits - i; 421 y_low.num_bits = y_low.num_bits - i;
424 y_high.start_bit = y_low.start_bit + i; 422 y_high.start_bit = y_low.start_bit + i;
425 y_high.num_bits = max(i, 1); 423 y_high.num_bits = max(i, 1);
426 }
427 } 424 }
428 425
429 *x1 = (priv->x_max * (2 * x_low.start_bit + x_low.num_bits - 1)) / 426 *x1 = (priv->x_max * (2 * x_low.start_bit + x_low.num_bits - 1)) /
@@ -431,14 +428,12 @@ static int alps_process_bitmap(struct alps_data *priv,
431 *y1 = (priv->y_max * (2 * y_low.start_bit + y_low.num_bits - 1)) / 428 *y1 = (priv->y_max * (2 * y_low.start_bit + y_low.num_bits - 1)) /
432 (2 * (priv->y_bits - 1)); 429 (2 * (priv->y_bits - 1));
433 430
434 if (fingers > 1) { 431 *x2 = (priv->x_max *
435 *x2 = (priv->x_max * 432 (2 * x_high.start_bit + x_high.num_bits - 1)) /
436 (2 * x_high.start_bit + x_high.num_bits - 1)) / 433 (2 * (priv->x_bits - 1));
437 (2 * (priv->x_bits - 1)); 434 *y2 = (priv->y_max *
438 *y2 = (priv->y_max * 435 (2 * y_high.start_bit + y_high.num_bits - 1)) /
439 (2 * y_high.start_bit + y_high.num_bits - 1)) / 436 (2 * (priv->y_bits - 1));
440 (2 * (priv->y_bits - 1));
441 }
442 437
443 return fingers; 438 return fingers;
444} 439}
@@ -607,8 +602,7 @@ static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse)
607 unsigned char *packet = psmouse->packet; 602 unsigned char *packet = psmouse->packet;
608 struct input_dev *dev = psmouse->dev; 603 struct input_dev *dev = psmouse->dev;
609 struct input_dev *dev2 = priv->dev2; 604 struct input_dev *dev2 = priv->dev2;
610 int x1 = 0, y1 = 0, x2 = 0, y2 = 0; 605 int x1 = 0, y1 = 0, x2 = 0, y2 = 0, fingers = 0;
611 int fingers = 0, bmap_fn;
612 struct alps_fields f = {0}; 606 struct alps_fields f = {0};
613 607
614 priv->decode_fields(&f, packet, psmouse); 608 priv->decode_fields(&f, packet, psmouse);
@@ -629,16 +623,10 @@ static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse)
629 if (f.is_mp) { 623 if (f.is_mp) {
630 fingers = f.fingers; 624 fingers = f.fingers;
631 if (priv->proto_version == ALPS_PROTO_V3) { 625 if (priv->proto_version == ALPS_PROTO_V3) {
632 bmap_fn = alps_process_bitmap(priv, f.x_map, 626 if (alps_process_bitmap(priv, f.x_map,
633 f.y_map, &x1, &y1, 627 f.y_map, &x1, &y1,
634 &x2, &y2); 628 &x2, &y2) == 0)
635 629 fingers = 0; /* Use st data */
636 /*
637 * We shouldn't report more than one finger if
638 * we don't have two coordinates.
639 */
640 if (fingers > 1 && bmap_fn < 2)
641 fingers = bmap_fn;
642 630
643 /* Now process position packet */ 631 /* Now process position packet */
644 priv->decode_fields(&f, priv->multi_data, 632 priv->decode_fields(&f, priv->multi_data,