ALSA: usb-audio: Clean up quirk entries with macros
[sfrench/cifs-2.6.git] / sound / usb / quirks-table.h
index e009d584e7d08aaed05dda6ad10a145488b5a133..5236f4d015c4867f1057fad1e4fd99a51166c5bc 100644 (file)
        .idProduct = prod, \
        .bInterfaceClass = USB_CLASS_VENDOR_SPEC
 
+#define QUIRK_RENAME_DEVICE(_vendor, _device)                          \
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { \
+               .vendor_name = _vendor,                                 \
+               .product_name = _device,                                \
+               .ifnum = QUIRK_NO_INTERFACE                             \
+       }
+
+#define QUIRK_DEVICE_PROFILE(_vendor, _device, _profile)               \
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { \
+               .vendor_name = _vendor,                                 \
+               .product_name = _device,                                \
+               .profile_name = _profile,                               \
+               .ifnum = QUIRK_NO_INTERFACE                             \
+       }
+
 /* FTDI devices */
 {
        USB_DEVICE(0x0403, 0xb8d8),
 /* Creative/E-Mu devices */
 {
        USB_DEVICE(0x041e, 0x3010),
-       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .vendor_name = "Creative Labs",
-               .product_name = "Sound Blaster MP3+",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_RENAME_DEVICE("Creative Labs", "Sound Blaster MP3+")
 },
 /* Creative/Toshiba Multimedia Center SB-0500 */
 {
        USB_DEVICE(0x041e, 0x3048),
-       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .vendor_name = "Toshiba",
-               .product_name = "SB-0500",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_RENAME_DEVICE("Toshiba", "SB-0500")
 },
 {
        /* E-Mu 0202 USB */
        .idProduct = 0x0990,
        .bInterfaceClass = USB_CLASS_AUDIO,
        .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
-       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .vendor_name = "Logitech, Inc.",
-               .product_name = "QuickCam Pro 9000",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_RENAME_DEVICE("Logitech, Inc.", "QuickCam Pro 9000")
 },
 
 /*
@@ -2596,11 +2599,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 },
 {
        USB_DEVICE(0x0ccd, 0x0028),
-       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .vendor_name = "TerraTec",
-               .product_name = "Aureon5.1MkII",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_RENAME_DEVICE("TerraTec", "Aureon5.1MkII")
 },
 {
        USB_DEVICE(0x0ccd, 0x0035),
@@ -2615,19 +2614,11 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 /* Stanton/N2IT Final Scratch v1 device ('Scratchamp') */
 {
        USB_DEVICE(0x103d, 0x0100),
-               .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .vendor_name = "Stanton",
-               .product_name = "ScratchAmp",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_RENAME_DEVICE("Stanton", "ScratchAmp")
 },
 {
        USB_DEVICE(0x103d, 0x0101),
-               .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .vendor_name = "Stanton",
-               .product_name = "ScratchAmp",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_RENAME_DEVICE("Stanton", "ScratchAmp")
 },
 
 /* Novation EMS devices */
@@ -2756,90 +2747,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
                .type = QUIRK_MIDI_NOVATION
        }
 },
-{
-       /*
-        * Focusrite Scarlett Solo 2nd generation
-        * Reports that playback should use Synch: Synchronous
-        * while still providing a feedback endpoint. Synchronous causes
-        * snapping on some sample rates.
-        * Force it to use Synch: Asynchronous.
-        */
-       USB_DEVICE(0x1235, 0x8205),
-       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .ifnum = QUIRK_ANY_INTERFACE,
-               .type = QUIRK_COMPOSITE,
-               .data = (const struct snd_usb_audio_quirk[]) {
-                       {
-                               .ifnum = 1,
-                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
-                               .data = & (const struct audioformat) {
-                                       .formats = SNDRV_PCM_FMTBIT_S32_LE,
-                                       .channels = 2,
-                                       .iface = 1,
-                                       .altsetting = 1,
-                                       .altset_idx = 1,
-                                       .attributes = 0,
-                                       .endpoint = 0x01,
-                                       .ep_attr = USB_ENDPOINT_XFER_ISOC |
-                                                  USB_ENDPOINT_SYNC_ASYNC,
-                                       .protocol = UAC_VERSION_2,
-                                       .rates = SNDRV_PCM_RATE_44100 |
-                                                SNDRV_PCM_RATE_48000 |
-                                                SNDRV_PCM_RATE_88200 |
-                                                SNDRV_PCM_RATE_96000 |
-                                                SNDRV_PCM_RATE_176400 |
-                                                SNDRV_PCM_RATE_192000,
-                                       .rate_min = 44100,
-                                       .rate_max = 192000,
-                                       .nr_rates = 6,
-                                       .rate_table = (unsigned int[]) {
-                                               44100, 48000, 88200,
-                                               96000, 176400, 192000
-                                       },
-                                       .clock = 41
-                               }
-                       },
-                       {
-                               .ifnum = 2,
-                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
-                               .data = & (const struct audioformat) {
-                                       .formats = SNDRV_PCM_FMTBIT_S32_LE,
-                                       .channels = 2,
-                                       .iface = 2,
-                                       .altsetting = 1,
-                                       .altset_idx = 1,
-                                       .attributes = 0,
-                                       .endpoint = 0x82,
-                                       .ep_attr = USB_ENDPOINT_XFER_ISOC |
-                                                  USB_ENDPOINT_SYNC_ASYNC |
-                                                  USB_ENDPOINT_USAGE_IMPLICIT_FB,
-                                       .protocol = UAC_VERSION_2,
-                                       .rates = SNDRV_PCM_RATE_44100 |
-                                                SNDRV_PCM_RATE_48000 |
-                                                SNDRV_PCM_RATE_88200 |
-                                                SNDRV_PCM_RATE_96000 |
-                                                SNDRV_PCM_RATE_176400 |
-                                                SNDRV_PCM_RATE_192000,
-                                       .rate_min = 44100,
-                                       .rate_max = 192000,
-                                       .nr_rates = 6,
-                                       .rate_table = (unsigned int[]) {
-                                               44100, 48000, 88200,
-                                               96000, 176400, 192000
-                                       },
-                                       .clock = 41
-                               }
-                       },
-                       {
-                               .ifnum = 3,
-                               .type = QUIRK_IGNORE_INTERFACE
-                       },
-                       {
-                               .ifnum = -1
-                       }
-               }
-       }
-},
 
 /* Access Music devices */
 {
@@ -2872,11 +2779,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 {
        /* aka. Serato Scratch Live DJ Box */
        USB_DEVICE(0x13e5, 0x0001),
-       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .vendor_name = "Rane",
-               .product_name = "SL-1",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_RENAME_DEVICE("Rane", "SL-1")
 },
 
 /* Native Instruments MK2 series */
@@ -3343,10 +3246,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
         * is also used by the CM106 based cards, so make it unique.
         */
        USB_DEVICE(0x0d8c, 0x0103),
-       .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
-               .product_name = "Audio Advantage MicroII",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_RENAME_DEVICE(NULL, "Audio Advantage MicroII")
 },
 
 /* disabled due to regression for other devices;
@@ -3452,12 +3352,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
 /* Dell WD15 Dock */
 {
        USB_DEVICE(0x0bda, 0x4014),
-       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .vendor_name = "Dell",
-               .product_name = "WD15 Dock",
-               .profile_name = "Dell-WD15-Dock",
-               .ifnum = QUIRK_NO_INTERFACE
-       }
+       QUIRK_DEVICE_PROFILE("Dell", "WD15 Dock", "Dell-WD15-Dock")
 },
 /* Dell WD19 Dock */
 {
@@ -3635,4 +3530,32 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
        }
 },
 
+#define ALC1220_VB_DESKTOP(vend, prod) { \
+       USB_DEVICE(vend, prod), \
+       QUIRK_DEVICE_PROFILE("Realtek", "ALC1220-VB-DT", \
+                            "Realtek-ALC1220-VB-Desktop") \
+}
+ALC1220_VB_DESKTOP(0x0414, 0xa002), /* Gigabyte TRX40 Aorus Pro WiFi */
+ALC1220_VB_DESKTOP(0x0db0, 0x0d64), /* MSI TRX40 Creator */
+ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */
+ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */
+#undef ALC1220_VB_DESKTOP
+
+/* Two entries for Gigabyte TRX40 Aorus Master:
+ * TRX40 Aorus Master has two USB-audio devices, one for the front headphone
+ * with ESS SABRE9218 DAC chip, while another for the rest I/O (the rear
+ * panel and the front mic) with Realtek ALC1220-VB.
+ * Here we provide two distinct names for making UCM profiles easier.
+ */
+{
+       USB_DEVICE(0x0414, 0xa000),
+       QUIRK_DEVICE_PROFILE("Gigabyte", "Aorus Master Front Headphone",
+                            "Gigabyte-Aorus-Master-Front-Headphone")
+},
+{
+       USB_DEVICE(0x0414, 0xa001),
+       QUIRK_DEVICE_PROFILE("Gigabyte", "Aorus Master Main Audio",
+                            "Gigabyte-Aorus-Master-Main-Audio")
+},
+
 #undef USB_DEVICE_VENDOR_SPEC