Pull input fixes from Dmitry Torokhov: - INPUT_PROP_HAPTIC_TOUCHPAD definition added early in 6.18 cycle has been renamed to INPUT_PROP_PRESSUREPAD to better reflect the kind of devices it is supposed to be set for - a new ID for a touchscreen found in Ayaneo Flip DS in Goodix driver - Goodix driver no longer tries to set reset pin as "input" as it causes issues when there is no pull up resistor installed on the board - fixes for cros_ec_keyb, imx_sc_key, and pegasus-notetaker drivers to deal with potential out-of-bounds access and memory corruption issues * tag 'input-for-v6.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: rename INPUT_PROP_HAPTIC_TOUCHPAD to INPUT_PROP_PRESSUREPAD Input: cros_ec_keyb - fix an invalid memory access Input: imx_sc_key - fix memory corruption on unload Input: pegasus-notetaker - fix potential out-of-bounds access Input: goodix - remove setting of RST pin to input Input: goodix - add support for ACPI ID GDIX1003
Unified · Split
| @@ -400,19 +400,30 @@ can report through the rotational axes (absolute and/or relative rx, ry, rz). · 399 unmodified lines | |||
| 400 | All other axes retain their meaning. A device must not mix | 400 | All other axes retain their meaning. A device must not mix |
| 401 | regular directional axes and accelerometer axes on the same event node. | 401 | regular directional axes and accelerometer axes on the same event node. |
| 402 | 402 | ||
| 403 | INPUT_PROP_HAPTIC_TOUCHPAD | 403 | INPUT_PROP_PRESSUREPAD |
| 404 | -------------------------- | 404 | ---------------------- |
| 405 | |||
| 406 | The INPUT_PROP_PRESSUREPAD property indicates that the device provides | ||
| 407 | simulated haptic feedback (e.g. a vibrator motor situated below the surface) | ||
| 408 | instead of physical haptic feedback (e.g. a hinge). This property is only set | ||
| 409 | if the device: | ||
| 405 | 410 | ||
| 406 | The INPUT_PROP_HAPTIC_TOUCHPAD property indicates that device: | ||
| 407 | - supports simple haptic auto and manual triggering | ||
| 408 | - can differentiate between at least 5 fingers | 411 | - can differentiate between at least 5 fingers |
| 409 | - uses correct resolution for the X/Y (units and value) | 412 | - uses correct resolution for the X/Y (units and value) |
| 410 | - reports correct force per touch, and correct units for them (newtons or grams) | ||
| 411 | - follows the MT protocol type B | 413 | - follows the MT protocol type B |
| 412 | 414 | ||
| 415 | If the simulated haptic feedback is controllable by userspace the device must: | ||
| 416 | |||
| 417 | - support simple haptic auto and manual triggering, and | ||
| 418 | - report correct force per touch, and correct units for them (newtons or grams), and | ||
| 419 | - provide the EV_FF FF_HAPTIC force feedback effect. | ||
| 420 | |||
| 413 | Summing up, such devices follow the MS spec for input devices in | 421 | Summing up, such devices follow the MS spec for input devices in |
| 414 | Win8 and Win8.1, and in addition support the Simple haptic controller HID table, | 422 | Win8 and Win8.1, and in addition may support the Simple haptic controller HID |
| 415 | and report correct units for the pressure. | 423 | table, and report correct units for the pressure. |
| 424 | |||
| 425 | Where applicable, this property is set in addition to INPUT_PROP_BUTTONPAD, it | ||
| 426 | does not replace that property. | ||
| 416 | 427 | ||
| 417 | Guidelines | 428 | Guidelines |
| 418 | ========== | 429 | ========== |
| @@ -86,7 +86,7 @@ int hid_haptic_input_configured(struct hid_device *hdev, · 85 unmodified lines | |||
| 86 | if (hi->application == HID_DG_TOUCHPAD) { | 86 | if (hi->application == HID_DG_TOUCHPAD) { |
| 87 | if (haptic->auto_trigger_report && | 87 | if (haptic->auto_trigger_report && |
| 88 | haptic->manual_trigger_report) { | 88 | haptic->manual_trigger_report) { |
| 89 | __set_bit(INPUT_PROP_HAPTIC_TOUCHPAD, hi->input->propbit); | 89 | __set_bit(INPUT_PROP_PRESSUREPAD, hi->input->propbit); |
| 90 | return 1; | 90 | return 1; |
| 91 | } | 91 | } |
| 92 | return 0; | 92 | return 0; |
| @@ -261,6 +261,12 @@ static int cros_ec_keyb_work(struct notifier_block *nb, · 260 unmodified lines | |||
| 261 | case EC_MKBP_EVENT_KEY_MATRIX: | 261 | case EC_MKBP_EVENT_KEY_MATRIX: |
| 262 | pm_wakeup_event(ckdev->dev, 0); | 262 | pm_wakeup_event(ckdev->dev, 0); |
| 263 | 263 | ||
| 264 | if (!ckdev->idev) { | ||
| 265 | dev_warn_once(ckdev->dev, | ||
| 266 | "Unexpected key matrix event\n"); | ||
| 267 | return NOTIFY_OK; | ||
| 268 | } | ||
| 269 | |||
| 264 | if (ckdev->ec->event_size != ckdev->cols) { | 270 | if (ckdev->ec->event_size != ckdev->cols) { |
| 265 | dev_err(ckdev->dev, | 271 | dev_err(ckdev->dev, |
| 266 | "Discarded incomplete key matrix event.\n"); | 272 | "Discarded incomplete key matrix event.\n"); |
| @@ -158,7 +158,7 @@ static int imx_sc_key_probe(struct platform_device *pdev) · 157 unmodified lines | |||
| 158 | return error; | 158 | return error; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action, &priv); | 161 | error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action, priv); |
| 162 | if (error) | 162 | if (error) |
| 163 | return error; | 163 | return error; |
| 164 | 164 | ||
| @@ -63,6 +63,9 @@ · 62 unmodified lines | |||
| 63 | #define BUTTON_PRESSED 0xb5 | 63 | #define BUTTON_PRESSED 0xb5 |
| 64 | #define COMMAND_VERSION 0xa9 | 64 | #define COMMAND_VERSION 0xa9 |
| 65 | 65 | ||
| 66 | /* 1 Status + 1 Color + 2 X + 2 Y = 6 bytes */ | ||
| 67 | #define NOTETAKER_PACKET_SIZE 6 | ||
| 68 | |||
| 66 | /* in xy data packet */ | 69 | /* in xy data packet */ |
| 67 | #define BATTERY_NO_REPORT 0x40 | 70 | #define BATTERY_NO_REPORT 0x40 |
| 68 | #define BATTERY_LOW 0x41 | 71 | #define BATTERY_LOW 0x41 |
| @@ -311,6 +314,12 @@ static int pegasus_probe(struct usb_interface *intf, · 242 unmodified lines | |||
| 311 | } | 314 | } |
| 312 | 315 | ||
| 313 | pegasus->data_len = usb_maxpacket(dev, pipe); | 316 | pegasus->data_len = usb_maxpacket(dev, pipe); |
| 317 | if (pegasus->data_len < NOTETAKER_PACKET_SIZE) { | ||
| 318 | dev_err(&intf->dev, "packet size is too small (%d)\n", | ||
| 319 | pegasus->data_len); | ||
| 320 | error = -EINVAL; | ||
| 321 | goto err_free_mem; | ||
| 322 | } | ||
| 314 | 323 | ||
| 315 | pegasus->data = usb_alloc_coherent(dev, pegasus->data_len, GFP_KERNEL, | 324 | pegasus->data = usb_alloc_coherent(dev, pegasus->data_len, GFP_KERNEL, |
| 316 | &pegasus->data_dma); | 325 | &pegasus->data_dma); |
| @@ -796,17 +796,6 @@ int goodix_reset_no_int_sync(struct goodix_ts_data *ts) · 795 unmodified lines | |||
| 796 | 796 | ||
| 797 | usleep_range(6000, 10000); /* T4: > 5ms */ | 797 | usleep_range(6000, 10000); /* T4: > 5ms */ |
| 798 | 798 | ||
| 799 | /* | ||
| 800 | * Put the reset pin back in to input / high-impedance mode to save | ||
| 801 | * power. Only do this in the non ACPI case since some ACPI boards | ||
| 802 | * don't have a pull-up, so there the reset pin must stay active-high. | ||
| 803 | */ | ||
| 804 | if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_GPIO) { | ||
| 805 | error = gpiod_direction_input(ts->gpiod_rst); | ||
| 806 | if (error) | ||
| 807 | goto error; | ||
| 808 | } | ||
| 809 | |||
| 810 | return 0; | 799 | return 0; |
| 811 | 800 | ||
| 812 | error: | 801 | error: |
| @@ -957,14 +946,6 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) · 144 unmodified lines | |||
| 957 | return -EINVAL; | 946 | return -EINVAL; |
| 958 | } | 947 | } |
| 959 | 948 | ||
| 960 | /* | ||
| 961 | * Normally we put the reset pin in input / high-impedance mode to save | ||
| 962 | * power. But some x86/ACPI boards don't have a pull-up, so for the ACPI | ||
| 963 | * case, leave the pin as is. This results in the pin not being touched | ||
| 964 | * at all on x86/ACPI boards, except when needed for error-recover. | ||
| 965 | */ | ||
| 966 | ts->gpiod_rst_flags = GPIOD_ASIS; | ||
| 967 | |||
| 968 | return devm_acpi_dev_add_driver_gpios(dev, gpio_mapping); | 949 | return devm_acpi_dev_add_driver_gpios(dev, gpio_mapping); |
| 969 | } | 950 | } |
| 970 | #else | 951 | #else |
| @@ -989,12 +970,6 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts) · 18 unmodified lines | |||
| 989 | return -EINVAL; | 970 | return -EINVAL; |
| 990 | dev = &ts->client->dev; | 971 | dev = &ts->client->dev; |
| 991 | 972 | ||
| 992 | /* | ||
| 993 | * By default we request the reset pin as input, leaving it in | ||
| 994 | * high-impedance when not resetting the controller to save power. | ||
| 995 | */ | ||
| 996 | ts->gpiod_rst_flags = GPIOD_IN; | ||
| 997 | |||
| 998 | ts->avdd28 = devm_regulator_get(dev, "AVDD28"); | 973 | ts->avdd28 = devm_regulator_get(dev, "AVDD28"); |
| 999 | if (IS_ERR(ts->avdd28)) | 974 | if (IS_ERR(ts->avdd28)) |
| 1000 | return dev_err_probe(dev, PTR_ERR(ts->avdd28), "Failed to get AVDD28 regulator\n"); | 975 | return dev_err_probe(dev, PTR_ERR(ts->avdd28), "Failed to get AVDD28 regulator\n"); |
| @@ -1019,7 +994,7 @@ retry_get_irq_gpio: · 18 unmodified lines | |||
| 1019 | ts->gpiod_int = gpiod; | 994 | ts->gpiod_int = gpiod; |
| 1020 | 995 | ||
| 1021 | /* Get the reset line GPIO pin number */ | 996 | /* Get the reset line GPIO pin number */ |
| 1022 | gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, ts->gpiod_rst_flags); | 997 | gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, GPIOD_ASIS); |
| 1023 | if (IS_ERR(gpiod)) | 998 | if (IS_ERR(gpiod)) |
| 1024 | return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n", | 999 | return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n", |
| 1025 | GOODIX_GPIO_RST_NAME); | 1000 | GOODIX_GPIO_RST_NAME); |
| @@ -1557,6 +1532,7 @@ MODULE_DEVICE_TABLE(i2c, goodix_ts_id); · 531 unmodified lines | |||
| 1557 | static const struct acpi_device_id goodix_acpi_match[] = { | 1532 | static const struct acpi_device_id goodix_acpi_match[] = { |
| 1558 | { "GDIX1001", 0 }, | 1533 | { "GDIX1001", 0 }, |
| 1559 | { "GDIX1002", 0 }, | 1534 | { "GDIX1002", 0 }, |
| 1535 | { "GDIX1003", 0 }, | ||
| 1560 | { "GDX9110", 0 }, | 1536 | { "GDX9110", 0 }, |
| 1561 | { } | 1537 | { } |
| 1562 | }; | 1538 | }; |
| @@ -88,7 +88,6 @@ struct goodix_ts_data { · 87 unmodified lines | |||
| 88 | struct gpio_desc *gpiod_rst; | 88 | struct gpio_desc *gpiod_rst; |
| 89 | int gpio_count; | 89 | int gpio_count; |
| 90 | int gpio_int_idx; | 90 | int gpio_int_idx; |
| 91 | enum gpiod_flags gpiod_rst_flags; | ||
| 92 | char id[GOODIX_ID_MAX_LEN + 1]; | 91 | char id[GOODIX_ID_MAX_LEN + 1]; |
| 93 | char cfg_name[64]; | 92 | char cfg_name[64]; |
| 94 | u16 version; | 93 | u16 version; |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | |||
| 27 | #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ | 27 | #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ |
| 28 | #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ | 28 | #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ |
| 29 | #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ | 29 | #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ |
| 30 | #define INPUT_PROP_HAPTIC_TOUCHPAD 0x07 /* is a haptic touchpad */ | 30 | #define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */ |
| 31 | 31 | ||
| 32 | #define INPUT_PROP_MAX 0x1f | 32 | #define INPUT_PROP_MAX 0x1f |
| 33 | #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) | 33 | #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) |