summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.com>2026-04-16 21:05:37 +0200
committerJiri Kosina <jkosina@suse.com>2026-04-16 21:05:37 +0200
commit38d76018bb412dc66b08837097eff53d21e8df29 (patch)
tree2758410a36bdc90a92c5e81cacc5d09a5db6fbaa
parent1b2e4375f66c00bfe28b3298f9171897a4107582 (diff)
parentf8d379460bd088753e47505eebe6a76beecc48c7 (diff)
downloadlinux-38d76018bb412dc66b08837097eff53d21e8df29.tar.gz
linux-38d76018bb412dc66b08837097eff53d21e8df29.zip
Merge branch 'for-7.1/pidff' into for-linus
- various new per-device(-group) type quirks for pidff driver (Tomasz Pakuła)
-rw-r--r--MAINTAINERS17
-rw-r--r--drivers/hid/usbhid/hid-pidff.c57
-rw-r--r--drivers/hid/usbhid/hid-pidff.h9
3 files changed, 56 insertions, 27 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index c3fe46d7c4bc..85a333e1d024 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11364,14 +11364,6 @@ F: drivers/hid/hid-sensor-*
F: drivers/iio/*/hid-*
F: include/linux/hid-sensor-*
-HID UNIVERSAL PIDFF DRIVER
-M: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
-M: Oleg Makarenko <oleg@makarenk.ooo>
-L: linux-input@vger.kernel.org
-S: Maintained
-B: https://github.com/JacKeTUs/universal-pidff/issues
-F: drivers/hid/hid-universal-pidff.c
-
HID VRC-2 CAR CONTROLLER DRIVER
M: Marcus Folkesson <marcus.folkesson@gmail.com>
L: linux-input@vger.kernel.org
@@ -27279,6 +27271,15 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
F: Documentation/hid/hiddev.rst
F: drivers/hid/usbhid/
+USB HID PID DRIVERS (USB WHEELBASES, JOYSTICKS, RUDDERS, ...)
+M: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
+M: Oleg Makarenko <oleg@makarenk.ooo>
+L: linux-input@vger.kernel.org
+S: Maintained
+B: https://github.com/JacKeTUs/universal-pidff/issues
+F: drivers/hid/usbhid/hid-pidff*
+F: drivers/hid/hid-universal-pidff.c
+
USB INTEL XHCI ROLE MUX DRIVER
M: Hans de Goede <hansg@kernel.org>
L: linux-usb@vger.kernel.org
diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index fbf3dbc92e66..aee8a4443305 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -13,6 +13,7 @@
#include <linux/input.h>
#include <linux/minmax.h>
#include <linux/slab.h>
+#include <linux/stringify.h>
#include <linux/usb.h>
#define PID_EFFECTS_MAX 64
@@ -81,7 +82,7 @@ static const u8 pidff_set_envelope[] = { 0x22, 0x5b, 0x5c, 0x5d, 0x5e };
#define PID_NEG_COEFFICIENT 4
#define PID_POS_SATURATION 5
#define PID_NEG_SATURATION 6
-#define PID_DEAD_BAND 7
+#define PID_DEADBAND 7
static const u8 pidff_set_condition[] = {
0x22, 0x23, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65
};
@@ -618,14 +619,24 @@ static void pidff_set_condition_report(struct pidff_device *pidff,
effect->u.condition[i].center);
pidff_set_signed(&pidff->set_condition[PID_POS_COEFFICIENT],
effect->u.condition[i].right_coeff);
- pidff_set_signed(&pidff->set_condition[PID_NEG_COEFFICIENT],
- effect->u.condition[i].left_coeff);
pidff_set(&pidff->set_condition[PID_POS_SATURATION],
effect->u.condition[i].right_saturation);
- pidff_set(&pidff->set_condition[PID_NEG_SATURATION],
- effect->u.condition[i].left_saturation);
- pidff_set(&pidff->set_condition[PID_DEAD_BAND],
- effect->u.condition[i].deadband);
+
+ /* Omit Negative Coefficient if missing */
+ if (!(pidff->quirks & HID_PIDFF_QUIRK_MISSING_NEG_COEFFICIENT))
+ pidff_set_signed(&pidff->set_condition[PID_NEG_COEFFICIENT],
+ effect->u.condition[i].left_coeff);
+
+ /* Omit Negative Saturation if missing */
+ if (!(pidff->quirks & HID_PIDFF_QUIRK_MISSING_NEG_SATURATION))
+ pidff_set_signed(&pidff->set_condition[PID_NEG_SATURATION],
+ effect->u.condition[i].left_saturation);
+
+ /* Omit Deadband field if missing */
+ if (!(pidff->quirks & HID_PIDFF_QUIRK_MISSING_DEADBAND))
+ pidff_set(&pidff->set_condition[PID_DEADBAND],
+ effect->u.condition[i].deadband);
+
hid_hw_request(pidff->hid, pidff->reports[PID_SET_CONDITION],
HID_REQ_SET_REPORT);
}
@@ -1053,6 +1064,11 @@ static int pidff_find_field_with_usage(int *usage_index,
return -1;
}
+#define PIDFF_MISSING_FIELD(name, quirks) \
+ ({ pr_debug("%s field not found, but that's OK\n", __stringify(name)); \
+ pr_debug("Setting MISSING_%s quirk\n", __stringify(name)); \
+ *quirks |= HID_PIDFF_QUIRK_MISSING_ ## name; })
+
/*
* Find fields from a report and fill a pidff_usage
*/
@@ -1060,9 +1076,6 @@ static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
struct hid_report *report, int count, int strict,
u32 *quirks)
{
- const u8 block_offset = pidff_set_condition[PID_PARAM_BLOCK_OFFSET];
- const u8 delay = pidff_set_effect[PID_START_DELAY];
-
if (!report) {
pr_debug("%s, null report\n", __func__);
return -1;
@@ -1080,17 +1093,23 @@ static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
continue;
}
- if (table[i] == delay) {
- pr_debug("Delay field not found, but that's OK\n");
- pr_debug("Setting MISSING_DELAY quirk\n");
- *quirks |= HID_PIDFF_QUIRK_MISSING_DELAY;
+ /* Field quirks auto-detection */
+ if (table[i] == pidff_set_effect[PID_START_DELAY])
+ PIDFF_MISSING_FIELD(DELAY, quirks);
+
+ else if (table[i] == pidff_set_condition[PID_PARAM_BLOCK_OFFSET])
+ PIDFF_MISSING_FIELD(PBO, quirks);
+
+ else if (table[i] == pidff_set_condition[PID_NEG_COEFFICIENT])
+ PIDFF_MISSING_FIELD(NEG_COEFFICIENT, quirks);
+
+ else if (table[i] == pidff_set_condition[PID_NEG_SATURATION])
+ PIDFF_MISSING_FIELD(NEG_SATURATION, quirks);
- } else if (table[i] == block_offset) {
- pr_debug("PBO field not found, but that's OK\n");
- pr_debug("Setting MISSING_PBO quirk\n");
- *quirks |= HID_PIDFF_QUIRK_MISSING_PBO;
+ else if (table[i] == pidff_set_condition[PID_DEADBAND])
+ PIDFF_MISSING_FIELD(DEADBAND, quirks);
- } else if (strict) {
+ else if (strict) {
pr_debug("failed to locate %d\n", i);
return -1;
}
diff --git a/drivers/hid/usbhid/hid-pidff.h b/drivers/hid/usbhid/hid-pidff.h
index f321f675e131..c413aa732842 100644
--- a/drivers/hid/usbhid/hid-pidff.h
+++ b/drivers/hid/usbhid/hid-pidff.h
@@ -21,6 +21,15 @@
/* Force all periodic effects to be uploaded as SINE */
#define HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY BIT(4)
+/* Allow devices with missing negative coefficient in the set condition usage */
+#define HID_PIDFF_QUIRK_MISSING_NEG_COEFFICIENT BIT(5)
+
+/* Allow devices with missing negative saturation in the set condition usage */
+#define HID_PIDFF_QUIRK_MISSING_NEG_SATURATION BIT(6)
+
+/* Allow devices with missing deadband in the set condition usage */
+#define HID_PIDFF_QUIRK_MISSING_DEADBAND BIT(7)
+
#ifdef CONFIG_HID_PID
int hid_pidff_init(struct hid_device *hid);
int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks);