History

Merge tag 'input-for-v6.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

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

Linus Torvalds committed 11 months ago

Commit ebd97542 parents a6ff0d8 ae8966b8 files · +38 −37Browse files

Unified · Split

8 files
  1. Documentation/input/event-codes.rst +18 −7
  2. drivers/hid/hid-haptic.c +1 −1
  3. drivers/input/keyboard/cros_ec_keyb.c +6 −0
  4. drivers/input/keyboard/imx_sc_key.c +1 −1
  5. drivers/input/tablet/pegasus_notetaker.c +9 −0
  6. drivers/input/touchscreen/goodix.c +2 −26
  7. drivers/input/touchscreen/goodix.h +0 −1
  8. include/uapi/linux/input-event-codes.h +1 −1
Documentation/input/event-codes.rst+18−7
@@ -400,19 +400,30 @@ can report through the rotational axes (absolute and/or relative rx, ry, rz). · 399 unmodified lines
400400 All other axes retain their meaning. A device must not mix
401401 regular directional axes and accelerometer axes on the same event node.
402402
403−INPUT_PROP_HAPTIC_TOUCHPAD
404−--------------------------
403+INPUT_PROP_PRESSUREPAD
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:
405410
406−The INPUT_PROP_HAPTIC_TOUCHPAD property indicates that device:
407−- supports simple haptic auto and manual triggering
408411 - can differentiate between at least 5 fingers
409412 - uses correct resolution for the X/Y (units and value)
410−- reports correct force per touch, and correct units for them (newtons or grams)
411413 - follows the MT protocol type B
412414
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+
413421 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,
415−and report correct units for the pressure.
422+Win8 and Win8.1, and in addition may support the Simple haptic controller HID
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.
416427
417428 Guidelines
418429 ==========
drivers/hid/hid-haptic.c+1−1
@@ -86,7 +86,7 @@ int hid_haptic_input_configured(struct hid_device *hdev, · 85 unmodified lines
8686 if (hi->application == HID_DG_TOUCHPAD) {
8787 if (haptic->auto_trigger_report &&
8888 haptic->manual_trigger_report) {
89− __set_bit(INPUT_PROP_HAPTIC_TOUCHPAD, hi->input->propbit);
89+ __set_bit(INPUT_PROP_PRESSUREPAD, hi->input->propbit);
9090 return 1;
9191 }
9292 return 0;
drivers/input/keyboard/cros_ec_keyb.c+6−0
@@ -261,6 +261,12 @@ static int cros_ec_keyb_work(struct notifier_block *nb, · 260 unmodified lines
261261 case EC_MKBP_EVENT_KEY_MATRIX:
262262 pm_wakeup_event(ckdev->dev, 0);
263263
264+ if (!ckdev->idev) {
265+ dev_warn_once(ckdev->dev,
266+ "Unexpected key matrix event\n");
267+ return NOTIFY_OK;
268+ }
269+
264270 if (ckdev->ec->event_size != ckdev->cols) {
265271 dev_err(ckdev->dev,
266272 "Discarded incomplete key matrix event.\n");
drivers/input/keyboard/imx_sc_key.c+1−1
@@ -158,7 +158,7 @@ static int imx_sc_key_probe(struct platform_device *pdev) · 157 unmodified lines
158158 return error;
159159 }
160160
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);
162162 if (error)
163163 return error;
164164
drivers/input/tablet/pegasus_notetaker.c+9−0
@@ -63,6 +63,9 @@ · 62 unmodified lines
6363 #define BUTTON_PRESSED 0xb5
6464 #define COMMAND_VERSION 0xa9
6565
66+/* 1 Status + 1 Color + 2 X + 2 Y = 6 bytes */
67+#define NOTETAKER_PACKET_SIZE 6
68+
6669 /* in xy data packet */
6770 #define BATTERY_NO_REPORT 0x40
6871 #define BATTERY_LOW 0x41
@@ -311,6 +314,12 @@ static int pegasus_probe(struct usb_interface *intf, · 242 unmodified lines
311314 }
312315
313316 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+ }
314323
315324 pegasus->data = usb_alloc_coherent(dev, pegasus->data_len, GFP_KERNEL,
316325 &pegasus->data_dma);
drivers/input/touchscreen/goodix.c+2−26
@@ -796,17 +796,6 @@ int goodix_reset_no_int_sync(struct goodix_ts_data *ts) · 795 unmodified lines
796796
797797 usleep_range(6000, 10000); /* T4: > 5ms */
798798
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−
810799 return 0;
811800
812801 error:
@@ -957,14 +946,6 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) · 144 unmodified lines
957946 return -EINVAL;
958947 }
959948
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−
968949 return devm_acpi_dev_add_driver_gpios(dev, gpio_mapping);
969950 }
970951 #else
@@ -989,12 +970,6 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts) · 18 unmodified lines
989970 return -EINVAL;
990971 dev = &ts->client->dev;
991972
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−
998973 ts->avdd28 = devm_regulator_get(dev, "AVDD28");
999974 if (IS_ERR(ts->avdd28))
1000975 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
1019994 ts->gpiod_int = gpiod;
1020995
1021996 /* 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);
1023998 if (IS_ERR(gpiod))
1024999 return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
10251000 GOODIX_GPIO_RST_NAME);
@@ -1557,6 +1532,7 @@ MODULE_DEVICE_TABLE(i2c, goodix_ts_id); · 531 unmodified lines
15571532 static const struct acpi_device_id goodix_acpi_match[] = {
15581533 { "GDIX1001", 0 },
15591534 { "GDIX1002", 0 },
1535+ { "GDIX1003", 0 },
15601536 { "GDX9110", 0 },
15611537 { }
15621538 };
drivers/input/touchscreen/goodix.h+0−1
@@ -88,7 +88,6 @@ struct goodix_ts_data { · 87 unmodified lines
8888 struct gpio_desc *gpiod_rst;
8989 int gpio_count;
9090 int gpio_int_idx;
91− enum gpiod_flags gpiod_rst_flags;
9291 char id[GOODIX_ID_MAX_LEN + 1];
9392 char cfg_name[64];
9493 u16 version;
include/uapi/linux/input-event-codes.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
2828 #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
2929 #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 */
3131
3232 #define INPUT_PROP_MAX 0x1f
3333 #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)