ALSA: firewire-motu: move spec data to v2 protocol file
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 19 May 2020 11:16:28 +0000 (20:16 +0900)
committerTakashi Iwai <tiwai@suse.de>
Fri, 22 May 2020 14:52:09 +0000 (16:52 +0200)
The most of members in spec data is used in each protocol file. It's
better to capsulate the data to the file.

This commit moves the data to the file for protocol version 2.

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

index 619b6ae..ed71c08 100644 (file)
@@ -300,3 +300,60 @@ const struct snd_motu_protocol snd_motu_protocol_v2 = {
        .switch_fetching_mode   = v2_switch_fetching_mode,
        .cache_packet_formats   = v2_cache_packet_formats,
 };
+
+const struct snd_motu_spec snd_motu_spec_828mk2 = {
+       .name = "828mk2",
+       .protocol = &snd_motu_protocol_v2,
+       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
+                SND_MOTU_SPEC_TX_MICINST_CHUNK |
+                SND_MOTU_SPEC_TX_RETURN_CHUNK |
+                SND_MOTU_SPEC_RX_SEPARATED_MAIN |
+                SND_MOTU_SPEC_HAS_OPT_IFACE_A |
+                SND_MOTU_SPEC_RX_MIDI_2ND_Q |
+                SND_MOTU_SPEC_TX_MIDI_2ND_Q,
+
+       .analog_in_ports = 8,
+       .analog_out_ports = 8,
+};
+
+const struct snd_motu_spec snd_motu_spec_traveler = {
+       .name = "Traveler",
+       .protocol = &snd_motu_protocol_v2,
+       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
+                SND_MOTU_SPEC_SUPPORT_CLOCK_X4 |
+                SND_MOTU_SPEC_TX_RETURN_CHUNK |
+                SND_MOTU_SPEC_HAS_AESEBU_IFACE |
+                SND_MOTU_SPEC_HAS_OPT_IFACE_A |
+                SND_MOTU_SPEC_RX_MIDI_2ND_Q |
+                SND_MOTU_SPEC_TX_MIDI_2ND_Q,
+
+       .analog_in_ports = 8,
+       .analog_out_ports = 8,
+};
+
+const struct snd_motu_spec snd_motu_spec_ultralite = {
+       .name = "UltraLite",
+       .protocol = &snd_motu_protocol_v2,
+       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
+                SND_MOTU_SPEC_TX_MICINST_CHUNK | // padding.
+                SND_MOTU_SPEC_TX_RETURN_CHUNK |
+                SND_MOTU_SPEC_RX_MIDI_2ND_Q |
+                SND_MOTU_SPEC_TX_MIDI_2ND_Q |
+                SND_MOTU_SPEC_RX_SEPARATED_MAIN,
+       .analog_in_ports = 8,
+       .analog_out_ports = 8,
+};
+
+const struct snd_motu_spec snd_motu_spec_8pre = {
+       .name = "8pre",
+       .protocol = &snd_motu_protocol_v2,
+       // In tx, use coax chunks for mix-return 1/2. In rx, use coax chunks for
+       // dummy 1/2.
+       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
+                SND_MOTU_SPEC_HAS_OPT_IFACE_A |
+                SND_MOTU_SPEC_HAS_OPT_IFACE_B |
+                SND_MOTU_SPEC_RX_MIDI_2ND_Q |
+                SND_MOTU_SPEC_TX_MIDI_2ND_Q,
+       .analog_in_ports = 8,
+       .analog_out_ports = 2,
+};
index f2080d7..b353352 100644 (file)
@@ -172,63 +172,6 @@ static void motu_bus_update(struct fw_unit *unit)
        snd_motu_transaction_reregister(motu);
 }
 
-const struct snd_motu_spec snd_motu_spec_828mk2 = {
-       .name = "828mk2",
-       .protocol = &snd_motu_protocol_v2,
-       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
-                SND_MOTU_SPEC_TX_MICINST_CHUNK |
-                SND_MOTU_SPEC_TX_RETURN_CHUNK |
-                SND_MOTU_SPEC_RX_SEPARATED_MAIN |
-                SND_MOTU_SPEC_HAS_OPT_IFACE_A |
-                SND_MOTU_SPEC_RX_MIDI_2ND_Q |
-                SND_MOTU_SPEC_TX_MIDI_2ND_Q,
-
-       .analog_in_ports = 8,
-       .analog_out_ports = 8,
-};
-
-static const struct snd_motu_spec motu_traveler = {
-       .name = "Traveler",
-       .protocol = &snd_motu_protocol_v2,
-       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
-                SND_MOTU_SPEC_SUPPORT_CLOCK_X4 |
-                SND_MOTU_SPEC_TX_RETURN_CHUNK |
-                SND_MOTU_SPEC_HAS_AESEBU_IFACE |
-                SND_MOTU_SPEC_HAS_OPT_IFACE_A |
-                SND_MOTU_SPEC_RX_MIDI_2ND_Q |
-                SND_MOTU_SPEC_TX_MIDI_2ND_Q,
-
-       .analog_in_ports = 8,
-       .analog_out_ports = 8,
-};
-
-static const struct snd_motu_spec motu_ultralite = {
-       .name = "UltraLite",
-       .protocol = &snd_motu_protocol_v2,
-       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
-                SND_MOTU_SPEC_TX_MICINST_CHUNK | // padding.
-                SND_MOTU_SPEC_TX_RETURN_CHUNK |
-                SND_MOTU_SPEC_RX_MIDI_2ND_Q |
-                SND_MOTU_SPEC_TX_MIDI_2ND_Q |
-                SND_MOTU_SPEC_RX_SEPARATED_MAIN,
-       .analog_in_ports = 8,
-       .analog_out_ports = 8,
-};
-
-static const struct snd_motu_spec motu_8pre = {
-       .name = "8pre",
-       .protocol = &snd_motu_protocol_v2,
-       // In tx, use coax chunks for mix-return 1/2. In rx, use coax chunks for
-       // dummy 1/2.
-       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
-                SND_MOTU_SPEC_HAS_OPT_IFACE_A |
-                SND_MOTU_SPEC_HAS_OPT_IFACE_B |
-                SND_MOTU_SPEC_RX_MIDI_2ND_Q |
-                SND_MOTU_SPEC_TX_MIDI_2ND_Q,
-       .analog_in_ports = 8,
-       .analog_out_ports = 2,
-};
-
 static const struct snd_motu_spec motu_828mk3 = {
        .name = "828mk3",
        .protocol = &snd_motu_protocol_v3,
@@ -284,9 +227,9 @@ static const struct snd_motu_spec motu_4pre = {
 
 static const struct ieee1394_device_id motu_id_table[] = {
        SND_MOTU_DEV_ENTRY(0x000003, &snd_motu_spec_828mk2),
-       SND_MOTU_DEV_ENTRY(0x000009, &motu_traveler),
-       SND_MOTU_DEV_ENTRY(0x00000d, &motu_ultralite),
-       SND_MOTU_DEV_ENTRY(0x00000f, &motu_8pre),
+       SND_MOTU_DEV_ENTRY(0x000009, &snd_motu_spec_traveler),
+       SND_MOTU_DEV_ENTRY(0x00000d, &snd_motu_spec_ultralite),
+       SND_MOTU_DEV_ENTRY(0x00000f, &snd_motu_spec_8pre),
        SND_MOTU_DEV_ENTRY(0x000015, &motu_828mk3),     /* FireWire only. */
        SND_MOTU_DEV_ENTRY(0x000035, &motu_828mk3),     /* Hybrid. */
        SND_MOTU_DEV_ENTRY(0x000033, &motu_audio_express),
index 6efbde4..ead6cc8 100644 (file)
@@ -131,6 +131,9 @@ extern const struct snd_motu_protocol snd_motu_protocol_v2;
 extern const struct snd_motu_protocol snd_motu_protocol_v3;
 
 extern const struct snd_motu_spec snd_motu_spec_828mk2;
+extern const struct snd_motu_spec snd_motu_spec_traveler;
+extern const struct snd_motu_spec snd_motu_spec_ultralite;
+extern const struct snd_motu_spec snd_motu_spec_8pre;
 
 int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit,
                    enum amdtp_stream_direction dir,