@@ -84,6 +84,7 @@ MODULE_LICENSE("GPL");
8484#define MT_QUIRK_KEEP_LATENCY_ON_CLOSE BIT(25)
8585#define MT_QUIRK_HAS_TYPE_COVER_BACKLIGHT BIT(26)
8686#define MT_QUIRK_HAS_TYPE_COVER_TABLET_MODE_SWITCH BIT(27)
87+ #define MT_QUIRK_SKIP_MODESET_ON_HW_OPEN_CLOSE BIT(28)
8788
8889#define MT_INPUTMODE_TOUCHSCREEN 0x02
8990#define MT_INPUTMODE_TOUCHPAD 0x03
@@ -249,6 +250,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app);
249250#define MT_CLS_YOGABOOK9I 0x0115
250251#define MT_CLS_EGALAX_P80H84 0x0116
251252#define MT_CLS_WIN_8_MS_SURFACE_TYPE_COVER 0x0117
253+ #define MT_CLS_SURFACE_TOUCHPAD 0x0118
252254#define MT_CLS_SIS 0x0457
253255
254256#define MT_DEFAULT_MAXCONTACT 10
@@ -479,6 +481,10 @@ static const struct mt_class mt_classes[] = {
479481 MT_QUIRK_WIN8_PTP_BUTTONS ,
480482 .export_all_inputs = true
481483 },
484+ { .name = MT_CLS_SURFACE_TOUCHPAD ,
485+ .quirks = MT_QUIRK_ALWAYS_VALID |
486+ MT_QUIRK_SKIP_MODESET_ON_HW_OPEN_CLOSE
487+ },
482488 { }
483489};
484490
@@ -2276,13 +2282,33 @@ static void mt_remove(struct hid_device *hdev)
22762282
22772283static void mt_on_hid_hw_open (struct hid_device * hdev )
22782284{
2285+ struct mt_device * td = hid_get_drvdata (hdev );
2286+
2287+ /*
2288+ * Some devices (e.g. Surface Laptop Studio 2 touchpad) can get stuck
2289+ * non-functional if we change touchpad reporting modes from the HID
2290+ * open/close hooks. Avoid mode switching on hw_open/hw_close for
2291+ * those devices.
2292+ */
2293+ if (td && td -> mtclass .quirks & MT_QUIRK_SKIP_MODESET_ON_HW_OPEN_CLOSE )
2294+ return ;
2295+
22792296 mt_set_modes (hdev , HID_LATENCY_NORMAL , TOUCHPAD_REPORT_ALL );
22802297}
22812298
22822299static void mt_on_hid_hw_close (struct hid_device * hdev )
22832300{
22842301 struct mt_device * td = hid_get_drvdata (hdev );
22852302
2303+ /*
2304+ * Some devices (e.g. Surface Laptop Studio 2 touchpad) can get stuck
2305+ * non-functional if we change touchpad reporting modes from the HID
2306+ * open/close hooks. Avoid mode switching on hw_open/hw_close for
2307+ * those devices.
2308+ */
2309+ if (td && td -> mtclass .quirks & MT_QUIRK_SKIP_MODESET_ON_HW_OPEN_CLOSE )
2310+ return ;
2311+
22862312 if (td -> mtclass .quirks & MT_QUIRK_KEEP_LATENCY_ON_CLOSE )
22872313 mt_set_modes (hdev , HID_LATENCY_NORMAL , TOUCHPAD_REPORT_NONE );
22882314 else
@@ -2740,6 +2766,11 @@ static const struct hid_device_id mt_devices[] = {
27402766 HID_DEVICE (HID_BUS_ANY , HID_GROUP_ANY ,
27412767 USB_VENDOR_ID_MICROSOFT , 0x09c0 ) },
27422768
2769+ /* Microsoft Surface touch pad */
2770+ { .driver_data = MT_CLS_SURFACE_TOUCHPAD ,
2771+ HID_DEVICE (HID_BUS_ANY , HID_GROUP_ANY ,
2772+ USB_VENDOR_ID_MICROSOFT , 0x0C46 ) },
2773+
27432774 /* Google MT devices */
27442775 { .driver_data = MT_CLS_GOOGLE ,
27452776 HID_DEVICE (HID_BUS_ANY , HID_GROUP_ANY , USB_VENDOR_ID_GOOGLE ,
0 commit comments