ALSA: firewire-motu: move spec data to v3 protocol file
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 19 May 2020 11:16:29 +0000 (20:16 +0900)
committerTakashi Iwai <tiwai@suse.de>
Fri, 22 May 2020 14:52:10 +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 3.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-3-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 d1545e2b5caaa7dc3b1d05abb63d86e9d1a3dca8..947fab7905fe0d026290c10e2658ef292de3eb9e 100644 (file)
@@ -314,3 +314,45 @@ const struct snd_motu_protocol snd_motu_protocol_v3 = {
        .switch_fetching_mode   = v3_switch_fetching_mode,
        .cache_packet_formats   = v3_cache_packet_formats,
 };
+
+const struct snd_motu_spec snd_motu_spec_828mk3 = {
+       .name = "828mk3",
+       .protocol = &snd_motu_protocol_v3,
+       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
+                SND_MOTU_SPEC_SUPPORT_CLOCK_X4 |
+                SND_MOTU_SPEC_TX_MICINST_CHUNK |
+                SND_MOTU_SPEC_TX_RETURN_CHUNK |
+                SND_MOTU_SPEC_TX_REVERB_CHUNK |
+                SND_MOTU_SPEC_RX_SEPARATED_MAIN |
+                SND_MOTU_SPEC_HAS_OPT_IFACE_A |
+                SND_MOTU_SPEC_HAS_OPT_IFACE_B |
+                SND_MOTU_SPEC_RX_MIDI_3RD_Q |
+                SND_MOTU_SPEC_TX_MIDI_3RD_Q,
+
+       .analog_in_ports = 8,
+       .analog_out_ports = 8,
+};
+
+const struct snd_motu_spec snd_motu_spec_audio_express = {
+       .name = "AudioExpress",
+       .protocol = &snd_motu_protocol_v3,
+       .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_RX_MIDI_2ND_Q |
+                SND_MOTU_SPEC_TX_MIDI_3RD_Q,
+       .analog_in_ports = 2,
+       .analog_out_ports = 4,
+};
+
+const struct snd_motu_spec snd_motu_spec_4pre = {
+       .name = "4pre",
+       .protocol = &snd_motu_protocol_v3,
+       .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,
+       .analog_in_ports = 2,
+       .analog_out_ports = 2,
+};
index b3533526f7e550dd5e10648444f0e8edd5e1a3ba..e5b6f634aa3515d39d8cba976b25cb9d08172e89 100644 (file)
@@ -172,48 +172,6 @@ static void motu_bus_update(struct fw_unit *unit)
        snd_motu_transaction_reregister(motu);
 }
 
-static const struct snd_motu_spec motu_828mk3 = {
-       .name = "828mk3",
-       .protocol = &snd_motu_protocol_v3,
-       .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
-                SND_MOTU_SPEC_SUPPORT_CLOCK_X4 |
-                SND_MOTU_SPEC_TX_MICINST_CHUNK |
-                SND_MOTU_SPEC_TX_RETURN_CHUNK |
-                SND_MOTU_SPEC_TX_REVERB_CHUNK |
-                SND_MOTU_SPEC_RX_SEPARATED_MAIN |
-                SND_MOTU_SPEC_HAS_OPT_IFACE_A |
-                SND_MOTU_SPEC_HAS_OPT_IFACE_B |
-                SND_MOTU_SPEC_RX_MIDI_3RD_Q |
-                SND_MOTU_SPEC_TX_MIDI_3RD_Q,
-
-       .analog_in_ports = 8,
-       .analog_out_ports = 8,
-};
-
-static const struct snd_motu_spec motu_audio_express = {
-       .name = "AudioExpress",
-       .protocol = &snd_motu_protocol_v3,
-       .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_RX_MIDI_2ND_Q |
-                SND_MOTU_SPEC_TX_MIDI_3RD_Q,
-       .analog_in_ports = 2,
-       .analog_out_ports = 4,
-};
-
-static const struct snd_motu_spec motu_4pre = {
-       .name = "4pre",
-       .protocol = &snd_motu_protocol_v3,
-       .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,
-       .analog_in_ports = 2,
-       .analog_out_ports = 2,
-};
-
 #define SND_MOTU_DEV_ENTRY(model, data)                        \
 {                                                      \
        .match_flags    = IEEE1394_MATCH_VENDOR_ID |    \
@@ -230,10 +188,10 @@ static const struct ieee1394_device_id motu_id_table[] = {
        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),
-       SND_MOTU_DEV_ENTRY(0x000045, &motu_4pre),
+       SND_MOTU_DEV_ENTRY(0x000015, &snd_motu_spec_828mk3), // FireWire only.
+       SND_MOTU_DEV_ENTRY(0x000035, &snd_motu_spec_828mk3), // Hybrid.
+       SND_MOTU_DEV_ENTRY(0x000033, &snd_motu_spec_audio_express),
+       SND_MOTU_DEV_ENTRY(0x000045, &snd_motu_spec_4pre),
        { }
 };
 MODULE_DEVICE_TABLE(ieee1394, motu_id_table);
index ead6cc840d5005df54df38d65b9ef88792d3e28e..7774c23f16375ca2efcfcf8dc2a276465bb084be 100644 (file)
@@ -135,6 +135,10 @@ 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;
 
+extern const struct snd_motu_spec snd_motu_spec_828mk3;
+extern const struct snd_motu_spec snd_motu_spec_audio_express;
+extern const struct snd_motu_spec snd_motu_spec_4pre;
+
 int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit,
                    enum amdtp_stream_direction dir,
                    const struct snd_motu_protocol *const protocol);