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

Pull input fixes from Dmitry Torokhov:
"A few small updates to drivers.

Of note we are now deferring probes of i8042 on some Asus devices as
the controller is not ready to respond to queries first time around
when the driver is compiled into the kernel"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: elants_i2c - do not check Remark ID on eKTH3900/eKTH5312
Input: atmel_mxt_ts - fix double free in mxt_read_info_block
Input: goodix - fix memory leak in goodix_firmware_upload
Input: goodix - add id->model mapping for the "9111" model
Input: goodix - try not to touch the reset-pin on x86/ACPI devices
Input: i8042 - enable deferred probe quirk for ASUS UM325UA
Input: elantech - fix stack out of bound access in elantech_change_report_id()
Input: iqs626a - prohibit inlining of channel parsing functions
Input: i8042 - add deferred probe support

Changed files
+151 -37
Documentation
admin-guide
drivers
+2
Documentation/admin-guide/kernel-parameters.txt
··· 1689 1689 architectures force reset to be always executed 1690 1690 i8042.unlock [HW] Unlock (ignore) the keylock 1691 1691 i8042.kbdreset [HW] Reset device connected to KBD port 1692 + i8042.probe_defer 1693 + [HW] Allow deferred probing upon i8042 probe errors 1692 1694 1693 1695 i810= [HW,DRM] 1694 1696
+12 -9
drivers/input/misc/iqs626a.c
··· 456 456 unsigned int suspend_mode; 457 457 }; 458 458 459 - static int iqs626_parse_events(struct iqs626_private *iqs626, 460 - const struct fwnode_handle *ch_node, 461 - enum iqs626_ch_id ch_id) 459 + static noinline_for_stack int 460 + iqs626_parse_events(struct iqs626_private *iqs626, 461 + const struct fwnode_handle *ch_node, 462 + enum iqs626_ch_id ch_id) 462 463 { 463 464 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; 464 465 struct i2c_client *client = iqs626->client; ··· 605 604 return 0; 606 605 } 607 606 608 - static int iqs626_parse_ati_target(struct iqs626_private *iqs626, 609 - const struct fwnode_handle *ch_node, 610 - enum iqs626_ch_id ch_id) 607 + static noinline_for_stack int 608 + iqs626_parse_ati_target(struct iqs626_private *iqs626, 609 + const struct fwnode_handle *ch_node, 610 + enum iqs626_ch_id ch_id) 611 611 { 612 612 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; 613 613 struct i2c_client *client = iqs626->client; ··· 887 885 return 0; 888 886 } 889 887 890 - static int iqs626_parse_channel(struct iqs626_private *iqs626, 891 - const struct fwnode_handle *ch_node, 892 - enum iqs626_ch_id ch_id) 888 + static noinline_for_stack int 889 + iqs626_parse_channel(struct iqs626_private *iqs626, 890 + const struct fwnode_handle *ch_node, 891 + enum iqs626_ch_id ch_id) 893 892 { 894 893 struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; 895 894 struct i2c_client *client = iqs626->client;
+7 -1
drivers/input/mouse/elantech.c
··· 1588 1588 */ 1589 1589 static int elantech_change_report_id(struct psmouse *psmouse) 1590 1590 { 1591 - unsigned char param[2] = { 0x10, 0x03 }; 1591 + /* 1592 + * NOTE: the code is expecting to receive param[] as an array of 3 1593 + * items (see __ps2_command()), even if in this case only 2 are 1594 + * actually needed. Make sure the array size is 3 to avoid potential 1595 + * stack out-of-bound accesses. 1596 + */ 1597 + unsigned char param[3] = { 0x10, 0x03 }; 1592 1598 1593 1599 if (elantech_write_reg_params(psmouse, 0x7, param) || 1594 1600 elantech_read_reg_params(psmouse, 0x7, param) ||
+21
drivers/input/serio/i8042-x86ia64io.h
··· 995 995 { } 996 996 }; 997 997 998 + static const struct dmi_system_id i8042_dmi_probe_defer_table[] __initconst = { 999 + { 1000 + /* ASUS ZenBook UX425UA */ 1001 + .matches = { 1002 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 1003 + DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX425UA"), 1004 + }, 1005 + }, 1006 + { 1007 + /* ASUS ZenBook UM325UA */ 1008 + .matches = { 1009 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 1010 + DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"), 1011 + }, 1012 + }, 1013 + { } 1014 + }; 1015 + 998 1016 #endif /* CONFIG_X86 */ 999 1017 1000 1018 #ifdef CONFIG_PNP ··· 1332 1314 1333 1315 if (dmi_check_system(i8042_dmi_kbdreset_table)) 1334 1316 i8042_kbdreset = true; 1317 + 1318 + if (dmi_check_system(i8042_dmi_probe_defer_table)) 1319 + i8042_probe_defer = true; 1335 1320 1336 1321 /* 1337 1322 * A20 was already enabled during early kernel init. But some buggy
+35 -19
drivers/input/serio/i8042.c
··· 45 45 module_param_named(unlock, i8042_unlock, bool, 0); 46 46 MODULE_PARM_DESC(unlock, "Ignore keyboard lock."); 47 47 48 + static bool i8042_probe_defer; 49 + module_param_named(probe_defer, i8042_probe_defer, bool, 0); 50 + MODULE_PARM_DESC(probe_defer, "Allow deferred probing."); 51 + 48 52 enum i8042_controller_reset_mode { 49 53 I8042_RESET_NEVER, 50 54 I8042_RESET_ALWAYS, ··· 715 711 * LCS/Telegraphics. 716 712 */ 717 713 718 - static int __init i8042_check_mux(void) 714 + static int i8042_check_mux(void) 719 715 { 720 716 unsigned char mux_version; 721 717 ··· 744 740 /* 745 741 * The following is used to test AUX IRQ delivery. 746 742 */ 747 - static struct completion i8042_aux_irq_delivered __initdata; 748 - static bool i8042_irq_being_tested __initdata; 743 + static struct completion i8042_aux_irq_delivered; 744 + static bool i8042_irq_being_tested; 749 745 750 - static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id) 746 + static irqreturn_t i8042_aux_test_irq(int irq, void *dev_id) 751 747 { 752 748 unsigned long flags; 753 749 unsigned char str, data; ··· 774 770 * verifies success by readinng CTR. Used when testing for presence of AUX 775 771 * port. 776 772 */ 777 - static int __init i8042_toggle_aux(bool on) 773 + static int i8042_toggle_aux(bool on) 778 774 { 779 775 unsigned char param; 780 776 int i; ··· 802 798 * the presence of an AUX interface. 803 799 */ 804 800 805 - static int __init i8042_check_aux(void) 801 + static int i8042_check_aux(void) 806 802 { 807 803 int retval = -1; 808 804 bool irq_registered = false; ··· 1009 1005 1010 1006 if (i8042_command(&ctr[n++ % 2], I8042_CMD_CTL_RCTR)) { 1011 1007 pr_err("Can't read CTR while initializing i8042\n"); 1012 - return -EIO; 1008 + return i8042_probe_defer ? -EPROBE_DEFER : -EIO; 1013 1009 } 1014 1010 1015 1011 } while (n < 2 || ctr[0] != ctr[1]); ··· 1324 1320 i8042_controller_reset(false); 1325 1321 } 1326 1322 1327 - static int __init i8042_create_kbd_port(void) 1323 + static int i8042_create_kbd_port(void) 1328 1324 { 1329 1325 struct serio *serio; 1330 1326 struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; ··· 1353 1349 return 0; 1354 1350 } 1355 1351 1356 - static int __init i8042_create_aux_port(int idx) 1352 + static int i8042_create_aux_port(int idx) 1357 1353 { 1358 1354 struct serio *serio; 1359 1355 int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx; ··· 1390 1386 return 0; 1391 1387 } 1392 1388 1393 - static void __init i8042_free_kbd_port(void) 1389 + static void i8042_free_kbd_port(void) 1394 1390 { 1395 1391 kfree(i8042_ports[I8042_KBD_PORT_NO].serio); 1396 1392 i8042_ports[I8042_KBD_PORT_NO].serio = NULL; 1397 1393 } 1398 1394 1399 - static void __init i8042_free_aux_ports(void) 1395 + static void i8042_free_aux_ports(void) 1400 1396 { 1401 1397 int i; 1402 1398 ··· 1406 1402 } 1407 1403 } 1408 1404 1409 - static void __init i8042_register_ports(void) 1405 + static void i8042_register_ports(void) 1410 1406 { 1411 1407 int i; 1412 1408 ··· 1447 1443 i8042_aux_irq_registered = i8042_kbd_irq_registered = false; 1448 1444 } 1449 1445 1450 - static int __init i8042_setup_aux(void) 1446 + static int i8042_setup_aux(void) 1451 1447 { 1452 1448 int (*aux_enable)(void); 1453 1449 int error; ··· 1489 1485 return error; 1490 1486 } 1491 1487 1492 - static int __init i8042_setup_kbd(void) 1488 + static int i8042_setup_kbd(void) 1493 1489 { 1494 1490 int error; 1495 1491 ··· 1539 1535 return 0; 1540 1536 } 1541 1537 1542 - static int __init i8042_probe(struct platform_device *dev) 1538 + static int i8042_probe(struct platform_device *dev) 1543 1539 { 1544 1540 int error; 1545 1541 ··· 1604 1600 .pm = &i8042_pm_ops, 1605 1601 #endif 1606 1602 }, 1603 + .probe = i8042_probe, 1607 1604 .remove = i8042_remove, 1608 1605 .shutdown = i8042_shutdown, 1609 1606 }; ··· 1615 1610 1616 1611 static int __init i8042_init(void) 1617 1612 { 1618 - struct platform_device *pdev; 1619 1613 int err; 1620 1614 1621 1615 dbg_init(); ··· 1630 1626 /* Set this before creating the dev to allow i8042_command to work right away */ 1631 1627 i8042_present = true; 1632 1628 1633 - pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0); 1634 - if (IS_ERR(pdev)) { 1635 - err = PTR_ERR(pdev); 1629 + err = platform_driver_register(&i8042_driver); 1630 + if (err) 1636 1631 goto err_platform_exit; 1632 + 1633 + i8042_platform_device = platform_device_alloc("i8042", -1); 1634 + if (!i8042_platform_device) { 1635 + err = -ENOMEM; 1636 + goto err_unregister_driver; 1637 1637 } 1638 + 1639 + err = platform_device_add(i8042_platform_device); 1640 + if (err) 1641 + goto err_free_device; 1638 1642 1639 1643 bus_register_notifier(&serio_bus, &i8042_kbd_bind_notifier_block); 1640 1644 panic_blink = i8042_panic_blink; 1641 1645 1642 1646 return 0; 1643 1647 1648 + err_free_device: 1649 + platform_device_put(i8042_platform_device); 1650 + err_unregister_driver: 1651 + platform_driver_unregister(&i8042_driver); 1644 1652 err_platform_exit: 1645 1653 i8042_platform_exit(); 1646 1654 return err;
+1 -1
drivers/input/touchscreen/atmel_mxt_ts.c
··· 1882 1882 if (error) { 1883 1883 dev_err(&client->dev, "Error %d parsing object table\n", error); 1884 1884 mxt_free_object_table(data); 1885 - goto err_free_mem; 1885 + return error; 1886 1886 } 1887 1887 1888 1888 data->object_table = (struct mxt_object *)(id_buf + MXT_OBJECT_START);
+45 -1
drivers/input/touchscreen/elants_i2c.c
··· 117 117 #define ELAN_POWERON_DELAY_USEC 500 118 118 #define ELAN_RESET_DELAY_MSEC 20 119 119 120 + /* FW boot code version */ 121 + #define BC_VER_H_BYTE_FOR_EKTH3900x1_I2C 0x72 122 + #define BC_VER_H_BYTE_FOR_EKTH3900x2_I2C 0x82 123 + #define BC_VER_H_BYTE_FOR_EKTH3900x3_I2C 0x92 124 + #define BC_VER_H_BYTE_FOR_EKTH5312x1_I2C 0x6D 125 + #define BC_VER_H_BYTE_FOR_EKTH5312x2_I2C 0x6E 126 + #define BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C 0x77 127 + #define BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C 0x78 128 + #define BC_VER_H_BYTE_FOR_EKTH5312x1_I2C_USB 0x67 129 + #define BC_VER_H_BYTE_FOR_EKTH5312x2_I2C_USB 0x68 130 + #define BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C_USB 0x74 131 + #define BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C_USB 0x75 132 + 120 133 enum elants_chip_id { 121 134 EKTH3500, 122 135 EKTF3624, ··· 749 736 return 0; 750 737 } 751 738 739 + static bool elants_i2c_should_check_remark_id(struct elants_data *ts) 740 + { 741 + struct i2c_client *client = ts->client; 742 + const u8 bootcode_version = ts->iap_version; 743 + bool check; 744 + 745 + /* I2C eKTH3900 and eKTH5312 are NOT support Remark ID */ 746 + if ((bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x1_I2C) || 747 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x2_I2C) || 748 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x3_I2C) || 749 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x1_I2C) || 750 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x2_I2C) || 751 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C) || 752 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C) || 753 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x1_I2C_USB) || 754 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x2_I2C_USB) || 755 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C_USB) || 756 + (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C_USB)) { 757 + dev_dbg(&client->dev, 758 + "eKTH3900/eKTH5312(0x%02x) are not support remark id\n", 759 + bootcode_version); 760 + check = false; 761 + } else if (bootcode_version >= 0x60) { 762 + check = true; 763 + } else { 764 + check = false; 765 + } 766 + 767 + return check; 768 + } 769 + 752 770 static int elants_i2c_do_update_firmware(struct i2c_client *client, 753 771 const struct firmware *fw, 754 772 bool force) ··· 793 749 u16 send_id; 794 750 int page, n_fw_pages; 795 751 int error; 796 - bool check_remark_id = ts->iap_version >= 0x60; 752 + bool check_remark_id = elants_i2c_should_check_remark_id(ts); 797 753 798 754 /* Recovery mode detection! */ 799 755 if (force) {
+26 -5
drivers/input/touchscreen/goodix.c
··· 102 102 { .id = "911", .data = &gt911_chip_data }, 103 103 { .id = "9271", .data = &gt911_chip_data }, 104 104 { .id = "9110", .data = &gt911_chip_data }, 105 + { .id = "9111", .data = &gt911_chip_data }, 105 106 { .id = "927", .data = &gt911_chip_data }, 106 107 { .id = "928", .data = &gt911_chip_data }, 107 108 ··· 651 650 652 651 usleep_range(6000, 10000); /* T4: > 5ms */ 653 652 654 - /* end select I2C slave addr */ 655 - error = gpiod_direction_input(ts->gpiod_rst); 656 - if (error) 657 - goto error; 653 + /* 654 + * Put the reset pin back in to input / high-impedance mode to save 655 + * power. Only do this in the non ACPI case since some ACPI boards 656 + * don't have a pull-up, so there the reset pin must stay active-high. 657 + */ 658 + if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_GPIO) { 659 + error = gpiod_direction_input(ts->gpiod_rst); 660 + if (error) 661 + goto error; 662 + } 658 663 659 664 return 0; 660 665 ··· 794 787 return -EINVAL; 795 788 } 796 789 790 + /* 791 + * Normally we put the reset pin in input / high-impedance mode to save 792 + * power. But some x86/ACPI boards don't have a pull-up, so for the ACPI 793 + * case, leave the pin as is. This results in the pin not being touched 794 + * at all on x86/ACPI boards, except when needed for error-recover. 795 + */ 796 + ts->gpiod_rst_flags = GPIOD_ASIS; 797 + 797 798 return devm_acpi_dev_add_driver_gpios(dev, gpio_mapping); 798 799 } 799 800 #else ··· 826 811 if (!ts->client) 827 812 return -EINVAL; 828 813 dev = &ts->client->dev; 814 + 815 + /* 816 + * By default we request the reset pin as input, leaving it in 817 + * high-impedance when not resetting the controller to save power. 818 + */ 819 + ts->gpiod_rst_flags = GPIOD_IN; 829 820 830 821 ts->avdd28 = devm_regulator_get(dev, "AVDD28"); 831 822 if (IS_ERR(ts->avdd28)) { ··· 870 849 ts->gpiod_int = gpiod; 871 850 872 851 /* Get the reset line GPIO pin number */ 873 - gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, GPIOD_IN); 852 + gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, ts->gpiod_rst_flags); 874 853 if (IS_ERR(gpiod)) { 875 854 error = PTR_ERR(gpiod); 876 855 if (error != -EPROBE_DEFER)
+1
drivers/input/touchscreen/goodix.h
··· 87 87 struct gpio_desc *gpiod_rst; 88 88 int gpio_count; 89 89 int gpio_int_idx; 90 + enum gpiod_flags gpiod_rst_flags; 90 91 char id[GOODIX_ID_MAX_LEN + 1]; 91 92 char cfg_name[64]; 92 93 u16 version;
+1 -1
drivers/input/touchscreen/goodix_fwupload.c
··· 207 207 208 208 error = goodix_reset_no_int_sync(ts); 209 209 if (error) 210 - return error; 210 + goto release; 211 211 212 212 error = goodix_enter_upload_mode(ts->client); 213 213 if (error)