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:

- newer systems with Elan touchpads will be switched over to SMBus

- HP Spectre X360 will be using SMbus/RMI4

- checks for invalid USB descriptors in kbtab and iforce

- build fixes for applespi driver (misconfigs)

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: iforce - add sanity checks
Input: applespi - use struct_size() helper
Input: kbtab - sanity check for endpoint type
Input: usbtouchscreen - initialize PM mutex before using it
Input: applespi - add dependency on LEDS_CLASS
Input: synaptics - enable RMI mode for HP Spectre X360
Input: elantech - annotate fall-through case in elantech_use_host_notify()
Input: elantech - enable SMBus on new (2018+) systems
Input: applespi - fix trivial typo in struct description
Input: applespi - select CRC16 module
Input: applespi - fix warnings detected by sparse

+56 -44
+5
drivers/input/joystick/iforce/iforce-usb.c
··· 201 201 return -ENODEV; 202 202 203 203 epirq = &interface->endpoint[0].desc; 204 + if (!usb_endpoint_is_int_in(epirq)) 205 + return -ENODEV; 206 + 204 207 epout = &interface->endpoint[1].desc; 208 + if (!usb_endpoint_is_int_out(epout)) 209 + return -ENODEV; 205 210 206 211 iforce_usb = kzalloc(sizeof(*iforce_usb), GFP_KERNEL); 207 212 if (!iforce_usb)
+2
drivers/input/keyboard/Kconfig
··· 76 76 depends on ACPI && EFI 77 77 depends on SPI 78 78 depends on X86 || COMPILE_TEST 79 + depends on LEDS_CLASS 80 + select CRC16 79 81 help 80 82 Say Y here if you are running Linux on any Apple MacBook8,1 or later, 81 83 or any MacBookPro13,* or MacBookPro14,*.
+16 -13
drivers/input/keyboard/applespi.c
··· 134 134 * struct tp_finger - single trackpad finger structure, le16-aligned 135 135 * 136 136 * @origin: zero when switching track finger 137 - * @abs_x: absolute x coodinate 138 - * @abs_y: absolute y coodinate 139 - * @rel_x: relative x coodinate 140 - * @rel_y: relative y coodinate 137 + * @abs_x: absolute x coordinate 138 + * @abs_y: absolute y coordinate 139 + * @rel_x: relative x coordinate 140 + * @rel_y: relative y coordinate 141 141 * @tool_major: tool area, major axis 142 142 * @tool_minor: tool area, minor axis 143 143 * @orientation: 16384 when point, else 15 bit angle ··· 944 944 static void applespi_debug_update_dimensions(struct applespi_data *applespi, 945 945 const struct tp_finger *f) 946 946 { 947 - applespi->tp_dim_min_x = min_t(int, applespi->tp_dim_min_x, f->abs_x); 948 - applespi->tp_dim_max_x = max_t(int, applespi->tp_dim_max_x, f->abs_x); 949 - applespi->tp_dim_min_y = min_t(int, applespi->tp_dim_min_y, f->abs_y); 950 - applespi->tp_dim_max_y = max_t(int, applespi->tp_dim_max_y, f->abs_y); 947 + applespi->tp_dim_min_x = min(applespi->tp_dim_min_x, 948 + le16_to_int(f->abs_x)); 949 + applespi->tp_dim_max_x = max(applespi->tp_dim_max_x, 950 + le16_to_int(f->abs_x)); 951 + applespi->tp_dim_min_y = min(applespi->tp_dim_min_y, 952 + le16_to_int(f->abs_y)); 953 + applespi->tp_dim_max_y = max(applespi->tp_dim_max_y, 954 + le16_to_int(f->abs_y)); 951 955 } 952 956 953 957 static int applespi_tp_dim_open(struct inode *inode, struct file *file) ··· 1494 1490 size_t tp_len; 1495 1491 1496 1492 tp = &message->touchpad; 1497 - tp_len = sizeof(*tp) + 1498 - tp->number_of_fingers * sizeof(tp->fingers[0]); 1493 + tp_len = struct_size(tp, fingers, tp->number_of_fingers); 1499 1494 1500 1495 if (le16_to_cpu(message->length) + 2 != tp_len) { 1501 1496 dev_warn_ratelimited(&applespi->spi->dev, ··· 1614 1611 efi_attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | 1615 1612 EFI_VARIABLE_RUNTIME_ACCESS; 1616 1613 1617 - sts = efivar_entry_set_safe(EFI_BL_LEVEL_NAME, efi_guid, efi_attr, true, 1618 - efi_data_len, &efi_data); 1614 + sts = efivar_entry_set_safe((efi_char16_t *)EFI_BL_LEVEL_NAME, efi_guid, 1615 + efi_attr, true, efi_data_len, &efi_data); 1619 1616 if (sts) 1620 1617 dev_warn(&applespi->spi->dev, 1621 1618 "Error saving backlight level to EFI vars: %d\n", sts); ··· 1956 1953 }; 1957 1954 MODULE_DEVICE_TABLE(acpi, applespi_acpi_match); 1958 1955 1959 - const struct dev_pm_ops applespi_pm_ops = { 1956 + static const struct dev_pm_ops applespi_pm_ops = { 1960 1957 SET_SYSTEM_SLEEP_PM_OPS(applespi_suspend, applespi_resume) 1961 1958 .poweroff_late = applespi_poweroff_late, 1962 1959 };
+26 -29
drivers/input/mouse/elantech.c
··· 1827 1827 leave_breadcrumbs); 1828 1828 } 1829 1829 1830 + static bool elantech_use_host_notify(struct psmouse *psmouse, 1831 + struct elantech_device_info *info) 1832 + { 1833 + if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) 1834 + return true; 1835 + 1836 + switch (info->bus) { 1837 + case ETP_BUS_PS2_ONLY: 1838 + /* expected case */ 1839 + break; 1840 + case ETP_BUS_SMB_HST_NTFY_ONLY: 1841 + case ETP_BUS_PS2_SMB_HST_NTFY: 1842 + /* SMbus implementation is stable since 2018 */ 1843 + if (dmi_get_bios_year() >= 2018) 1844 + return true; 1845 + /* fall through */ 1846 + default: 1847 + psmouse_dbg(psmouse, 1848 + "Ignoring SMBus bus provider %d\n", info->bus); 1849 + break; 1850 + } 1851 + 1852 + return false; 1853 + } 1854 + 1830 1855 /** 1831 1856 * elantech_setup_smbus - called once the PS/2 devices are enumerated 1832 1857 * and decides to instantiate a SMBus InterTouch device. ··· 1871 1846 * i2c_blacklist_pnp_ids. 1872 1847 * Old ICs are up to the user to decide. 1873 1848 */ 1874 - if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) || 1849 + if (!elantech_use_host_notify(psmouse, info) || 1875 1850 psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids)) 1876 1851 return -ENXIO; 1877 1852 } ··· 1889 1864 } 1890 1865 1891 1866 return 0; 1892 - } 1893 - 1894 - static bool elantech_use_host_notify(struct psmouse *psmouse, 1895 - struct elantech_device_info *info) 1896 - { 1897 - if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) 1898 - return true; 1899 - 1900 - switch (info->bus) { 1901 - case ETP_BUS_PS2_ONLY: 1902 - /* expected case */ 1903 - break; 1904 - case ETP_BUS_SMB_ALERT_ONLY: 1905 - /* fall-through */ 1906 - case ETP_BUS_PS2_SMB_ALERT: 1907 - psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n"); 1908 - break; 1909 - case ETP_BUS_SMB_HST_NTFY_ONLY: 1910 - /* fall-through */ 1911 - case ETP_BUS_PS2_SMB_HST_NTFY: 1912 - return true; 1913 - default: 1914 - psmouse_dbg(psmouse, 1915 - "Ignoring SMBus bus provider %d.\n", 1916 - info->bus); 1917 - } 1918 - 1919 - return false; 1920 1867 } 1921 1868 1922 1869 int elantech_init_smbus(struct psmouse *psmouse)
+1
drivers/input/mouse/synaptics.c
··· 182 182 "LEN2055", /* E580 */ 183 183 "SYN3052", /* HP EliteBook 840 G4 */ 184 184 "SYN3221", /* HP 15-ay000 */ 185 + "SYN323d", /* HP Spectre X360 13-w013dx */ 185 186 NULL 186 187 }; 187 188
+4 -2
drivers/input/tablet/kbtab.c
··· 117 117 if (intf->cur_altsetting->desc.bNumEndpoints < 1) 118 118 return -ENODEV; 119 119 120 + endpoint = &intf->cur_altsetting->endpoint[0].desc; 121 + if (!usb_endpoint_is_int_in(endpoint)) 122 + return -ENODEV; 123 + 120 124 kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL); 121 125 input_dev = input_allocate_device(); 122 126 if (!kbtab || !input_dev) ··· 158 154 input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0); 159 155 input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0); 160 156 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); 161 - 162 - endpoint = &intf->cur_altsetting->endpoint[0].desc; 163 157 164 158 usb_fill_int_urb(kbtab->irq, dev, 165 159 usb_rcvintpipe(dev, endpoint->bEndpointAddress),
+2
drivers/input/touchscreen/usbtouchscreen.c
··· 1659 1659 if (!usbtouch || !input_dev) 1660 1660 goto out_free; 1661 1661 1662 + mutex_init(&usbtouch->pm_mutex); 1663 + 1662 1664 type = &usbtouch_dev_info[id->driver_info]; 1663 1665 usbtouch->type = type; 1664 1666 if (!type->process_pkt)