Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:
"Except for the largish change to the ALPS driver adding "Dolphin V1"
support and Wacom getting a new signature of yet another device, the
rest are straightforward driver fixes."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: mms114 - Fix regulator enable and disable paths
Input: ads7864 - check return value of regulator enable
Input: tc3589x-keypad - fix keymap size
Input: wacom - add support for 0x10d
Input: ALPS - update documentation for recent touchpad driver mods
Input: ALPS - add "Dolphin V1" touchpad support
Input: ALPS - remove unused argument to alps_enter_command_mode()
Input: cypress_ps2 - fix trackpadi found in Dell XPS12

+184 -39
+59 -6
Documentation/input/alps.txt
··· 3 3 4 4 Introduction 5 5 ------------ 6 + Currently the ALPS touchpad driver supports five protocol versions in use by 7 + ALPS touchpads, called versions 1, 2, 3, 4 and 5. 6 8 7 - Currently the ALPS touchpad driver supports four protocol versions in use by 8 - ALPS touchpads, called versions 1, 2, 3, and 4. Information about the various 9 - protocol versions is contained in the following sections. 9 + Since roughly mid-2010 several new ALPS touchpads have been released and 10 + integrated into a variety of laptops and netbooks. These new touchpads 11 + have enough behavior differences that the alps_model_data definition 12 + table, describing the properties of the different versions, is no longer 13 + adequate. The design choices were to re-define the alps_model_data 14 + table, with the risk of regression testing existing devices, or isolate 15 + the new devices outside of the alps_model_data table. The latter design 16 + choice was made. The new touchpad signatures are named: "Rushmore", 17 + "Pinnacle", and "Dolphin", which you will see in the alps.c code. 18 + For the purposes of this document, this group of ALPS touchpads will 19 + generically be called "new ALPS touchpads". 20 + 21 + We experimented with probing the ACPI interface _HID (Hardware ID)/_CID 22 + (Compatibility ID) definition as a way to uniquely identify the 23 + different ALPS variants but there did not appear to be a 1:1 mapping. 24 + In fact, it appeared to be an m:n mapping between the _HID and actual 25 + hardware type. 10 26 11 27 Detection 12 28 --------- ··· 36 20 report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is 37 21 matched against known models in the alps_model_data_array. 38 22 39 - With protocol versions 3 and 4, the E7 report model signature is always 40 - 73-02-64. To differentiate between these versions, the response from the 41 - "Enter Command Mode" sequence must be inspected as described below. 23 + For older touchpads supporting protocol versions 3 and 4, the E7 report 24 + model signature is always 73-02-64. To differentiate between these 25 + versions, the response from the "Enter Command Mode" sequence must be 26 + inspected as described below. 27 + 28 + The new ALPS touchpads have an E7 signature of 73-03-50 or 73-03-0A but 29 + seem to be better differentiated by the EC Command Mode response. 42 30 43 31 Command Mode 44 32 ------------ ··· 66 46 address of the register being read, and the third contains the value of the 67 47 register. Registers are written by writing the value one nibble at a time 68 48 using the same encoding used for addresses. 49 + 50 + For the new ALPS touchpads, the EC command is used to enter command 51 + mode. The response in the new ALPS touchpads is significantly different, 52 + and more important in determining the behavior. This code has been 53 + separated from the original alps_model_data table and put in the 54 + alps_identify function. For example, there seem to be two hardware init 55 + sequences for the "Dolphin" touchpads as determined by the second byte 56 + of the EC response. 69 57 70 58 Packet Format 71 59 ------------- ··· 215 187 well. 216 188 217 189 So far no v4 devices with tracksticks have been encountered. 190 + 191 + ALPS Absolute Mode - Protocol Version 5 192 + --------------------------------------- 193 + This is basically Protocol Version 3 but with different logic for packet 194 + decode. It uses the same alps_process_touchpad_packet_v3 call with a 195 + specialized decode_fields function pointer to correctly interpret the 196 + packets. This appears to only be used by the Dolphin devices. 197 + 198 + For single-touch, the 6-byte packet format is: 199 + 200 + byte 0: 1 1 0 0 1 0 0 0 201 + byte 1: 0 x6 x5 x4 x3 x2 x1 x0 202 + byte 2: 0 y6 y5 y4 y3 y2 y1 y0 203 + byte 3: 0 M R L 1 m r l 204 + byte 4: y10 y9 y8 y7 x10 x9 x8 x7 205 + byte 5: 0 z6 z5 z4 z3 z2 z1 z0 206 + 207 + For mt, the format is: 208 + 209 + byte 0: 1 1 1 n3 1 n2 n1 x24 210 + byte 1: 1 y7 y6 y5 y4 y3 y2 y1 211 + byte 2: ? x2 x1 y12 y11 y10 y9 y8 212 + byte 3: 0 x23 x22 x21 x20 x19 x18 x17 213 + byte 4: 0 x9 x8 x7 x6 x5 x4 x3 214 + byte 5: 0 x16 x15 x14 x13 x12 x11 x10
+4 -4
drivers/input/keyboard/tc3589x-keypad.c
··· 70 70 #define TC3589x_EVT_INT_CLR 0x2 71 71 #define TC3589x_KBD_INT_CLR 0x1 72 72 73 - #define TC3589x_KBD_KEYMAP_SIZE 64 74 - 75 73 /** 76 74 * struct tc_keypad - data structure used by keypad driver 77 75 * @tc3589x: pointer to tc35893 ··· 86 88 const struct tc3589x_keypad_platform_data *board; 87 89 unsigned int krow; 88 90 unsigned int kcol; 89 - unsigned short keymap[TC3589x_KBD_KEYMAP_SIZE]; 91 + unsigned short *keymap; 90 92 bool keypad_stopped; 91 93 }; 92 94 ··· 336 338 337 339 error = matrix_keypad_build_keymap(plat->keymap_data, NULL, 338 340 TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL, 339 - keypad->keymap, input); 341 + NULL, input); 340 342 if (error) { 341 343 dev_err(&pdev->dev, "Failed to build keymap\n"); 342 344 goto err_free_mem; 343 345 } 346 + 347 + keypad->keymap = input->keycode; 344 348 345 349 input_set_capability(input, EV_MSC, MSC_SCAN); 346 350 if (!plat->no_autorepeat)
+72 -13
drivers/input/mouse/alps.c
··· 490 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 516 static void alps_process_touchpad_packet_v3(struct psmouse *psmouse) 494 517 { 495 518 struct alps_data *priv = psmouse->private; ··· 897 874 } 898 875 899 876 /* Bytes 2 - pktsize should have 0 in the highest bit */ 900 - if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && 877 + if (priv->proto_version != ALPS_PROTO_V5 && 878 + psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && 901 879 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { 902 880 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", 903 881 psmouse->pktcnt - 1, ··· 1018 994 return 0; 1019 995 } 1020 996 1021 - static int alps_enter_command_mode(struct psmouse *psmouse, 1022 - unsigned char *resp) 997 + static int alps_enter_command_mode(struct psmouse *psmouse) 1023 998 { 1024 999 unsigned char param[4]; 1025 1000 ··· 1027 1004 return -1; 1028 1005 } 1029 1006 1030 - if (param[0] != 0x88 || (param[1] != 0x07 && param[1] != 0x08)) { 1007 + if ((param[0] != 0x88 || (param[1] != 0x07 && param[1] != 0x08)) && 1008 + param[0] != 0x73) { 1031 1009 psmouse_dbg(psmouse, 1032 1010 "unknown response while entering command mode\n"); 1033 1011 return -1; 1034 1012 } 1035 - 1036 - if (resp) 1037 - *resp = param[2]; 1038 1013 return 0; 1039 1014 } 1040 1015 ··· 1197 1176 { 1198 1177 int reg_val, ret = -1; 1199 1178 1200 - if (alps_enter_command_mode(psmouse, NULL)) 1179 + if (alps_enter_command_mode(psmouse)) 1201 1180 return -1; 1202 1181 1203 1182 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x0008); ··· 1237 1216 { 1238 1217 int ret = -EIO, reg_val; 1239 1218 1240 - if (alps_enter_command_mode(psmouse, NULL)) 1219 + if (alps_enter_command_mode(psmouse)) 1241 1220 goto error; 1242 1221 1243 1222 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08); ··· 1300 1279 * supported by this driver. If bit 1 isn't set the packet 1301 1280 * format is different. 1302 1281 */ 1303 - if (alps_enter_command_mode(psmouse, NULL) || 1282 + if (alps_enter_command_mode(psmouse) || 1304 1283 alps_command_mode_write_reg(psmouse, 1305 1284 reg_base + 0x08, 0x82) || 1306 1285 alps_exit_command_mode(psmouse)) ··· 1327 1306 alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO) 1328 1307 goto error; 1329 1308 1330 - if (alps_enter_command_mode(psmouse, NULL) || 1309 + if (alps_enter_command_mode(psmouse) || 1331 1310 alps_absolute_mode_v3(psmouse)) { 1332 1311 psmouse_err(psmouse, "Failed to enter absolute mode\n"); 1333 1312 goto error; ··· 1402 1381 priv->flags &= ~ALPS_DUALPOINT; 1403 1382 } 1404 1383 1405 - if (alps_enter_command_mode(psmouse, NULL) || 1384 + if (alps_enter_command_mode(psmouse) || 1406 1385 alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 || 1407 1386 alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00)) 1408 1387 goto error; ··· 1452 1431 struct ps2dev *ps2dev = &psmouse->ps2dev; 1453 1432 unsigned char param[4]; 1454 1433 1455 - if (alps_enter_command_mode(psmouse, NULL)) 1434 + if (alps_enter_command_mode(psmouse)) 1456 1435 goto error; 1457 1436 1458 1437 if (alps_absolute_mode_v4(psmouse)) { ··· 1520 1499 return -1; 1521 1500 } 1522 1501 1502 + static int alps_hw_init_dolphin_v1(struct psmouse *psmouse) 1503 + { 1504 + struct ps2dev *ps2dev = &psmouse->ps2dev; 1505 + unsigned char param[2]; 1506 + 1507 + /* This is dolphin "v1" as empirically defined by florin9doi */ 1508 + param[0] = 0x64; 1509 + param[1] = 0x28; 1510 + 1511 + if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM) || 1512 + ps2_command(ps2dev, &param[0], PSMOUSE_CMD_SETRATE) || 1513 + ps2_command(ps2dev, &param[1], PSMOUSE_CMD_SETRATE)) 1514 + return -1; 1515 + 1516 + return 0; 1517 + } 1518 + 1523 1519 static void alps_set_defaults(struct alps_data *priv) 1524 1520 { 1525 1521 priv->byte0 = 0x8f; ··· 1569 1531 priv->set_abs_params = alps_set_abs_params_mt; 1570 1532 priv->nibble_commands = alps_v4_nibble_commands; 1571 1533 priv->addr_command = PSMOUSE_CMD_DISABLE; 1534 + break; 1535 + case ALPS_PROTO_V5: 1536 + priv->hw_init = alps_hw_init_dolphin_v1; 1537 + priv->process_packet = alps_process_packet_v3; 1538 + priv->decode_fields = alps_decode_dolphin; 1539 + priv->set_abs_params = alps_set_abs_params_mt; 1540 + priv->nibble_commands = alps_v3_nibble_commands; 1541 + priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 1542 + priv->byte0 = 0xc8; 1543 + priv->mask0 = 0xc8; 1544 + priv->flags = 0; 1545 + priv->x_max = 1360; 1546 + priv->y_max = 660; 1547 + priv->x_bits = 23; 1548 + priv->y_bits = 12; 1572 1549 break; 1573 1550 } 1574 1551 } ··· 1644 1591 return -EIO; 1645 1592 1646 1593 if (alps_match_table(psmouse, priv, e7, ec) == 0) { 1594 + return 0; 1595 + } else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 && 1596 + ec[0] == 0x73 && ec[1] == 0x01) { 1597 + priv->proto_version = ALPS_PROTO_V5; 1598 + alps_set_defaults(priv); 1599 + 1647 1600 return 0; 1648 1601 } else if (ec[0] == 0x88 && ec[1] == 0x08) { 1649 1602 priv->proto_version = ALPS_PROTO_V3;
+1
drivers/input/mouse/alps.h
··· 16 16 #define ALPS_PROTO_V2 2 17 17 #define ALPS_PROTO_V3 3 18 18 #define ALPS_PROTO_V4 4 19 + #define ALPS_PROTO_V5 5 19 20 20 21 /** 21 22 * struct alps_model_info - touchpad ID table
+13 -6
drivers/input/mouse/cypress_ps2.c
··· 236 236 cytp->fw_version = param[2] & FW_VERSION_MASX; 237 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 246 psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version); 240 247 psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n", 241 248 cytp->tp_metrics_supported); ··· 264 257 cytp->tp_max_pressure = CYTP_MAX_PRESSURE; 265 258 cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width; 266 259 cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high; 260 + 261 + if (!cytp->tp_metrics_supported) 262 + return 0; 267 263 268 264 memset(param, 0, sizeof(param)); 269 265 if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) { ··· 325 315 326 316 static int cypress_query_hardware(struct psmouse *psmouse) 327 317 { 328 - struct cytp_data *cytp = psmouse->private; 329 318 int ret; 330 319 331 320 ret = cypress_read_fw_version(psmouse); 332 321 if (ret) 333 322 return ret; 334 323 335 - if (cytp->tp_metrics_supported) { 336 - ret = cypress_read_tp_metrics(psmouse); 337 - if (ret) 338 - return ret; 339 - } 324 + ret = cypress_read_tp_metrics(psmouse); 325 + if (ret) 326 + return ret; 340 327 341 328 return 0; 342 329 }
+4
drivers/input/tablet/wacom_wac.c
··· 2017 2017 static const struct wacom_features wacom_features_0x101 = 2018 2018 { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, 2019 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 2023 static const struct wacom_features wacom_features_0x4001 = 2021 2024 { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, 2022 2025 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ··· 2204 2201 { USB_DEVICE_WACOM(0xEF) }, 2205 2202 { USB_DEVICE_WACOM(0x100) }, 2206 2203 { USB_DEVICE_WACOM(0x101) }, 2204 + { USB_DEVICE_WACOM(0x10D) }, 2207 2205 { USB_DEVICE_WACOM(0x4001) }, 2208 2206 { USB_DEVICE_WACOM(0x47) }, 2209 2207 { USB_DEVICE_WACOM(0xF4) },
+6 -1
drivers/input/touchscreen/ads7846.c
··· 236 236 /* Must be called with ts->lock held */ 237 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 245 ads7846_restart(ts); 241 246 } 242 247
+25 -9
drivers/input/touchscreen/mms114.c
··· 314 314 struct i2c_client *client = data->client; 315 315 int error; 316 316 317 - if (data->core_reg) 318 - regulator_enable(data->core_reg); 319 - if (data->io_reg) 320 - regulator_enable(data->io_reg); 317 + error = regulator_enable(data->core_reg); 318 + if (error) { 319 + dev_err(&client->dev, "Failed to enable avdd: %d\n", error); 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 330 mdelay(MMS114_POWERON_DELAY); 322 331 323 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 336 return error; 337 + } 326 338 327 339 if (data->pdata->cfg_pin) 328 340 data->pdata->cfg_pin(true); ··· 347 335 static void mms114_stop(struct mms114_data *data) 348 336 { 349 337 struct i2c_client *client = data->client; 338 + int error; 350 339 351 340 disable_irq(client->irq); 352 341 353 342 if (data->pdata->cfg_pin) 354 343 data->pdata->cfg_pin(false); 355 344 356 - if (data->io_reg) 357 - regulator_disable(data->io_reg); 358 - if (data->core_reg) 359 - regulator_disable(data->core_reg); 345 + error = regulator_disable(data->io_reg); 346 + if (error) 347 + dev_warn(&client->dev, "Failed to disable vdd: %d\n", error); 348 + 349 + error = regulator_disable(data->core_reg); 350 + if (error) 351 + dev_warn(&client->dev, "Failed to disable avdd: %d\n", error); 360 352 } 361 353 362 354 static int mms114_input_open(struct input_dev *dev)