summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.com>2026-02-09 17:33:26 +0100
committerJiri Kosina <jkosina@suse.com>2026-02-09 17:33:26 +0100
commitec496f77b4c11036cc835d6f045fb5e5ef1e6530 (patch)
treee0f5a8f9ffec9de060b7b617514daecc8bdaca6d /drivers/hid
parent984d6f361d19486fcd8fc13d29112fe73123f482 (diff)
parentae40ace015be442837934c5028a8eba7fe3cd98f (diff)
Merge branch 'for-6.20/sony' into for-linus
- Support for Rock band 4 PS4 and PS5 guitars (Rosalie Wanders)
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Kconfig4
-rw-r--r--drivers/hid/hid-asus.c1
-rw-r--r--drivers/hid/hid-debug.c1
-rw-r--r--drivers/hid/hid-ids.h14
-rw-r--r--drivers/hid/hid-sony.c129
5 files changed, 145 insertions, 4 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 68247a539e08..e34edaa45621 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -1090,7 +1090,7 @@ config HID_SIGMAMICRO
- Rapoo V500
config HID_SONY
- tristate "Sony PS2/3/4 accessories"
+ tristate "Sony PS2/3/4/5 accessories"
depends on USB_HID
depends on NEW_LEDS
depends on LEDS_CLASS
@@ -1100,12 +1100,12 @@ config HID_SONY
Support for
* Sony PS3 6-axis controllers
- * Sony PS4 DualShock 4 controllers
* Buzz controllers
* Sony PS3 Blue-ray Disk Remote Control (Bluetooth)
* Logitech Harmony adapter for Sony Playstation 3 (Bluetooth)
* Guitar Hero Live PS3, Wii U and PS4 guitar dongles
* Guitar Hero PS3 and PC guitar dongles
+ * Rock Band 4 PS4 and PS5 guitars
config SONY_FF
bool "Sony PS2/3/4 accessories force feedback support"
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 6180217139d8..bfd46e2d4145 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -28,6 +28,7 @@
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/platform_data/x86/asus-wmi.h>
+#include <linux/platform_data/x86/asus-wmi-leds-ids.h>
#include <linux/input/mt.h>
#include <linux/usb.h> /* For to_usb_interface for T100 touchpad intf check */
#include <linux/power_supply.h>
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 337d2dc81b4c..c5865b0d2aaa 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -3513,6 +3513,7 @@ static const char *absolutes[ABS_CNT] = {
[ABS_DISTANCE] = "Distance", [ABS_TILT_X] = "XTilt",
[ABS_TILT_Y] = "YTilt", [ABS_TOOL_WIDTH] = "ToolWidth",
[ABS_VOLUME] = "Volume", [ABS_PROFILE] = "Profile",
+ [ABS_SND_PROFILE] = "SoundProfile",
[ABS_MISC] = "Misc",
[ABS_MT_SLOT] = "MTSlot",
[ABS_MT_TOUCH_MAJOR] = "MTMajor",
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index bb78857b5908..8b0764c4de8e 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -364,6 +364,12 @@
#define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801
#define USB_DEVICE_ID_CREATIVE_SB0540 0x3100
+#define USB_VENDOR_ID_CRKD 0x3651
+#define USB_DEVICE_ID_CRKD_PS4_GIBSON_SG 0x1500
+#define USB_DEVICE_ID_CRKD_PS4_GIBSON_SG_DONGLE 0x5500
+#define USB_DEVICE_ID_CRKD_PS5_GIBSON_SG 0x1600
+#define USB_DEVICE_ID_CRKD_PS5_GIBSON_SG_DONGLE 0x5600
+
#define USB_VENDOR_ID_CVTOUCH 0x1ff7
#define USB_DEVICE_ID_CVTOUCH_SCREEN 0x0013
@@ -1104,6 +1110,11 @@
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
#define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003
+#define USB_VENDOR_ID_PDP 0x0e6F
+#define USB_DEVICE_ID_PDP_PS4_JAGUAR 0x0173
+#define USB_DEVICE_ID_PDP_PS4_RIFFMASTER 0x024a
+#define USB_DEVICE_ID_PDP_PS5_RIFFMASTER 0x0249
+
#define USB_VENDOR_ID_PLANTRONICS 0x047f
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3210_SERIES 0xc055
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056
@@ -1541,6 +1552,9 @@
#define USB_VENDOR_ID_RISO_KAGAKU 0x1294 /* Riso Kagaku Corp. */
#define USB_DEVICE_ID_RI_KA_WEBMAIL 0x1320 /* Webmail Notifier */
+#define USB_VENDOR_ID_MADCATZ 0x0738
+#define USB_DEVICE_ID_MADCATZ_PS4_STRATOCASTER 0x8261
+
#define USB_VENDOR_ID_MULTIPLE_1781 0x1781
#define USB_DEVICE_ID_RAPHNET_4NES4SNES_OLD 0x0a9d
#define USB_DEVICE_ID_PHOENIXRC 0x0898
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index b966e4044238..836ce74764a8 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -14,6 +14,7 @@
* Copyright (c) 2020-2021 Pascal Giard <pascal.giard@etsmtl.ca>
* Copyright (c) 2020 Sanjay Govind <sanjay.govind9@gmail.com>
* Copyright (c) 2021 Daniel Nguyen <daniel.nguyen.1@ens.etsmtl.ca>
+ * Copyright (c) 2026 Rosalie Wanders <rosalie@mailbox.org>
*/
/*
@@ -61,6 +62,9 @@
#define GH_GUITAR_CONTROLLER BIT(14)
#define GHL_GUITAR_PS3WIIU BIT(15)
#define GHL_GUITAR_PS4 BIT(16)
+#define RB4_GUITAR_PS4_USB BIT(17)
+#define RB4_GUITAR_PS4_BT BIT(18)
+#define RB4_GUITAR_PS5 BIT(19)
#define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
#define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
@@ -418,6 +422,27 @@ static const unsigned int sixaxis_keymap[] = {
[0x11] = BTN_MODE, /* PS */
};
+static const unsigned int rb4_absmap[] = {
+ [0x30] = ABS_X,
+ [0x31] = ABS_Y,
+};
+
+static const unsigned int rb4_keymap[] = {
+ [0x1] = BTN_WEST, /* Square */
+ [0x2] = BTN_SOUTH, /* Cross */
+ [0x3] = BTN_EAST, /* Circle */
+ [0x4] = BTN_NORTH, /* Triangle */
+ [0x5] = BTN_TL, /* L1 */
+ [0x6] = BTN_TR, /* R1 */
+ [0x7] = BTN_TL2, /* L2 */
+ [0x8] = BTN_TR2, /* R2 */
+ [0x9] = BTN_SELECT, /* Share */
+ [0xa] = BTN_START, /* Options */
+ [0xb] = BTN_THUMBL, /* L3 */
+ [0xc] = BTN_THUMBR, /* R3 */
+ [0xd] = BTN_MODE, /* PS */
+};
+
static enum power_supply_property sony_battery_props[] = {
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_CAPACITY,
@@ -484,6 +509,7 @@ struct sony_sc {
spinlock_t lock;
struct list_head list_node;
struct hid_device *hdev;
+ struct input_dev *input_dev;
struct input_dev *touchpad;
struct input_dev *sensor_dev;
struct led_classdev *leds[MAX_LEDS];
@@ -584,7 +610,7 @@ static int ghl_init_urb(struct sony_sc *sc, struct usb_device *usbdev,
return 0;
}
-static int guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
+static int gh_guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage,
unsigned long **bit, int *max)
{
@@ -599,6 +625,37 @@ static int guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
return 0;
}
+static int rb4_guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
+ struct hid_field *field, struct hid_usage *usage,
+ unsigned long **bit, int *max)
+{
+ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
+ unsigned int key = usage->hid & HID_USAGE;
+
+ if (key >= ARRAY_SIZE(rb4_keymap))
+ return 0;
+
+ key = rb4_keymap[key];
+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, key);
+ return 1;
+ } else if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK) {
+ unsigned int abs = usage->hid & HID_USAGE;
+
+ /* Let the HID parser deal with the HAT. */
+ if (usage->hid == HID_GD_HATSWITCH)
+ return 0;
+
+ if (abs >= ARRAY_SIZE(rb4_absmap))
+ return 0;
+
+ abs = rb4_absmap[abs];
+ hid_map_usage_clear(hi, usage, bit, max, EV_ABS, abs);
+ return 1;
+ }
+
+ return 0;
+}
+
static const u8 *motion_fixup(struct hid_device *hdev, u8 *rdesc,
unsigned int *rsize)
{
@@ -915,6 +972,40 @@ static void nsg_mrxu_parse_report(struct sony_sc *sc, u8 *rd, int size)
input_sync(sc->touchpad);
}
+static void rb4_ps4_guitar_parse_report(struct sony_sc *sc, u8 *rd, int size)
+{
+ /*
+ * Rock Band 4 PS4 guitars have whammy and
+ * tilt functionality, they're located at
+ * byte 44 and 45 respectively.
+ *
+ * We will map these values to the triggers
+ * because the guitars don't have anything
+ * mapped there.
+ */
+ input_report_abs(sc->input_dev, ABS_Z, rd[44]);
+ input_report_abs(sc->input_dev, ABS_RZ, rd[45]);
+
+ input_sync(sc->input_dev);
+}
+
+static void rb4_ps5_guitar_parse_report(struct sony_sc *sc, u8 *rd, int size)
+{
+ /*
+ * Rock Band 4 PS5 guitars have whammy and
+ * tilt functionality, they're located at
+ * byte 41 and 42 respectively.
+ *
+ * We will map these values to the triggers
+ * because the guitars don't have anything
+ * mapped there.
+ */
+ input_report_abs(sc->input_dev, ABS_Z, rd[41]);
+ input_report_abs(sc->input_dev, ABS_RZ, rd[42]);
+
+ input_sync(sc->input_dev);
+}
+
static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
u8 *rd, int size)
{
@@ -950,6 +1041,15 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
} else if ((sc->quirks & NSG_MRXU_REMOTE) && rd[0] == 0x02) {
nsg_mrxu_parse_report(sc, rd, size);
return 1;
+ } else if ((sc->quirks & RB4_GUITAR_PS4_USB) && rd[0] == 0x01 && size == 64) {
+ rb4_ps4_guitar_parse_report(sc, rd, size);
+ return 1;
+ } else if ((sc->quirks & RB4_GUITAR_PS4_BT) && rd[0] == 0x01 && size == 78) {
+ rb4_ps4_guitar_parse_report(sc, rd, size);
+ return 1;
+ } else if ((sc->quirks & RB4_GUITAR_PS5) && rd[0] == 0x01 && size == 64) {
+ rb4_ps5_guitar_parse_report(sc, rd, size);
+ return 1;
}
if (sc->defer_initialization) {
@@ -999,7 +1099,13 @@ static int sony_mapping(struct hid_device *hdev, struct hid_input *hi,
return sixaxis_mapping(hdev, hi, field, usage, bit, max);
if (sc->quirks & GH_GUITAR_CONTROLLER)
- return guitar_mapping(hdev, hi, field, usage, bit, max);
+ return gh_guitar_mapping(hdev, hi, field, usage, bit, max);
+
+ if (sc->quirks & (RB4_GUITAR_PS4_USB | RB4_GUITAR_PS4_BT))
+ return rb4_guitar_mapping(hdev, hi, field, usage, bit, max);
+
+ if (sc->quirks & RB4_GUITAR_PS5)
+ return rb4_guitar_mapping(hdev, hi, field, usage, bit, max);
/* Let hid-core decide for the others */
return 0;
@@ -2043,6 +2149,7 @@ static int sony_input_configured(struct hid_device *hdev,
goto err_close;
}
+ sc->input_dev = hidinput->input;
return 0;
err_close:
hid_hw_close(hdev);
@@ -2271,6 +2378,24 @@ static const struct hid_device_id sony_devices[] = {
/* Guitar Hero Live PS4 guitar dongles */
{ HID_USB_DEVICE(USB_VENDOR_ID_REDOCTANE, USB_DEVICE_ID_REDOCTANE_PS4_GHLIVE_DONGLE),
.driver_data = GHL_GUITAR_PS4 | GH_GUITAR_CONTROLLER },
+ /* Rock Band 4 PS4 guitars */
+ { HID_USB_DEVICE(USB_VENDOR_ID_PDP, USB_DEVICE_ID_PDP_PS4_RIFFMASTER),
+ .driver_data = RB4_GUITAR_PS4_USB },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CRKD, USB_DEVICE_ID_CRKD_PS4_GIBSON_SG),
+ .driver_data = RB4_GUITAR_PS4_USB },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CRKD, USB_DEVICE_ID_CRKD_PS4_GIBSON_SG_DONGLE),
+ .driver_data = RB4_GUITAR_PS4_USB },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_PDP, USB_DEVICE_ID_PDP_PS4_JAGUAR),
+ .driver_data = RB4_GUITAR_PS4_BT },
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_PS4_STRATOCASTER),
+ .driver_data = RB4_GUITAR_PS4_BT },
+ /* Rock Band 4 PS5 guitars */
+ { HID_USB_DEVICE(USB_VENDOR_ID_PDP, USB_DEVICE_ID_PDP_PS5_RIFFMASTER),
+ .driver_data = RB4_GUITAR_PS5 },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CRKD, USB_DEVICE_ID_CRKD_PS5_GIBSON_SG),
+ .driver_data = RB4_GUITAR_PS5 },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CRKD, USB_DEVICE_ID_CRKD_PS5_GIBSON_SG_DONGLE),
+ .driver_data = RB4_GUITAR_PS5 },
{ }
};
MODULE_DEVICE_TABLE(hid, sony_devices);