From: Phil Willoughby Date: Sat, 28 Mar 2026 16:02:58 +0000 (+0000) Subject: ALSA: usb-audio: tidy up the AF16Rig quirks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31183edd9cb3465af5c8b9cb16f42259cbf27109;p=thirdparty%2Flinux.git ALSA: usb-audio: tidy up the AF16Rig quirks Use macros to make the AF16Rig quirk table smaller. Add a disabled block containing the theoretical quirks for the other clock sources that the AF16Rig has. It's disabled because I cannot test it. Fixes: 0da18c2dd1cc ("ALSA: usb-audio: Add quirks for Arturia AF16Rig") Tested-By: Phil Willoughby Signed-off-by: Phil Willoughby Link: https://patch.msgid.link/20260328160326.23665-1-willerz@gmail.com Signed-off-by: Takashi Iwai --- diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 8f79a15055a6a..b6dfe3b63c672 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -3900,6 +3900,44 @@ YAMAHA_DEVICE(0x7010, "UB99"), QUIRK_RME_DIGIFACE(0x3f8c), QUIRK_RME_DIGIFACE(0x3fa0), +#define QUIRK_AF16RIG(channel_count_, alt_setting_, \ + low_rate_, high_rate_, pack_size_, \ + clock_, interface_, endpoint_) \ + { \ + QUIRK_DATA_AUDIOFORMAT(interface_) { \ + .formats = SNDRV_PCM_FMTBIT_S32_LE, \ + .channels = channel_count_, \ + .fmt_type = UAC_FORMAT_TYPE_I_PCM, \ + .fmt_bits = 24, \ + .fmt_sz = 4, \ + .iface = interface_, \ + .altsetting = alt_setting_, \ + .altset_idx = alt_setting_, \ + .endpoint = endpoint_, \ + .ep_attr = USB_ENDPOINT_XFER_ISOC | \ + USB_ENDPOINT_SYNC_ASYNC, \ + .datainterval = 1, \ + .protocol = UAC_VERSION_2, \ + .maxpacksize = pack_size_, \ + .rates = SNDRV_PCM_RATE_##low_rate_ | \ + SNDRV_PCM_RATE_##high_rate_, \ + .rate_min = low_rate_, \ + .rate_max = high_rate_, \ + .nr_rates = 2, \ + .rate_table = (unsigned int[]) { \ + low_rate_, high_rate_ }, \ + .clock = clock_, \ + } \ + } + +#define QUIRK_AF16RIG_CLOCK(clock) \ + QUIRK_AF16RIG(34, 1, 44100, 48000, 0x3b8, clock, 1, 0x01), \ + QUIRK_AF16RIG(34, 1, 44100, 48000, 0x3b8, clock, 2, 0x81), \ + QUIRK_AF16RIG(18, 2, 88200, 96000, 0x3a8, clock, 1, 0x01), \ + QUIRK_AF16RIG(18, 2, 88200, 96000, 0x3a8, clock, 2, 0x81), \ + QUIRK_AF16RIG(10, 3, 176400, 192000, 0x3e8, clock, 1, 0x01), \ + QUIRK_AF16RIG(10, 3, 176400, 192000, 0x3e8, clock, 2, 0x81) + /* Arturia AudioFuse 16Rig Audio */ /* AF16Rig MIDI has USB PID 0xaf21 and appears to work OK without quirks */ { @@ -3909,161 +3947,23 @@ QUIRK_RME_DIGIFACE(0x3fa0), .product_name = "AF16Rig", QUIRK_DATA_COMPOSITE { { QUIRK_DATA_STANDARD_MIXER(0) }, - { - QUIRK_DATA_AUDIOFORMAT(1) { /* Playback */ - .formats = SNDRV_PCM_FMTBIT_S32_LE, - .channels = 34, - .fmt_type = UAC_FORMAT_TYPE_I_PCM, - .fmt_bits = 24, - .fmt_sz = 4, - .iface = 1, - .altsetting = 1, - .altset_idx = 1, - .endpoint = 0x01, - .ep_attr = USB_ENDPOINT_XFER_ISOC| - USB_ENDPOINT_SYNC_ASYNC, - .datainterval = 1, - .protocol = UAC_VERSION_2, - .maxpacksize = 0x03b8, - .rates = SNDRV_PCM_RATE_44100| - SNDRV_PCM_RATE_48000, - .rate_min = 44100, - .rate_max = 48000, - .nr_rates = 2, - .rate_table = (unsigned int[]) { 44100, 48000 }, - .clock = 41, - } - }, - { - QUIRK_DATA_AUDIOFORMAT(1) { /* Playback */ - .formats = SNDRV_PCM_FMTBIT_S32_LE, - .channels = 18, - .fmt_type = UAC_FORMAT_TYPE_I_PCM, - .fmt_bits = 24, - .fmt_sz = 4, - .iface = 1, - .altsetting = 1, - .altset_idx = 1, - .endpoint = 0x01, - .ep_attr = USB_ENDPOINT_XFER_ISOC| - USB_ENDPOINT_SYNC_ASYNC, - .datainterval = 1, - .protocol = UAC_VERSION_2, - .maxpacksize = 0x03a8, - .rates = SNDRV_PCM_RATE_88200| - SNDRV_PCM_RATE_96000, - .rate_min = 88200, - .rate_max = 96000, - .nr_rates = 2, - .rate_table = (unsigned int[]) { 88200, 96000 }, - .clock = 41, - } - }, - { - QUIRK_DATA_AUDIOFORMAT(1) { /* Playback */ - .formats = SNDRV_PCM_FMTBIT_S32_LE, - .channels = 10, - .fmt_type = UAC_FORMAT_TYPE_I_PCM, - .fmt_bits = 24, - .fmt_sz = 4, - .iface = 1, - .altsetting = 3, - .altset_idx = 3, - .endpoint = 0x01, - .ep_attr = USB_ENDPOINT_XFER_ISOC| - USB_ENDPOINT_SYNC_ASYNC, - .datainterval = 1, - .protocol = UAC_VERSION_2, - .maxpacksize = 0x03e8, - .rates = SNDRV_PCM_RATE_176400| - SNDRV_PCM_RATE_192000, - .rate_min = 176400, - .rate_max = 192000, - .nr_rates = 2, - .rate_table = (unsigned int[]) { 176400, 192000 }, - .clock = 41, - } - }, - { - QUIRK_DATA_AUDIOFORMAT(2) { /* Capture */ - .formats = SNDRV_PCM_FMTBIT_S32_LE, - .channels = 34, - .fmt_type = UAC_FORMAT_TYPE_I_PCM, - .fmt_bits = 24, - .fmt_sz = 4, - .iface = 2, - .altsetting = 1, - .altset_idx = 1, - .endpoint = 0x81, - .ep_attr = USB_ENDPOINT_XFER_ISOC| - USB_ENDPOINT_SYNC_ASYNC, - .datainterval = 1, - .protocol = UAC_VERSION_2, - .maxpacksize = 0x03b8, - .rates = SNDRV_PCM_RATE_44100| - SNDRV_PCM_RATE_48000, - .rate_min = 44100, - .rate_max = 48000, - .nr_rates = 2, - .rate_table = (unsigned int[]) { 44100, 48000 }, - .clock = 41, - } - }, - { - QUIRK_DATA_AUDIOFORMAT(2) { /* Capture */ - .formats = SNDRV_PCM_FMTBIT_S32_LE, - .channels = 18, - .fmt_type = UAC_FORMAT_TYPE_I_PCM, - .fmt_bits = 24, - .fmt_sz = 4, - .iface = 2, - .altsetting = 2, - .altset_idx = 2, - .endpoint = 0x81, - .ep_attr = USB_ENDPOINT_XFER_ISOC| - USB_ENDPOINT_SYNC_ASYNC, - .datainterval = 1, - .protocol = UAC_VERSION_2, - .maxpacksize = 0x03a8, - .rates = SNDRV_PCM_RATE_88200| - SNDRV_PCM_RATE_96000, - .rate_min = 88200, - .rate_max = 96000, - .nr_rates = 2, - .rate_table = (unsigned int[]) { 88200, 96000 }, - .clock = 41, - } - }, - { - QUIRK_DATA_AUDIOFORMAT(2) { /* Capture */ - .formats = SNDRV_PCM_FMTBIT_S32_LE, - .channels = 10, - .fmt_type = UAC_FORMAT_TYPE_I_PCM, - .fmt_bits = 24, - .fmt_sz = 4, - .iface = 2, - .altsetting = 3, - .altset_idx = 3, - .endpoint = 0x81, - .ep_attr = USB_ENDPOINT_XFER_ISOC| - USB_ENDPOINT_SYNC_ASYNC, - .datainterval = 1, - .protocol = UAC_VERSION_2, - .maxpacksize = 0x03e8, - .rates = SNDRV_PCM_RATE_176400| - SNDRV_PCM_RATE_192000, - .rate_min = 176400, - .rate_max = 192000, - .nr_rates = 2, - .rate_table = (unsigned int[]) { 176400, 192000 }, - .clock = 41, - } - }, + QUIRK_AF16RIG_CLOCK(41), /* Internal clock */ +#if 0 +/* These are disabled because I don't have the required hardware to test + * them. I suspect that the ADAT clock might not follow 176400 or 192000 + * because the AF16Rig won't accept ADAT audio data at those rates. + */ + QUIRK_AF16RIG_CLOCK(43), /* ADAT clock */ + QUIRK_AF16RIG_CLOCK(44), /* BNC word clock */ +#endif { QUIRK_DATA_IGNORE(3) }, /* Firmware update */ QUIRK_COMPOSITE_END } } }, +#undef QUIRK_AF16RIG_CLOCK +#undef QUIRK_AF16RIG + #undef USB_DEVICE_VENDOR_SPEC #undef USB_AUDIO_DEVICE