Commit 8c0e0a4fa88f53d80ae8c410a9e2e364a96941a4
Committed by
Dmitry Torokhov
1 parent
0e47e3dccf
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
Input: wacom - prepare for syncing with input-mt changes
Henrik added new MT routines in release 3.7. This patch is to prepare for the use of new MT routines. In the newly added wacom_abs_set_axis() function, the first if-statement assigns ABS_X/Y for number of contacts less or equal to 2. So, it is single and 2 finger touch devices. Two finger touch devices are processed here since they will not use the updated input_mt_init_slots(), which does not offer benefit to those devices. input_mt_init_slots() will take care of ABS_X/Y assignment when flags are not zero. All touch devices with more than two contacts will use input_mt_init_slots() with non-zero flags. The second if-statement is for all MT devices, which include two finger touch devices. Signed-off-by: Ping Cheng <pingc@wacom.com> Reviewed-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Showing 1 changed file with 45 additions and 40 deletions Side-by-side Diff
drivers/input/tablet/wacom_wac.c
... | ... | @@ -1444,39 +1444,64 @@ |
1444 | 1444 | return (logical_max * 100) / physical_max; |
1445 | 1445 | } |
1446 | 1446 | |
1447 | -int wacom_setup_input_capabilities(struct input_dev *input_dev, | |
1448 | - struct wacom_wac *wacom_wac) | |
1447 | +static void wacom_abs_set_axis(struct input_dev *input_dev, | |
1448 | + struct wacom_wac *wacom_wac) | |
1449 | 1449 | { |
1450 | 1450 | struct wacom_features *features = &wacom_wac->features; |
1451 | - int i; | |
1452 | 1451 | |
1453 | - input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | |
1454 | - | |
1455 | - __set_bit(BTN_TOUCH, input_dev->keybit); | |
1456 | - | |
1457 | - input_set_abs_params(input_dev, ABS_X, 0, features->x_max, | |
1458 | - features->x_fuzz, 0); | |
1459 | - input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, | |
1460 | - features->y_fuzz, 0); | |
1461 | - | |
1462 | 1452 | if (features->device_type == BTN_TOOL_PEN) { |
1463 | - input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, | |
1464 | - features->pressure_fuzz, 0); | |
1453 | + input_set_abs_params(input_dev, ABS_X, 0, features->x_max, | |
1454 | + features->x_fuzz, 0); | |
1455 | + input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, | |
1456 | + features->y_fuzz, 0); | |
1457 | + input_set_abs_params(input_dev, ABS_PRESSURE, 0, | |
1458 | + features->pressure_max, features->pressure_fuzz, 0); | |
1465 | 1459 | |
1466 | 1460 | /* penabled devices have fixed resolution for each model */ |
1467 | 1461 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); |
1468 | 1462 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); |
1469 | 1463 | } else { |
1470 | - input_abs_set_res(input_dev, ABS_X, | |
1471 | - wacom_calculate_touch_res(features->x_max, | |
1472 | - features->x_phy)); | |
1473 | - input_abs_set_res(input_dev, ABS_Y, | |
1474 | - wacom_calculate_touch_res(features->y_max, | |
1475 | - features->y_phy)); | |
1464 | + if (features->touch_max <= 2) { | |
1465 | + input_set_abs_params(input_dev, ABS_X, 0, | |
1466 | + features->x_max, features->x_fuzz, 0); | |
1467 | + input_set_abs_params(input_dev, ABS_Y, 0, | |
1468 | + features->y_max, features->y_fuzz, 0); | |
1469 | + input_abs_set_res(input_dev, ABS_X, | |
1470 | + wacom_calculate_touch_res(features->x_max, | |
1471 | + features->x_phy)); | |
1472 | + input_abs_set_res(input_dev, ABS_Y, | |
1473 | + wacom_calculate_touch_res(features->y_max, | |
1474 | + features->y_phy)); | |
1475 | + } | |
1476 | + | |
1477 | + if (features->touch_max > 1) { | |
1478 | + input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, | |
1479 | + features->x_max, features->x_fuzz, 0); | |
1480 | + input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, | |
1481 | + features->y_max, features->y_fuzz, 0); | |
1482 | + input_abs_set_res(input_dev, ABS_MT_POSITION_X, | |
1483 | + wacom_calculate_touch_res(features->x_max, | |
1484 | + features->x_phy)); | |
1485 | + input_abs_set_res(input_dev, ABS_MT_POSITION_Y, | |
1486 | + wacom_calculate_touch_res(features->y_max, | |
1487 | + features->y_phy)); | |
1488 | + } | |
1476 | 1489 | } |
1490 | +} | |
1477 | 1491 | |
1492 | +int wacom_setup_input_capabilities(struct input_dev *input_dev, | |
1493 | + struct wacom_wac *wacom_wac) | |
1494 | +{ | |
1495 | + struct wacom_features *features = &wacom_wac->features; | |
1496 | + int i; | |
1497 | + | |
1498 | + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | |
1499 | + | |
1500 | + __set_bit(BTN_TOUCH, input_dev->keybit); | |
1478 | 1501 | __set_bit(ABS_MISC, input_dev->absbit); |
1479 | 1502 | |
1503 | + wacom_abs_set_axis(input_dev, wacom_wac); | |
1504 | + | |
1480 | 1505 | switch (wacom_wac->features.type) { |
1481 | 1506 | case WACOM_MO: |
1482 | 1507 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
... | ... | @@ -1625,13 +1650,6 @@ |
1625 | 1650 | 0, features->x_max, 0, 0); |
1626 | 1651 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, |
1627 | 1652 | 0, features->y_max, 0, 0); |
1628 | - | |
1629 | - input_set_abs_params(input_dev, ABS_MT_POSITION_X, | |
1630 | - 0, features->x_max, | |
1631 | - features->x_fuzz, 0); | |
1632 | - input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | |
1633 | - 0, features->y_max, | |
1634 | - features->y_fuzz, 0); | |
1635 | 1653 | } |
1636 | 1654 | break; |
1637 | 1655 | |
... | ... | @@ -1677,12 +1695,6 @@ |
1677 | 1695 | case TABLETPC2FG: |
1678 | 1696 | if (features->device_type == BTN_TOOL_FINGER) { |
1679 | 1697 | input_mt_init_slots(input_dev, features->touch_max, 0); |
1680 | - input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, | |
1681 | - 0, MT_TOOL_MAX, 0, 0); | |
1682 | - input_set_abs_params(input_dev, ABS_MT_POSITION_X, | |
1683 | - 0, features->x_max, 0, 0); | |
1684 | - input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | |
1685 | - 0, features->y_max, 0, 0); | |
1686 | 1698 | } |
1687 | 1699 | /* fall through */ |
1688 | 1700 | |
... | ... | @@ -1747,13 +1759,6 @@ |
1747 | 1759 | ABS_MT_TOUCH_MINOR, |
1748 | 1760 | 0, features->y_max, 0, 0); |
1749 | 1761 | } |
1750 | - | |
1751 | - input_set_abs_params(input_dev, ABS_MT_POSITION_X, | |
1752 | - 0, features->x_max, | |
1753 | - features->x_fuzz, 0); | |
1754 | - input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | |
1755 | - 0, features->y_max, | |
1756 | - features->y_fuzz, 0); | |
1757 | 1762 | } else if (features->device_type == BTN_TOOL_PEN) { |
1758 | 1763 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
1759 | 1764 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |