ALSA: usb-audio: Move media-controller API quirk into quirk_flags

The devices that can have media-controller API entries are currently
specified via tables in quirks-table.h, as a part of descriptor
override.  This can fit better to the new quirk_flags, as we just need
a matching with the given ID and create the MC entries accordingly.

Link: https://lore.kernel.org/r/20210729073855.19043-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2021-07-29 09:38:48 +02:00
parent 4d4dee0aef
commit ce47d47e5c
4 changed files with 38 additions and 3 deletions

View File

@ -826,7 +826,7 @@ static int usb_audio_probe(struct usb_interface *intf,
goto __error;
}
if (quirk && quirk->shares_media_device) {
if (chip->quirk_flags & QUIRK_FLAG_SHARE_MEDIA_DEVICE) {
/* don't want to fail when snd_media_device_create() fails */
snd_media_device_create(chip, intf);
}

View File

@ -2816,7 +2816,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.product_name = pname, \
.ifnum = QUIRK_ANY_INTERFACE, \
.type = QUIRK_AUDIO_ALIGN_TRANSFER, \
.shares_media_device = 1, \
} \
}

View File

@ -1913,12 +1913,46 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
QUIRK_FLAG_GET_SAMPLE_RATE),
DEVICE_FLG(0x05a7, 0x1020, /* Bose Companion 5 */
QUIRK_FLAG_GET_SAMPLE_RATE),
DEVICE_FLG(0x05e1, 0x0480, /* Hauppauge Woodbury */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x074d, 0x3553, /* Outlaw RR2150 (Micronas UAC3553B) */
QUIRK_FLAG_GET_SAMPLE_RATE),
DEVICE_FLG(0x0fd9, 0x0008, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
QUIRK_FLAG_GET_SAMPLE_RATE),
DEVICE_FLG(0x1901, 0x0191, /* GE B850V3 CP2114 audio interface */
QUIRK_FLAG_GET_SAMPLE_RATE),
DEVICE_FLG(0x2040, 0x7200, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7201, /* Hauppauge HVR-950Q-MXL */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7210, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7211, /* Hauppauge HVR-950Q-MXL */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7213, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7217, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x721b, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x721e, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x721f, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7240, /* Hauppauge HVR-850 */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7260, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7270, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7280, /* Hauppauge HVR-950Q */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x7281, /* Hauppauge HVR-950Q-MXL */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x2040, 0x8200, /* Hauppauge Woodbury */
QUIRK_FLAG_SHARE_MEDIA_DEVICE),
DEVICE_FLG(0x21b4, 0x0081, /* AudioQuest DragonFly */
QUIRK_FLAG_GET_SAMPLE_RATE),
DEVICE_FLG(0x2912, 0x30c8, /* Audioengine D1 */

View File

@ -116,7 +116,6 @@ struct snd_usb_audio_quirk {
const char *product_name;
int16_t ifnum;
uint16_t type;
bool shares_media_device;
const void *data;
};
@ -136,8 +135,11 @@ extern bool snd_usb_skip_validation;
* QUIRK_FLAG_GET_SAMPLE_RATE:
* Skip reading sample rate for devices, as some devices behave inconsistently
* or return error
* QUIRK_FLAG_SHARE_MEDIA_DEVICE:
* Create Media Controller API entries
*/
#define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
#define QUIRK_FLAG_SHARE_MEDIA_DEVICE (1U << 1)
#endif /* __USBAUDIO_H */