Commit fa10635f authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Simplify quirk entries with a macro

Introduce a new macro USB_AUDIO_DEVICE() for the entries matching with
the pid/vid pair and the class/subclass, and remove the open-code.

Link: https://lore.kernel.org/r/20200817082140.20232-3-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 5436f59b
...@@ -25,6 +25,16 @@ ...@@ -25,6 +25,16 @@
.idProduct = prod, \ .idProduct = prod, \
.bInterfaceClass = USB_CLASS_VENDOR_SPEC .bInterfaceClass = USB_CLASS_VENDOR_SPEC
/* A standard entry matching with vid/pid and the audio class/subclass */
#define USB_AUDIO_DEVICE(vend, prod) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
USB_DEVICE_ID_MATCH_INT_CLASS | \
USB_DEVICE_ID_MATCH_INT_SUBCLASS, \
.idVendor = vend, \
.idProduct = prod, \
.bInterfaceClass = USB_CLASS_AUDIO, \
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
/* FTDI devices */ /* FTDI devices */
{ {
USB_DEVICE(0x0403, 0xb8d8), USB_DEVICE(0x0403, 0xb8d8),
...@@ -127,69 +137,13 @@ ...@@ -127,69 +137,13 @@
* Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface
* class matches do not take effect without an explicit ID match. * class matches do not take effect without an explicit ID match.
*/ */
{ { USB_AUDIO_DEVICE(0x046d, 0x0850) },
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | { USB_AUDIO_DEVICE(0x046d, 0x08ae) },
USB_DEVICE_ID_MATCH_INT_CLASS | { USB_AUDIO_DEVICE(0x046d, 0x08c6) },
USB_DEVICE_ID_MATCH_INT_SUBCLASS, { USB_AUDIO_DEVICE(0x046d, 0x08f0) },
.idVendor = 0x046d, { USB_AUDIO_DEVICE(0x046d, 0x08f5) },
.idProduct = 0x0850, { USB_AUDIO_DEVICE(0x046d, 0x08f6) },
.bInterfaceClass = USB_CLASS_AUDIO, { USB_AUDIO_DEVICE(0x046d, 0x0990) },
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE |
USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x046d,
.idProduct = 0x08ae,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE |
USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x046d,
.idProduct = 0x08c6,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE |
USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x046d,
.idProduct = 0x08f0,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE |
USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x046d,
.idProduct = 0x08f5,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE |
USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x046d,
.idProduct = 0x08f6,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE |
USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x046d,
.idProduct = 0x0990,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
},
/* /*
* Yamaha devices * Yamaha devices
...@@ -2831,13 +2785,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2831,13 +2785,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
*/ */
#define AU0828_DEVICE(vid, pid, vname, pname) { \ #define AU0828_DEVICE(vid, pid, vname, pname) { \
.idVendor = vid, \ USB_AUDIO_DEVICE(vid, pid), \
.idProduct = pid, \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
USB_DEVICE_ID_MATCH_INT_CLASS | \
USB_DEVICE_ID_MATCH_INT_SUBCLASS, \
.bInterfaceClass = USB_CLASS_AUDIO, \
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, \
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { \ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { \
.vendor_name = vname, \ .vendor_name = vname, \
.product_name = pname, \ .product_name = pname, \
...@@ -2867,13 +2815,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), ...@@ -2867,13 +2815,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
/* Syntek STK1160 */ /* Syntek STK1160 */
{ {
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_AUDIO_DEVICE(0x05e1, 0x0408),
USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x05e1,
.idProduct = 0x0408,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Syntek", .vendor_name = "Syntek",
.product_name = "STK1160", .product_name = "STK1160",
...@@ -3628,13 +3570,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), ...@@ -3628,13 +3570,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
* channels to be swapped and out of phase, which is dealt with in quirks.c. * channels to be swapped and out of phase, which is dealt with in quirks.c.
*/ */
{ {
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_AUDIO_DEVICE(0x534d, 0x2109),
USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x534d,
.idProduct = 0x2109,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "MacroSilicon", .vendor_name = "MacroSilicon",
.product_name = "MS2109", .product_name = "MS2109",
...@@ -3675,3 +3611,4 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), ...@@ -3675,3 +3611,4 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
}, },
#undef USB_DEVICE_VENDOR_SPEC #undef USB_DEVICE_VENDOR_SPEC
#undef USB_AUDIO_DEVICE
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment