diff options
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/tc3589x-keypad.c | 8 | ||||
-rw-r--r-- | drivers/input/mouse/alps.c | 85 | ||||
-rw-r--r-- | drivers/input/mouse/alps.h | 1 | ||||
-rw-r--r-- | drivers/input/mouse/cypress_ps2.c | 19 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 4 | ||||
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 7 | ||||
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 68 | ||||
-rw-r--r-- | drivers/input/touchscreen/mms114.c | 34 |
8 files changed, 189 insertions, 37 deletions
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c index 2fb0d76a04c4..208de7cbb7fa 100644 --- a/drivers/input/keyboard/tc3589x-keypad.c +++ b/drivers/input/keyboard/tc3589x-keypad.c | |||
@@ -70,8 +70,6 @@ | |||
70 | #define TC3589x_EVT_INT_CLR 0x2 | 70 | #define TC3589x_EVT_INT_CLR 0x2 |
71 | #define TC3589x_KBD_INT_CLR 0x1 | 71 | #define TC3589x_KBD_INT_CLR 0x1 |
72 | 72 | ||
73 | #define TC3589x_KBD_KEYMAP_SIZE 64 | ||
74 | |||
75 | /** | 73 | /** |
76 | * struct tc_keypad - data structure used by keypad driver | 74 | * struct tc_keypad - data structure used by keypad driver |
77 | * @tc3589x: pointer to tc35893 | 75 | * @tc3589x: pointer to tc35893 |
@@ -88,7 +86,7 @@ struct tc_keypad { | |||
88 | const struct tc3589x_keypad_platform_data *board; | 86 | const struct tc3589x_keypad_platform_data *board; |
89 | unsigned int krow; | 87 | unsigned int krow; |
90 | unsigned int kcol; | 88 | unsigned int kcol; |
91 | unsigned short keymap[TC3589x_KBD_KEYMAP_SIZE]; | 89 | unsigned short *keymap; |
92 | bool keypad_stopped; | 90 | bool keypad_stopped; |
93 | }; | 91 | }; |
94 | 92 | ||
@@ -338,12 +336,14 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) | |||
338 | 336 | ||
339 | error = matrix_keypad_build_keymap(plat->keymap_data, NULL, | 337 | error = matrix_keypad_build_keymap(plat->keymap_data, NULL, |
340 | TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL, | 338 | TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL, |
341 | keypad->keymap, input); | 339 | NULL, input); |
342 | if (error) { | 340 | if (error) { |
343 | dev_err(&pdev->dev, "Failed to build keymap\n"); | 341 | dev_err(&pdev->dev, "Failed to build keymap\n"); |
344 | goto err_free_mem; | 342 | goto err_free_mem; |
345 | } | 343 | } |
346 | 344 | ||
345 | keypad->keymap = input->keycode; | ||
346 | |||
347 | input_set_capability(input, EV_MSC, MSC_SCAN); | 347 | input_set_capability(input, EV_MSC, MSC_SCAN); |
348 | if (!plat->no_autorepeat) | 348 | if (!plat->no_autorepeat) |
349 | __set_bit(EV_REP, input->evbit); | 349 | __set_bit(EV_REP, input->evbit); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 7b99fc7c9438..0238e0e14335 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -490,6 +490,29 @@ static void alps_decode_rushmore(struct alps_fields *f, unsigned char *p) | |||
490 | f->y_map |= (p[5] & 0x20) << 6; | 490 | f->y_map |= (p[5] & 0x20) << 6; |
491 | } | 491 | } |
492 | 492 | ||
493 | static void alps_decode_dolphin(struct alps_fields *f, unsigned char *p) | ||
494 | { | ||
495 | f->first_mp = !!(p[0] & 0x02); | ||
496 | f->is_mp = !!(p[0] & 0x20); | ||
497 | |||
498 | f->fingers = ((p[0] & 0x6) >> 1 | | ||
499 | (p[0] & 0x10) >> 2); | ||
500 | f->x_map = ((p[2] & 0x60) >> 5) | | ||
501 | ((p[4] & 0x7f) << 2) | | ||
502 | ((p[5] & 0x7f) << 9) | | ||
503 | ((p[3] & 0x07) << 16) | | ||
504 | ((p[3] & 0x70) << 15) | | ||
505 | ((p[0] & 0x01) << 22); | ||
506 | f->y_map = (p[1] & 0x7f) | | ||
507 | ((p[2] & 0x1f) << 7); | ||
508 | |||
509 | f->x = ((p[1] & 0x7f) | ((p[4] & 0x0f) << 7)); | ||
510 | f->y = ((p[2] & 0x7f) | ((p[4] & 0xf0) << 3)); | ||
511 | f->z = (p[0] & 4) ? 0 : p[5] & 0x7f; | ||
512 | |||
513 | alps_decode_buttons_v3(f, p); | ||
514 | } | ||
515 | |||
493 | static void alps_process_touchpad_packet_v3(struct psmouse *psmouse) | 516 | static void alps_process_touchpad_packet_v3(struct psmouse *psmouse) |
494 | { | 517 | { |
495 | struct alps_data *priv = psmouse->private; | 518 | struct alps_data *priv = psmouse->private; |
@@ -874,7 +897,8 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
874 | } | 897 | } |
875 | 898 | ||
876 | /* Bytes 2 - pktsize should have 0 in the highest bit */ | 899 | /* Bytes 2 - pktsize should have 0 in the highest bit */ |
877 | if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && | 900 | if (priv->proto_version != ALPS_PROTO_V5 && |
901 | psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && | ||
878 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { | 902 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { |
879 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", | 903 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", |
880 | psmouse->pktcnt - 1, | 904 | psmouse->pktcnt - 1, |
@@ -994,8 +1018,7 @@ static int alps_rpt_cmd(struct psmouse *psmouse, int init_command, | |||
994 | return 0; | 1018 | return 0; |
995 | } | 1019 | } |
996 | 1020 | ||
997 | static int alps_enter_command_mode(struct psmouse *psmouse, | 1021 | static int alps_enter_command_mode(struct psmouse *psmouse) |
998 | unsigned char *resp) | ||
999 | { | 1022 | { |
1000 | unsigned char param[4]; | 1023 | unsigned char param[4]; |
1001 | 1024 | ||
@@ -1004,14 +1027,12 @@ static int alps_enter_command_mode(struct psmouse *psmouse, | |||
1004 | return -1; | 1027 | return -1; |
1005 | } | 1028 | } |
1006 | 1029 | ||
1007 | if (param[0] != 0x88 || (param[1] != 0x07 && param[1] != 0x08)) { | 1030 | if ((param[0] != 0x88 || (param[1] != 0x07 && param[1] != 0x08)) && |
1031 | param[0] != 0x73) { | ||
1008 | psmouse_dbg(psmouse, | 1032 | psmouse_dbg(psmouse, |
1009 | "unknown response while entering command mode\n"); | 1033 | "unknown response while entering command mode\n"); |
1010 | return -1; | 1034 | return -1; |
1011 | } | 1035 | } |
1012 | |||
1013 | if (resp) | ||
1014 | *resp = param[2]; | ||
1015 | return 0; | 1036 | return 0; |
1016 | } | 1037 | } |
1017 | 1038 | ||
@@ -1176,7 +1197,7 @@ static int alps_passthrough_mode_v3(struct psmouse *psmouse, | |||
1176 | { | 1197 | { |
1177 | int reg_val, ret = -1; | 1198 | int reg_val, ret = -1; |
1178 | 1199 | ||
1179 | if (alps_enter_command_mode(psmouse, NULL)) | 1200 | if (alps_enter_command_mode(psmouse)) |
1180 | return -1; | 1201 | return -1; |
1181 | 1202 | ||
1182 | reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x0008); | 1203 | reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x0008); |
@@ -1216,7 +1237,7 @@ static int alps_probe_trackstick_v3(struct psmouse *psmouse, int reg_base) | |||
1216 | { | 1237 | { |
1217 | int ret = -EIO, reg_val; | 1238 | int ret = -EIO, reg_val; |
1218 | 1239 | ||
1219 | if (alps_enter_command_mode(psmouse, NULL)) | 1240 | if (alps_enter_command_mode(psmouse)) |
1220 | goto error; | 1241 | goto error; |
1221 | 1242 | ||
1222 | reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08); | 1243 | reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08); |
@@ -1279,7 +1300,7 @@ static int alps_setup_trackstick_v3(struct psmouse *psmouse, int reg_base) | |||
1279 | * supported by this driver. If bit 1 isn't set the packet | 1300 | * supported by this driver. If bit 1 isn't set the packet |
1280 | * format is different. | 1301 | * format is different. |
1281 | */ | 1302 | */ |
1282 | if (alps_enter_command_mode(psmouse, NULL) || | 1303 | if (alps_enter_command_mode(psmouse) || |
1283 | alps_command_mode_write_reg(psmouse, | 1304 | alps_command_mode_write_reg(psmouse, |
1284 | reg_base + 0x08, 0x82) || | 1305 | reg_base + 0x08, 0x82) || |
1285 | alps_exit_command_mode(psmouse)) | 1306 | alps_exit_command_mode(psmouse)) |
@@ -1306,7 +1327,7 @@ static int alps_hw_init_v3(struct psmouse *psmouse) | |||
1306 | alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO) | 1327 | alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO) |
1307 | goto error; | 1328 | goto error; |
1308 | 1329 | ||
1309 | if (alps_enter_command_mode(psmouse, NULL) || | 1330 | if (alps_enter_command_mode(psmouse) || |
1310 | alps_absolute_mode_v3(psmouse)) { | 1331 | alps_absolute_mode_v3(psmouse)) { |
1311 | psmouse_err(psmouse, "Failed to enter absolute mode\n"); | 1332 | psmouse_err(psmouse, "Failed to enter absolute mode\n"); |
1312 | goto error; | 1333 | goto error; |
@@ -1381,7 +1402,7 @@ static int alps_hw_init_rushmore_v3(struct psmouse *psmouse) | |||
1381 | priv->flags &= ~ALPS_DUALPOINT; | 1402 | priv->flags &= ~ALPS_DUALPOINT; |
1382 | } | 1403 | } |
1383 | 1404 | ||
1384 | if (alps_enter_command_mode(psmouse, NULL) || | 1405 | if (alps_enter_command_mode(psmouse) || |
1385 | alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 || | 1406 | alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 || |
1386 | alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00)) | 1407 | alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00)) |
1387 | goto error; | 1408 | goto error; |
@@ -1431,7 +1452,7 @@ static int alps_hw_init_v4(struct psmouse *psmouse) | |||
1431 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 1452 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
1432 | unsigned char param[4]; | 1453 | unsigned char param[4]; |
1433 | 1454 | ||
1434 | if (alps_enter_command_mode(psmouse, NULL)) | 1455 | if (alps_enter_command_mode(psmouse)) |
1435 | goto error; | 1456 | goto error; |
1436 | 1457 | ||
1437 | if (alps_absolute_mode_v4(psmouse)) { | 1458 | if (alps_absolute_mode_v4(psmouse)) { |
@@ -1499,6 +1520,23 @@ error: | |||
1499 | return -1; | 1520 | return -1; |
1500 | } | 1521 | } |
1501 | 1522 | ||
1523 | static int alps_hw_init_dolphin_v1(struct psmouse *psmouse) | ||
1524 | { | ||
1525 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
1526 | unsigned char param[2]; | ||
1527 | |||
1528 | /* This is dolphin "v1" as empirically defined by florin9doi */ | ||
1529 | param[0] = 0x64; | ||
1530 | param[1] = 0x28; | ||
1531 | |||
1532 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM) || | ||
1533 | ps2_command(ps2dev, ¶m[0], PSMOUSE_CMD_SETRATE) || | ||
1534 | ps2_command(ps2dev, ¶m[1], PSMOUSE_CMD_SETRATE)) | ||
1535 | return -1; | ||
1536 | |||
1537 | return 0; | ||
1538 | } | ||
1539 | |||
1502 | static void alps_set_defaults(struct alps_data *priv) | 1540 | static void alps_set_defaults(struct alps_data *priv) |
1503 | { | 1541 | { |
1504 | priv->byte0 = 0x8f; | 1542 | priv->byte0 = 0x8f; |
@@ -1532,6 +1570,21 @@ static void alps_set_defaults(struct alps_data *priv) | |||
1532 | priv->nibble_commands = alps_v4_nibble_commands; | 1570 | priv->nibble_commands = alps_v4_nibble_commands; |
1533 | priv->addr_command = PSMOUSE_CMD_DISABLE; | 1571 | priv->addr_command = PSMOUSE_CMD_DISABLE; |
1534 | break; | 1572 | break; |
1573 | case ALPS_PROTO_V5: | ||
1574 | priv->hw_init = alps_hw_init_dolphin_v1; | ||
1575 | priv->process_packet = alps_process_packet_v3; | ||
1576 | priv->decode_fields = alps_decode_dolphin; | ||
1577 | priv->set_abs_params = alps_set_abs_params_mt; | ||
1578 | priv->nibble_commands = alps_v3_nibble_commands; | ||
1579 | priv->addr_command = PSMOUSE_CMD_RESET_WRAP; | ||
1580 | priv->byte0 = 0xc8; | ||
1581 | priv->mask0 = 0xc8; | ||
1582 | priv->flags = 0; | ||
1583 | priv->x_max = 1360; | ||
1584 | priv->y_max = 660; | ||
1585 | priv->x_bits = 23; | ||
1586 | priv->y_bits = 12; | ||
1587 | break; | ||
1535 | } | 1588 | } |
1536 | } | 1589 | } |
1537 | 1590 | ||
@@ -1592,6 +1645,12 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) | |||
1592 | 1645 | ||
1593 | if (alps_match_table(psmouse, priv, e7, ec) == 0) { | 1646 | if (alps_match_table(psmouse, priv, e7, ec) == 0) { |
1594 | return 0; | 1647 | return 0; |
1648 | } else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 && | ||
1649 | ec[0] == 0x73 && ec[1] == 0x01) { | ||
1650 | priv->proto_version = ALPS_PROTO_V5; | ||
1651 | alps_set_defaults(priv); | ||
1652 | |||
1653 | return 0; | ||
1595 | } else if (ec[0] == 0x88 && ec[1] == 0x08) { | 1654 | } else if (ec[0] == 0x88 && ec[1] == 0x08) { |
1596 | priv->proto_version = ALPS_PROTO_V3; | 1655 | priv->proto_version = ALPS_PROTO_V3; |
1597 | alps_set_defaults(priv); | 1656 | alps_set_defaults(priv); |
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index 970480551b6e..eee59853b9ce 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define ALPS_PROTO_V2 2 | 16 | #define ALPS_PROTO_V2 2 |
17 | #define ALPS_PROTO_V3 3 | 17 | #define ALPS_PROTO_V3 3 |
18 | #define ALPS_PROTO_V4 4 | 18 | #define ALPS_PROTO_V4 4 |
19 | #define ALPS_PROTO_V5 5 | ||
19 | 20 | ||
20 | /** | 21 | /** |
21 | * struct alps_model_info - touchpad ID table | 22 | * struct alps_model_info - touchpad ID table |
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c index 1673dc6c8092..f51765fff054 100644 --- a/drivers/input/mouse/cypress_ps2.c +++ b/drivers/input/mouse/cypress_ps2.c | |||
@@ -236,6 +236,13 @@ static int cypress_read_fw_version(struct psmouse *psmouse) | |||
236 | cytp->fw_version = param[2] & FW_VERSION_MASX; | 236 | cytp->fw_version = param[2] & FW_VERSION_MASX; |
237 | cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0; | 237 | cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0; |
238 | 238 | ||
239 | /* | ||
240 | * Trackpad fw_version 11 (in Dell XPS12) yields a bogus response to | ||
241 | * CYTP_CMD_READ_TP_METRICS so do not try to use it. LP: #1103594. | ||
242 | */ | ||
243 | if (cytp->fw_version >= 11) | ||
244 | cytp->tp_metrics_supported = 0; | ||
245 | |||
239 | psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version); | 246 | psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version); |
240 | psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n", | 247 | psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n", |
241 | cytp->tp_metrics_supported); | 248 | cytp->tp_metrics_supported); |
@@ -258,6 +265,9 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse) | |||
258 | cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width; | 265 | cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width; |
259 | cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high; | 266 | cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high; |
260 | 267 | ||
268 | if (!cytp->tp_metrics_supported) | ||
269 | return 0; | ||
270 | |||
261 | memset(param, 0, sizeof(param)); | 271 | memset(param, 0, sizeof(param)); |
262 | if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) { | 272 | if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) { |
263 | /* Update trackpad parameters. */ | 273 | /* Update trackpad parameters. */ |
@@ -315,18 +325,15 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse) | |||
315 | 325 | ||
316 | static int cypress_query_hardware(struct psmouse *psmouse) | 326 | static int cypress_query_hardware(struct psmouse *psmouse) |
317 | { | 327 | { |
318 | struct cytp_data *cytp = psmouse->private; | ||
319 | int ret; | 328 | int ret; |
320 | 329 | ||
321 | ret = cypress_read_fw_version(psmouse); | 330 | ret = cypress_read_fw_version(psmouse); |
322 | if (ret) | 331 | if (ret) |
323 | return ret; | 332 | return ret; |
324 | 333 | ||
325 | if (cytp->tp_metrics_supported) { | 334 | ret = cypress_read_tp_metrics(psmouse); |
326 | ret = cypress_read_tp_metrics(psmouse); | 335 | if (ret) |
327 | if (ret) | 336 | return ret; |
328 | return ret; | ||
329 | } | ||
330 | 337 | ||
331 | return 0; | 338 | return 0; |
332 | } | 339 | } |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 41b6fbf60112..1daa97913b7d 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -2017,6 +2017,9 @@ static const struct wacom_features wacom_features_0x100 = | |||
2017 | static const struct wacom_features wacom_features_0x101 = | 2017 | static const struct wacom_features wacom_features_0x101 = |
2018 | { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2018 | { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, |
2019 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2019 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
2020 | static const struct wacom_features wacom_features_0x10D = | ||
2021 | { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | ||
2022 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2020 | static const struct wacom_features wacom_features_0x4001 = | 2023 | static const struct wacom_features wacom_features_0x4001 = |
2021 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2024 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, |
2022 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2025 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -2201,6 +2204,7 @@ const struct usb_device_id wacom_ids[] = { | |||
2201 | { USB_DEVICE_WACOM(0xEF) }, | 2204 | { USB_DEVICE_WACOM(0xEF) }, |
2202 | { USB_DEVICE_WACOM(0x100) }, | 2205 | { USB_DEVICE_WACOM(0x100) }, |
2203 | { USB_DEVICE_WACOM(0x101) }, | 2206 | { USB_DEVICE_WACOM(0x101) }, |
2207 | { USB_DEVICE_WACOM(0x10D) }, | ||
2204 | { USB_DEVICE_WACOM(0x4001) }, | 2208 | { USB_DEVICE_WACOM(0x4001) }, |
2205 | { USB_DEVICE_WACOM(0x47) }, | 2209 | { USB_DEVICE_WACOM(0x47) }, |
2206 | { USB_DEVICE_WACOM(0xF4) }, | 2210 | { USB_DEVICE_WACOM(0xF4) }, |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 4f702b3ec1a3..434c3df250ca 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -236,7 +236,12 @@ static void __ads7846_disable(struct ads7846 *ts) | |||
236 | /* Must be called with ts->lock held */ | 236 | /* Must be called with ts->lock held */ |
237 | static void __ads7846_enable(struct ads7846 *ts) | 237 | static void __ads7846_enable(struct ads7846 *ts) |
238 | { | 238 | { |
239 | regulator_enable(ts->reg); | 239 | int error; |
240 | |||
241 | error = regulator_enable(ts->reg); | ||
242 | if (error != 0) | ||
243 | dev_err(&ts->spi->dev, "Failed to enable supply: %d\n", error); | ||
244 | |||
240 | ads7846_restart(ts); | 245 | ads7846_restart(ts); |
241 | } | 246 | } |
242 | 247 | ||
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index d04f810cb1dd..59aa24002c7b 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -176,11 +176,17 @@ | |||
176 | /* Define for MXT_GEN_COMMAND_T6 */ | 176 | /* Define for MXT_GEN_COMMAND_T6 */ |
177 | #define MXT_BOOT_VALUE 0xa5 | 177 | #define MXT_BOOT_VALUE 0xa5 |
178 | #define MXT_BACKUP_VALUE 0x55 | 178 | #define MXT_BACKUP_VALUE 0x55 |
179 | #define MXT_BACKUP_TIME 25 /* msec */ | 179 | #define MXT_BACKUP_TIME 50 /* msec */ |
180 | #define MXT_RESET_TIME 65 /* msec */ | 180 | #define MXT_RESET_TIME 200 /* msec */ |
181 | 181 | ||
182 | #define MXT_FWRESET_TIME 175 /* msec */ | 182 | #define MXT_FWRESET_TIME 175 /* msec */ |
183 | 183 | ||
184 | /* MXT_SPT_GPIOPWM_T19 field */ | ||
185 | #define MXT_GPIO0_MASK 0x04 | ||
186 | #define MXT_GPIO1_MASK 0x08 | ||
187 | #define MXT_GPIO2_MASK 0x10 | ||
188 | #define MXT_GPIO3_MASK 0x20 | ||
189 | |||
184 | /* Command to unlock bootloader */ | 190 | /* Command to unlock bootloader */ |
185 | #define MXT_UNLOCK_CMD_MSB 0xaa | 191 | #define MXT_UNLOCK_CMD_MSB 0xaa |
186 | #define MXT_UNLOCK_CMD_LSB 0xdc | 192 | #define MXT_UNLOCK_CMD_LSB 0xdc |
@@ -212,6 +218,8 @@ | |||
212 | /* Touchscreen absolute values */ | 218 | /* Touchscreen absolute values */ |
213 | #define MXT_MAX_AREA 0xff | 219 | #define MXT_MAX_AREA 0xff |
214 | 220 | ||
221 | #define MXT_PIXELS_PER_MM 20 | ||
222 | |||
215 | struct mxt_info { | 223 | struct mxt_info { |
216 | u8 family_id; | 224 | u8 family_id; |
217 | u8 variant_id; | 225 | u8 variant_id; |
@@ -243,6 +251,8 @@ struct mxt_data { | |||
243 | const struct mxt_platform_data *pdata; | 251 | const struct mxt_platform_data *pdata; |
244 | struct mxt_object *object_table; | 252 | struct mxt_object *object_table; |
245 | struct mxt_info info; | 253 | struct mxt_info info; |
254 | bool is_tp; | ||
255 | |||
246 | unsigned int irq; | 256 | unsigned int irq; |
247 | unsigned int max_x; | 257 | unsigned int max_x; |
248 | unsigned int max_y; | 258 | unsigned int max_y; |
@@ -251,6 +261,7 @@ struct mxt_data { | |||
251 | u8 T6_reportid; | 261 | u8 T6_reportid; |
252 | u8 T9_reportid_min; | 262 | u8 T9_reportid_min; |
253 | u8 T9_reportid_max; | 263 | u8 T9_reportid_max; |
264 | u8 T19_reportid; | ||
254 | }; | 265 | }; |
255 | 266 | ||
256 | static bool mxt_object_readable(unsigned int type) | 267 | static bool mxt_object_readable(unsigned int type) |
@@ -502,6 +513,21 @@ static int mxt_write_object(struct mxt_data *data, | |||
502 | return mxt_write_reg(data->client, reg + offset, val); | 513 | return mxt_write_reg(data->client, reg + offset, val); |
503 | } | 514 | } |
504 | 515 | ||
516 | static void mxt_input_button(struct mxt_data *data, struct mxt_message *message) | ||
517 | { | ||
518 | struct input_dev *input = data->input_dev; | ||
519 | bool button; | ||
520 | int i; | ||
521 | |||
522 | /* Active-low switch */ | ||
523 | for (i = 0; i < MXT_NUM_GPIO; i++) { | ||
524 | if (data->pdata->key_map[i] == KEY_RESERVED) | ||
525 | continue; | ||
526 | button = !(message->message[0] & MXT_GPIO0_MASK << i); | ||
527 | input_report_key(input, data->pdata->key_map[i], button); | ||
528 | } | ||
529 | } | ||
530 | |||
505 | static void mxt_input_touchevent(struct mxt_data *data, | 531 | static void mxt_input_touchevent(struct mxt_data *data, |
506 | struct mxt_message *message, int id) | 532 | struct mxt_message *message, int id) |
507 | { | 533 | { |
@@ -585,6 +611,9 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) | |||
585 | int id = reportid - data->T9_reportid_min; | 611 | int id = reportid - data->T9_reportid_min; |
586 | mxt_input_touchevent(data, &message, id); | 612 | mxt_input_touchevent(data, &message, id); |
587 | update_input = true; | 613 | update_input = true; |
614 | } else if (message.reportid == data->T19_reportid) { | ||
615 | mxt_input_button(data, &message); | ||
616 | update_input = true; | ||
588 | } else { | 617 | } else { |
589 | mxt_dump_message(dev, &message); | 618 | mxt_dump_message(dev, &message); |
590 | } | 619 | } |
@@ -764,6 +793,9 @@ static int mxt_get_object_table(struct mxt_data *data) | |||
764 | data->T9_reportid_min = min_id; | 793 | data->T9_reportid_min = min_id; |
765 | data->T9_reportid_max = max_id; | 794 | data->T9_reportid_max = max_id; |
766 | break; | 795 | break; |
796 | case MXT_SPT_GPIOPWM_T19: | ||
797 | data->T19_reportid = min_id; | ||
798 | break; | ||
767 | } | 799 | } |
768 | } | 800 | } |
769 | 801 | ||
@@ -777,7 +809,7 @@ static void mxt_free_object_table(struct mxt_data *data) | |||
777 | data->T6_reportid = 0; | 809 | data->T6_reportid = 0; |
778 | data->T9_reportid_min = 0; | 810 | data->T9_reportid_min = 0; |
779 | data->T9_reportid_max = 0; | 811 | data->T9_reportid_max = 0; |
780 | 812 | data->T19_reportid = 0; | |
781 | } | 813 | } |
782 | 814 | ||
783 | static int mxt_initialize(struct mxt_data *data) | 815 | static int mxt_initialize(struct mxt_data *data) |
@@ -1115,9 +1147,13 @@ static int mxt_probe(struct i2c_client *client, | |||
1115 | goto err_free_mem; | 1147 | goto err_free_mem; |
1116 | } | 1148 | } |
1117 | 1149 | ||
1118 | input_dev->name = "Atmel maXTouch Touchscreen"; | 1150 | data->is_tp = pdata && pdata->is_tp; |
1151 | |||
1152 | input_dev->name = (data->is_tp) ? "Atmel maXTouch Touchpad" : | ||
1153 | "Atmel maXTouch Touchscreen"; | ||
1119 | snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", | 1154 | snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", |
1120 | client->adapter->nr, client->addr); | 1155 | client->adapter->nr, client->addr); |
1156 | |||
1121 | input_dev->phys = data->phys; | 1157 | input_dev->phys = data->phys; |
1122 | 1158 | ||
1123 | input_dev->id.bustype = BUS_I2C; | 1159 | input_dev->id.bustype = BUS_I2C; |
@@ -1140,6 +1176,29 @@ static int mxt_probe(struct i2c_client *client, | |||
1140 | __set_bit(EV_KEY, input_dev->evbit); | 1176 | __set_bit(EV_KEY, input_dev->evbit); |
1141 | __set_bit(BTN_TOUCH, input_dev->keybit); | 1177 | __set_bit(BTN_TOUCH, input_dev->keybit); |
1142 | 1178 | ||
1179 | if (data->is_tp) { | ||
1180 | int i; | ||
1181 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
1182 | __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit); | ||
1183 | |||
1184 | for (i = 0; i < MXT_NUM_GPIO; i++) | ||
1185 | if (pdata->key_map[i] != KEY_RESERVED) | ||
1186 | __set_bit(pdata->key_map[i], input_dev->keybit); | ||
1187 | |||
1188 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | ||
1189 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | ||
1190 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | ||
1191 | __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit); | ||
1192 | __set_bit(BTN_TOOL_QUINTTAP, input_dev->keybit); | ||
1193 | |||
1194 | input_abs_set_res(input_dev, ABS_X, MXT_PIXELS_PER_MM); | ||
1195 | input_abs_set_res(input_dev, ABS_Y, MXT_PIXELS_PER_MM); | ||
1196 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, | ||
1197 | MXT_PIXELS_PER_MM); | ||
1198 | input_abs_set_res(input_dev, ABS_MT_POSITION_Y, | ||
1199 | MXT_PIXELS_PER_MM); | ||
1200 | } | ||
1201 | |||
1143 | /* For single touch */ | 1202 | /* For single touch */ |
1144 | input_set_abs_params(input_dev, ABS_X, | 1203 | input_set_abs_params(input_dev, ABS_X, |
1145 | 0, data->max_x, 0, 0); | 1204 | 0, data->max_x, 0, 0); |
@@ -1258,6 +1317,7 @@ static SIMPLE_DEV_PM_OPS(mxt_pm_ops, mxt_suspend, mxt_resume); | |||
1258 | static const struct i2c_device_id mxt_id[] = { | 1317 | static const struct i2c_device_id mxt_id[] = { |
1259 | { "qt602240_ts", 0 }, | 1318 | { "qt602240_ts", 0 }, |
1260 | { "atmel_mxt_ts", 0 }, | 1319 | { "atmel_mxt_ts", 0 }, |
1320 | { "atmel_mxt_tp", 0 }, | ||
1261 | { "mXT224", 0 }, | 1321 | { "mXT224", 0 }, |
1262 | { } | 1322 | { } |
1263 | }; | 1323 | }; |
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 4a29ddf6bf1e..1443532fe6c4 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c | |||
@@ -314,15 +314,27 @@ static int mms114_start(struct mms114_data *data) | |||
314 | struct i2c_client *client = data->client; | 314 | struct i2c_client *client = data->client; |
315 | int error; | 315 | int error; |
316 | 316 | ||
317 | if (data->core_reg) | 317 | error = regulator_enable(data->core_reg); |
318 | regulator_enable(data->core_reg); | 318 | if (error) { |
319 | if (data->io_reg) | 319 | dev_err(&client->dev, "Failed to enable avdd: %d\n", error); |
320 | regulator_enable(data->io_reg); | 320 | return error; |
321 | } | ||
322 | |||
323 | error = regulator_enable(data->io_reg); | ||
324 | if (error) { | ||
325 | dev_err(&client->dev, "Failed to enable vdd: %d\n", error); | ||
326 | regulator_disable(data->core_reg); | ||
327 | return error; | ||
328 | } | ||
329 | |||
321 | mdelay(MMS114_POWERON_DELAY); | 330 | mdelay(MMS114_POWERON_DELAY); |
322 | 331 | ||
323 | error = mms114_setup_regs(data); | 332 | error = mms114_setup_regs(data); |
324 | if (error < 0) | 333 | if (error < 0) { |
334 | regulator_disable(data->io_reg); | ||
335 | regulator_disable(data->core_reg); | ||
325 | return error; | 336 | return error; |
337 | } | ||
326 | 338 | ||
327 | if (data->pdata->cfg_pin) | 339 | if (data->pdata->cfg_pin) |
328 | data->pdata->cfg_pin(true); | 340 | data->pdata->cfg_pin(true); |
@@ -335,16 +347,20 @@ static int mms114_start(struct mms114_data *data) | |||
335 | static void mms114_stop(struct mms114_data *data) | 347 | static void mms114_stop(struct mms114_data *data) |
336 | { | 348 | { |
337 | struct i2c_client *client = data->client; | 349 | struct i2c_client *client = data->client; |
350 | int error; | ||
338 | 351 | ||
339 | disable_irq(client->irq); | 352 | disable_irq(client->irq); |
340 | 353 | ||
341 | if (data->pdata->cfg_pin) | 354 | if (data->pdata->cfg_pin) |
342 | data->pdata->cfg_pin(false); | 355 | data->pdata->cfg_pin(false); |
343 | 356 | ||
344 | if (data->io_reg) | 357 | error = regulator_disable(data->io_reg); |
345 | regulator_disable(data->io_reg); | 358 | if (error) |
346 | if (data->core_reg) | 359 | dev_warn(&client->dev, "Failed to disable vdd: %d\n", error); |
347 | regulator_disable(data->core_reg); | 360 | |
361 | error = regulator_disable(data->core_reg); | ||
362 | if (error) | ||
363 | dev_warn(&client->dev, "Failed to disable avdd: %d\n", error); | ||
348 | } | 364 | } |
349 | 365 | ||
350 | static int mms114_input_open(struct input_dev *dev) | 366 | static int mms114_input_open(struct input_dev *dev) |