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

Revert "ALSA: usb-audio: Name feature ctl using output if input is PCM"

This reverts commit 1601cd53c7e3197181277326dbfc131d20a74e46.

This fix is applied globally to all devices, and it may change the
existing control names. When the devices are managed with the fixed
configuration like UCM, such control name mismatch may lead to
significant regressions.

For avoiding that kind of regression, we would need to apply such
changes conditionally, but it'd take time to settle down.
While the original fix is a good thing in general, in order to address
the regression, let's revert the change for now.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=218605
Reported-and-tested-by: Niklāvs Koļesņikovs <pinkflames.linux@gmail.com>
Message-ID: <20240316083744.28126-1-tiwai@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+14 -35
+14 -35
sound/usb/mixer.c
··· 1652 1652 return NULL; 1653 1653 } 1654 1654 1655 - static int feature_unit_mutevol_ctl_name(struct usb_mixer_interface *mixer, 1656 - struct snd_kcontrol *kctl, 1657 - struct usb_audio_term *iterm, 1658 - struct usb_audio_term *oterm) 1659 - { 1660 - struct usb_audio_term *aterm, *bterm; 1661 - bool output_first; 1662 - int len = 0; 1663 - 1664 - /* 1665 - * If the input terminal is USB Streaming, we try getting the name of 1666 - * the output terminal first in hopes of getting something more 1667 - * descriptive than "PCM". 1668 - */ 1669 - output_first = iterm && !(iterm->type >> 16) && (iterm->type & 0xff00) == 0x0100; 1670 - 1671 - aterm = output_first ? oterm : iterm; 1672 - bterm = output_first ? iterm : oterm; 1673 - 1674 - if (aterm) 1675 - len = get_term_name(mixer->chip, aterm, kctl->id.name, 1676 - sizeof(kctl->id.name), 1); 1677 - if (!len && bterm) 1678 - len = get_term_name(mixer->chip, bterm, kctl->id.name, 1679 - sizeof(kctl->id.name), 1); 1680 - return len; 1681 - } 1682 - 1683 1655 static void __build_feature_ctl(struct usb_mixer_interface *mixer, 1684 1656 const struct usbmix_name_map *imap, 1685 1657 unsigned int ctl_mask, int control, ··· 1733 1761 case UAC_FU_MUTE: 1734 1762 case UAC_FU_VOLUME: 1735 1763 /* 1736 - * Determine the control name: 1737 - * - If a name id is given in descriptor, use it. 1738 - * - If input and output terminals are present, try to derive 1739 - * the name from either of these. 1740 - * - Otherwise, make up a name using the feature unit ID. 1764 + * determine the control name. the rule is: 1765 + * - if a name id is given in descriptor, use it. 1766 + * - if the connected input can be determined, then use the name 1767 + * of terminal type. 1768 + * - if the connected output can be determined, use it. 1769 + * - otherwise, anonymous name. 1741 1770 */ 1742 1771 if (!len) { 1743 - len = feature_unit_mutevol_ctl_name(mixer, kctl, iterm, 1744 - oterm); 1772 + if (iterm) 1773 + len = get_term_name(mixer->chip, iterm, 1774 + kctl->id.name, 1775 + sizeof(kctl->id.name), 1); 1776 + if (!len && oterm) 1777 + len = get_term_name(mixer->chip, oterm, 1778 + kctl->id.name, 1779 + sizeof(kctl->id.name), 1); 1745 1780 if (!len) 1746 1781 snprintf(kctl->id.name, sizeof(kctl->id.name), 1747 1782 "Feature %d", unitid);