summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-03-26 10:05:43 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-03-26 10:05:43 -0700
commit5e06802b426baa2d3c2a5d7784a6d4c2a9338c3e (patch)
treef65e79d62feb8a769175941e47b1baa6c3e4d4d1 /sound/usb
parentfb1ceb29b27cda91af35851ebab01f298d82162e (diff)
parent4ee4d7b177cff042c7135c8a7c87fbfbe28f04d8 (diff)
downloadlinux-5e06802b426baa2d3c2a5d7784a6d4c2a9338c3e.tar.gz
linux-5e06802b426baa2d3c2a5d7784a6d4c2a9338c3e.tar.bz2
linux-5e06802b426baa2d3c2a5d7784a6d4c2a9338c3e.zip
Merge tag 'hid-for-linus-2025032601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: - PlayStation 5 controllers support (Alex Henrie) - big revamp and modernization of the aged hid-pidff force feedback driver (Tomasz PakuĊ‚a) - conversion of hid-lg-g15 to standard multicolor LED API (Kate Hsuan) - improvement of behavior of Human Presence Sensor (HPD) in amd_sfh driver (Mario Limonciello) - other assorted fixes, code cleanups and device ID additions * tag 'hid-for-linus-2025032601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (70 commits) HID: remove superfluous (and wrong) Makefile entry for CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER HID: Intel-thc-hid: Intel-quickspi: Correct device state names gramatically HID: wacom: Remove static WACOM_PKGLEN_MAX limit HID: amd_sfh: Don't show wrong status for amd_sfh_hpd_info() HID: amd_sfh: Default to HPD disabled HID: amd_sfh: Allow configuring whether HPD is enabled or disabled HID: pidff: Fix set_device_control() HID: pidff: Fix 90 degrees direction name North -> East HID: pidff: Compute INFINITE value instead of using hardcoded 0xffff HID: pidff: Clamp effect playback LOOP_COUNT value HID: pidff: Rename two functions to align them with naming convention HID: lenovo: silence unreachable code warning HID: lenovo: Fix to ensure the data as __le32 instead of u32 HID: bpf: add a v6.11+ compatible BPF fixup for the XPPen ACK05 remote HID: bpf: new hid_bpf_async.h common header HID: bpf: import new kfunc from v6.10 & v6.11 HID: bpf: add support for the XP-Pen Artist Pro 19 (gen2) HID: bpf: Added updated Kamvas Pro 19 descriptor HID: bpf: Suppress bogus F13 trigger on Sirius keyboard full fan shortcut HID: bpf: Add support for the default firmware mode of the Huion K20 ...
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer_quirks.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 49fb849f7d40..a90673d43822 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -4227,6 +4227,52 @@ static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer,
}
}
+/*
+ * Some Plantronics headsets have control names that don't meet ALSA naming
+ * standards. This function fixes nonstandard source names. By the time
+ * this function is called the control name should look like one of these:
+ * "source names Playback Volume"
+ * "source names Playback Switch"
+ * "source names Capture Volume"
+ * "source names Capture Switch"
+ * If any of the trigger words are found in the name then the name will
+ * be changed to:
+ * "Headset Playback Volume"
+ * "Headset Playback Switch"
+ * "Headset Capture Volume"
+ * "Headset Capture Switch"
+ * depending on the current suffix.
+ */
+static void snd_fix_plt_name(struct snd_usb_audio *chip,
+ struct snd_ctl_elem_id *id)
+{
+ /* no variant of "Sidetone" should be added to this list */
+ static const char * const trigger[] = {
+ "Earphone", "Microphone", "Receive", "Transmit"
+ };
+ static const char * const suffix[] = {
+ " Playback Volume", " Playback Switch",
+ " Capture Volume", " Capture Switch"
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(trigger); i++)
+ if (strstr(id->name, trigger[i]))
+ goto triggered;
+ usb_audio_dbg(chip, "no change in %s\n", id->name);
+ return;
+
+triggered:
+ for (i = 0; i < ARRAY_SIZE(suffix); i++)
+ if (strstr(id->name, suffix[i])) {
+ usb_audio_dbg(chip, "fixing kctl name %s\n", id->name);
+ snprintf(id->name, sizeof(id->name), "Headset%s",
+ suffix[i]);
+ return;
+ }
+ usb_audio_dbg(chip, "something wrong in kctl name %s\n", id->name);
+}
+
void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
struct usb_mixer_elem_info *cval, int unitid,
struct snd_kcontrol *kctl)
@@ -4244,5 +4290,10 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
cval->min_mute = 1;
break;
}
+
+ /* ALSA-ify some Plantronics headset control names */
+ if (USB_ID_VENDOR(mixer->chip->usb_id) == 0x047f &&
+ (cval->control == UAC_FU_MUTE || cval->control == UAC_FU_VOLUME))
+ snd_fix_plt_name(mixer->chip, &kctl->id);
}