From: Jiri Kosina Date: Mon, 18 Nov 2024 20:29:33 +0000 (+0100) Subject: Merge branch 'for-6.13/wacom' into for-linus X-Git-Tag: v6.13-rc1~150^2~11 X-Git-Url: https://repo.jachan.dev/linux.git/commitdiff_plain/f33e46a0c6bddd341d0989484a2546bba7ac4a3c?hp=-c Merge branch 'for-6.13/wacom' into for-linus - Sanitization of BTN_TOOL_RUBBER handling (Jason Gerecke) --- f33e46a0c6bddd341d0989484a2546bba7ac4a3c diff --combined drivers/hid/hid-core.c index 4aee4eae50fd,612ee6ddfc8d..582fd234eec7 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@@ -20,7 -20,7 +20,7 @@@ #include #include #include - #include + #include #include #include #include @@@ -1875,7 -1875,7 +1875,7 @@@ u8 *hid_alloc_report_buf(struct hid_rep u32 len = hid_report_len(report) + 7; - return kmalloc(len, flags); + return kzalloc(len, flags); } EXPORT_SYMBOL_GPL(hid_alloc_report_buf); diff --combined drivers/hid/i2c-hid/i2c-hid-core.c index 8914c7db9471,be5d342d5d13..43664a24176f --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@@ -36,7 -36,7 +36,7 @@@ #include #include #include - #include + #include #include @@@ -50,7 -50,6 +50,7 @@@ #define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(3) #define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(4) #define I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND BIT(5) +#define I2C_HID_QUIRK_DELAY_WAKEUP_AFTER_RESUME BIT(6) /* Command opcodes */ #define I2C_HID_OPCODE_RESET 0x01 @@@ -141,8 -140,6 +141,8 @@@ static const struct i2c_hid_quirks { USB_VENDOR_ID_ELAN, HID_ANY_ID, I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET | I2C_HID_QUIRK_BOGUS_IRQ }, + { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_0D42, + I2C_HID_QUIRK_DELAY_WAKEUP_AFTER_RESUME }, { 0, 0 } }; @@@ -984,13 -981,6 +984,13 @@@ static int i2c_hid_core_resume(struct i return -ENXIO; } + /* On Goodix 27c6:0d42 wait extra time before device wakeup. + * It's not clear why but if we send wakeup too early, the device will + * never trigger input interrupts. + */ + if (ihid->quirks & I2C_HID_QUIRK_DELAY_WAKEUP_AFTER_RESUME) + msleep(1500); + /* Instead of resetting device, simply powers the device on. This * solves "incomplete reports" on Raydium devices 2386:3118 and * 2386:4B33 and fixes various SIS touchscreens no longer sending diff --combined drivers/hid/wacom_wac.c index 5a599c90e7a2,fd0de9bae3d9..5501a560fb07 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@@ -1353,9 -1353,9 +1353,9 @@@ static void wacom_intuos_pro2_bt_pen(st rotation -= 1800; input_report_abs(pen_input, ABS_TILT_X, - (char)frame[7]); + (signed char)frame[7]); input_report_abs(pen_input, ABS_TILT_Y, - (char)frame[8]); + (signed char)frame[8]); input_report_abs(pen_input, ABS_Z, rotation); input_report_abs(pen_input, ABS_WHEEL, get_unaligned_le16(&frame[11])); @@@ -2422,9 -2422,11 +2422,11 @@@ static void wacom_wac_pen_event(struct wacom_wac->hid_data.sense_state = value; return; case HID_DG_INVERT: - wacom_wac->hid_data.invert_state = value; + wacom_wac->hid_data.eraser |= value; return; case HID_DG_ERASER: + wacom_wac->hid_data.eraser |= value; + fallthrough; case HID_DG_TIPSWITCH: wacom_wac->hid_data.tipswitch |= value; return; @@@ -2565,7 -2567,7 +2567,7 @@@ static void wacom_wac_pen_report(struc if (entering_range) { /* first in range */ /* Going into range select tool */ - if (wacom_wac->hid_data.invert_state) + if (wacom_wac->hid_data.eraser) wacom_wac->tool[0] = BTN_TOOL_RUBBER; else if (wacom_wac->features.quirks & WACOM_QUIRK_AESPEN) wacom_wac->tool[0] = BTN_TOOL_PEN; @@@ -2619,6 -2621,7 +2621,7 @@@ } wacom_wac->hid_data.tipswitch = false; + wacom_wac->hid_data.eraser = false; input_sync(input); }