Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-7.1/pidff' into for-linus

- various new per-device(-group) type quirks for pidff driver (Tomasz Pakuła)

+56 -27
+9 -8
MAINTAINERS
··· 11364 11364 F: drivers/iio/*/hid-* 11365 11365 F: include/linux/hid-sensor-* 11366 11366 11367 - HID UNIVERSAL PIDFF DRIVER 11368 - M: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> 11369 - M: Oleg Makarenko <oleg@makarenk.ooo> 11370 - L: linux-input@vger.kernel.org 11371 - S: Maintained 11372 - B: https://github.com/JacKeTUs/universal-pidff/issues 11373 - F: drivers/hid/hid-universal-pidff.c 11374 - 11375 11367 HID VRC-2 CAR CONTROLLER DRIVER 11376 11368 M: Marcus Folkesson <marcus.folkesson@gmail.com> 11377 11369 L: linux-input@vger.kernel.org ··· 27270 27278 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git 27271 27279 F: Documentation/hid/hiddev.rst 27272 27280 F: drivers/hid/usbhid/ 27281 + 27282 + USB HID PID DRIVERS (USB WHEELBASES, JOYSTICKS, RUDDERS, ...) 27283 + M: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> 27284 + M: Oleg Makarenko <oleg@makarenk.ooo> 27285 + L: linux-input@vger.kernel.org 27286 + S: Maintained 27287 + B: https://github.com/JacKeTUs/universal-pidff/issues 27288 + F: drivers/hid/usbhid/hid-pidff* 27289 + F: drivers/hid/hid-universal-pidff.c 27273 27290 27274 27291 USB INTEL XHCI ROLE MUX DRIVER 27275 27292 M: Hans de Goede <hansg@kernel.org>
+38 -19
drivers/hid/usbhid/hid-pidff.c
··· 13 13 #include <linux/input.h> 14 14 #include <linux/minmax.h> 15 15 #include <linux/slab.h> 16 + #include <linux/stringify.h> 16 17 #include <linux/usb.h> 17 18 18 19 #define PID_EFFECTS_MAX 64 ··· 82 81 #define PID_NEG_COEFFICIENT 4 83 82 #define PID_POS_SATURATION 5 84 83 #define PID_NEG_SATURATION 6 85 - #define PID_DEAD_BAND 7 84 + #define PID_DEADBAND 7 86 85 static const u8 pidff_set_condition[] = { 87 86 0x22, 0x23, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65 88 87 }; ··· 619 618 effect->u.condition[i].center); 620 619 pidff_set_signed(&pidff->set_condition[PID_POS_COEFFICIENT], 621 620 effect->u.condition[i].right_coeff); 622 - pidff_set_signed(&pidff->set_condition[PID_NEG_COEFFICIENT], 623 - effect->u.condition[i].left_coeff); 624 621 pidff_set(&pidff->set_condition[PID_POS_SATURATION], 625 622 effect->u.condition[i].right_saturation); 626 - pidff_set(&pidff->set_condition[PID_NEG_SATURATION], 627 - effect->u.condition[i].left_saturation); 628 - pidff_set(&pidff->set_condition[PID_DEAD_BAND], 629 - effect->u.condition[i].deadband); 623 + 624 + /* Omit Negative Coefficient if missing */ 625 + if (!(pidff->quirks & HID_PIDFF_QUIRK_MISSING_NEG_COEFFICIENT)) 626 + pidff_set_signed(&pidff->set_condition[PID_NEG_COEFFICIENT], 627 + effect->u.condition[i].left_coeff); 628 + 629 + /* Omit Negative Saturation if missing */ 630 + if (!(pidff->quirks & HID_PIDFF_QUIRK_MISSING_NEG_SATURATION)) 631 + pidff_set_signed(&pidff->set_condition[PID_NEG_SATURATION], 632 + effect->u.condition[i].left_saturation); 633 + 634 + /* Omit Deadband field if missing */ 635 + if (!(pidff->quirks & HID_PIDFF_QUIRK_MISSING_DEADBAND)) 636 + pidff_set(&pidff->set_condition[PID_DEADBAND], 637 + effect->u.condition[i].deadband); 638 + 630 639 hid_hw_request(pidff->hid, pidff->reports[PID_SET_CONDITION], 631 640 HID_REQ_SET_REPORT); 632 641 } ··· 1064 1053 return -1; 1065 1054 } 1066 1055 1056 + #define PIDFF_MISSING_FIELD(name, quirks) \ 1057 + ({ pr_debug("%s field not found, but that's OK\n", __stringify(name)); \ 1058 + pr_debug("Setting MISSING_%s quirk\n", __stringify(name)); \ 1059 + *quirks |= HID_PIDFF_QUIRK_MISSING_ ## name; }) 1060 + 1067 1061 /* 1068 1062 * Find fields from a report and fill a pidff_usage 1069 1063 */ ··· 1076 1060 struct hid_report *report, int count, int strict, 1077 1061 u32 *quirks) 1078 1062 { 1079 - const u8 block_offset = pidff_set_condition[PID_PARAM_BLOCK_OFFSET]; 1080 - const u8 delay = pidff_set_effect[PID_START_DELAY]; 1081 - 1082 1063 if (!report) { 1083 1064 pr_debug("%s, null report\n", __func__); 1084 1065 return -1; ··· 1093 1080 continue; 1094 1081 } 1095 1082 1096 - if (table[i] == delay) { 1097 - pr_debug("Delay field not found, but that's OK\n"); 1098 - pr_debug("Setting MISSING_DELAY quirk\n"); 1099 - *quirks |= HID_PIDFF_QUIRK_MISSING_DELAY; 1083 + /* Field quirks auto-detection */ 1084 + if (table[i] == pidff_set_effect[PID_START_DELAY]) 1085 + PIDFF_MISSING_FIELD(DELAY, quirks); 1100 1086 1101 - } else if (table[i] == block_offset) { 1102 - pr_debug("PBO field not found, but that's OK\n"); 1103 - pr_debug("Setting MISSING_PBO quirk\n"); 1104 - *quirks |= HID_PIDFF_QUIRK_MISSING_PBO; 1087 + else if (table[i] == pidff_set_condition[PID_PARAM_BLOCK_OFFSET]) 1088 + PIDFF_MISSING_FIELD(PBO, quirks); 1105 1089 1106 - } else if (strict) { 1090 + else if (table[i] == pidff_set_condition[PID_NEG_COEFFICIENT]) 1091 + PIDFF_MISSING_FIELD(NEG_COEFFICIENT, quirks); 1092 + 1093 + else if (table[i] == pidff_set_condition[PID_NEG_SATURATION]) 1094 + PIDFF_MISSING_FIELD(NEG_SATURATION, quirks); 1095 + 1096 + else if (table[i] == pidff_set_condition[PID_DEADBAND]) 1097 + PIDFF_MISSING_FIELD(DEADBAND, quirks); 1098 + 1099 + else if (strict) { 1107 1100 pr_debug("failed to locate %d\n", i); 1108 1101 return -1; 1109 1102 }
+9
drivers/hid/usbhid/hid-pidff.h
··· 21 21 /* Force all periodic effects to be uploaded as SINE */ 22 22 #define HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY BIT(4) 23 23 24 + /* Allow devices with missing negative coefficient in the set condition usage */ 25 + #define HID_PIDFF_QUIRK_MISSING_NEG_COEFFICIENT BIT(5) 26 + 27 + /* Allow devices with missing negative saturation in the set condition usage */ 28 + #define HID_PIDFF_QUIRK_MISSING_NEG_SATURATION BIT(6) 29 + 30 + /* Allow devices with missing deadband in the set condition usage */ 31 + #define HID_PIDFF_QUIRK_MISSING_DEADBAND BIT(7) 32 + 24 33 #ifdef CONFIG_HID_PID 25 34 int hid_pidff_init(struct hid_device *hid); 26 35 int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks);