ALSA: firewire-motu: add support for MOTU Traveler mk3
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Thu, 4 Nov 2021 11:06:27 +0000 (20:06 +0900)
committerTakashi Iwai <tiwai@suse.de>
Thu, 4 Nov 2021 15:32:19 +0000 (16:32 +0100)
Mark of the Unicorn (MOTU) shipped Traveler mk3 as one of models in third
generation of its FireWire series, and discontinued it already. The model
consists of below ICs:

 * Texas Instruments TSB41AB2
 * Phillips Semiconductors PDI1394L40
 * Altera cyclone EP1C3
 * Texas Instruments TMS320VC5402

It supports sampling transfer frequency up to 192.0 kHz. The packet
format differs depending on both of current sampling transfer frequency
and whether to enable ADAT channels in rx/tx packets. The model supports
transmission of PCM frames as well as MIDI messages.

The model supports command mechanism to configure internal DSP. Hardware
meter information is available in the first 2 chunks of each data block
of tx packet.

This commit adds support for it.

$ cd linux-firewire-tools/src
$ python crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  0410af0a  bus_info_length 4, crc_length 16, crc 44810
404  31333934  bus_name "1394"
408  20ff7000  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256)
40c  0001f200  company_id 0001f2     |
410  00090911  device_id 0000090911  | EUI-64 0001f20000090911

               root directory
               -----------------------------------------------------------------
414  0004ef04  directory_length 4, crc 61188
418  030001f2  vendor
41c  0c0083c0  node capabilities per IEEE 1394
420  d1000002  --> unit directory at 428
424  8d000005  --> eui-64 leaf at 438

               unit directory at 428
               -----------------------------------------------------------------
428  00031733  directory_length 3, crc 5939
42c  120001f2  specifier id
430  1300001b  version
434  17102800  model

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  00028484  leaf_length 2, crc 33924
43c  0001f200  company_id 0001f2     |
440  00090911  device_id 0000090911  | EUI-64 0001f20000090911

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211104110627.94469-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/motu/motu-protocol-v3.c
sound/firewire/motu/motu.c
sound/firewire/motu/motu.h

index 05608e8ca0bccead6b6d2a5ed7be0582ee21a668..1371f38505d0c63f1f53c81ce949dd249c4c3362 100644 (file)
@@ -16,6 +16,7 @@
 #define   V3_CLOCK_SRC_INTERNAL                0x00
 #define   V3_CLOCK_SRC_WORD_ON_BNC     0x01
 #define   V3_CLOCK_SRC_SPH             0x02
+#define   V3_CLOCK_SRC_AESEBU_ON_XLR   0x08
 #define   V3_CLOCK_SRC_SPDIF_ON_COAX   0x10
 #define   V3_CLOCK_SRC_OPT_IFACE_A     0x18
 #define   V3_CLOCK_SRC_OPT_IFACE_B     0x19
@@ -126,6 +127,9 @@ int snd_motu_protocol_v3_get_clock_source(struct snd_motu *motu,
        case V3_CLOCK_SRC_SPH:
                *src = SND_MOTU_CLOCK_SOURCE_SPH;
                break;
+       case V3_CLOCK_SRC_AESEBU_ON_XLR:
+               *src = SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR;
+               break;
        case V3_CLOCK_SRC_SPDIF_ON_COAX:
                *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX;
                break;
@@ -185,7 +189,7 @@ int snd_motu_protocol_v3_switch_fetching_mode(struct snd_motu *motu,
                                          sizeof(reg));
 }
 
-static int detect_packet_formats_828mk3(struct snd_motu *motu, u32 data)
+static int detect_packet_formats_dual_opt_iface(struct snd_motu *motu, u32 data)
 {
        if (data & V3_ENABLE_OPT_IN_IFACE_A) {
                if (data & V3_NO_ADAT_OPT_IN_IFACE_A) {
@@ -255,8 +259,10 @@ int snd_motu_protocol_v3_cache_packet_formats(struct snd_motu *motu)
               motu->spec->rx_fixed_pcm_chunks,
               sizeof(motu->rx_packet_formats.pcm_chunks));
 
-       if (motu->spec == &snd_motu_spec_828mk3_fw || motu->spec == &snd_motu_spec_828mk3_hybrid)
-               return detect_packet_formats_828mk3(motu, data);
+       if (motu->spec == &snd_motu_spec_828mk3_fw ||
+           motu->spec == &snd_motu_spec_828mk3_hybrid ||
+           motu->spec == &snd_motu_spec_traveler_mk3)
+               return detect_packet_formats_dual_opt_iface(motu, data);
        else
                return 0;
 }
@@ -281,6 +287,16 @@ const struct snd_motu_spec snd_motu_spec_828mk3_hybrid = {
        .rx_fixed_pcm_chunks = {14, 14, 14},    // Additional 4 dummy chunks at higher rate.
 };
 
+const struct snd_motu_spec snd_motu_spec_traveler_mk3 = {
+       .name = "TravelerMk3",
+       .protocol_version = SND_MOTU_PROTOCOL_V3,
+       .flags = SND_MOTU_SPEC_RX_MIDI_3RD_Q |
+                SND_MOTU_SPEC_TX_MIDI_3RD_Q |
+                SND_MOTU_SPEC_COMMAND_DSP,
+       .tx_fixed_pcm_chunks = {18, 14, 10},
+       .rx_fixed_pcm_chunks = {14, 14, 10},
+};
+
 const struct snd_motu_spec snd_motu_spec_ultralite_mk3 = {
        .name = "UltraLiteMk3",
        .protocol_version = SND_MOTU_PROTOCOL_V3,
index 5fc7ae47553736bac49f38aab06714e6d463ea52..080728dd278f93bb89e14a65ca77423372a6f220 100644 (file)
@@ -169,6 +169,7 @@ static const struct ieee1394_device_id motu_id_table[] = {
        SND_MOTU_DEV_ENTRY(0x00000f, &snd_motu_spec_8pre),
        SND_MOTU_DEV_ENTRY(0x000015, &snd_motu_spec_828mk3_fw), // FireWire only.
        SND_MOTU_DEV_ENTRY(0x000019, &snd_motu_spec_ultralite_mk3), // FireWire only.
+       SND_MOTU_DEV_ENTRY(0x00001b, &snd_motu_spec_traveler_mk3),
        SND_MOTU_DEV_ENTRY(0x000030, &snd_motu_spec_ultralite_mk3), // Hybrid.
        SND_MOTU_DEV_ENTRY(0x000035, &snd_motu_spec_828mk3_hybrid), // Hybrid.
        SND_MOTU_DEV_ENTRY(0x000033, &snd_motu_spec_audio_express),
index 79704ae6a73e3bfec58b35575e1c5f6e7518d64c..6ad1feab478b3a670d2771ab452ddeabb3124ff6 100644 (file)
@@ -138,6 +138,7 @@ extern const struct snd_motu_spec snd_motu_spec_8pre;
 
 extern const struct snd_motu_spec snd_motu_spec_828mk3_fw;
 extern const struct snd_motu_spec snd_motu_spec_828mk3_hybrid;
+extern const struct snd_motu_spec snd_motu_spec_traveler_mk3;
 extern const struct snd_motu_spec snd_motu_spec_ultralite_mk3;
 extern const struct snd_motu_spec snd_motu_spec_audio_express;
 extern const struct snd_motu_spec snd_motu_spec_4pre;