diff mbox series

ALSA: firewire-motu: fix rx packet format at higher rate for MOTU 828 mk3 Hybrid

Message ID 20210618040713.114611-1-o-takashi@sakamocchi.jp (mailing list archive)
State Accepted
Commit 5b24119e9103a767b065fcf37db2b65bbcf0d52f
Headers show
Series ALSA: firewire-motu: fix rx packet format at higher rate for MOTU 828 mk3 Hybrid | expand

Commit Message

Takashi Sakamoto June 18, 2021, 4:07 a.m. UTC
I assumed that the combination of packet formats for MOTU 828 mk3 Hybrid
is the same as MOTU 828 mk3 FireWire. However at higher sampling rate, it
is different. MOTU 828 mk3 Hybrid has additional 4 dummy data chunks for
rx packet.

This commit fixes the issue to which I address at a commit f2ac3b839540
("ALSA: firewire-motu: sequence replay for source packet header").

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/motu/motu-protocol-v3.c | 15 ++++++++++++---
 sound/firewire/motu/motu.c             |  4 ++--
 sound/firewire/motu/motu.h             |  3 ++-
 3 files changed, 16 insertions(+), 6 deletions(-)

Comments

Takashi Iwai June 18, 2021, 7:43 a.m. UTC | #1
On Fri, 18 Jun 2021 06:07:13 +0200,
Takashi Sakamoto wrote:
> 
> I assumed that the combination of packet formats for MOTU 828 mk3 Hybrid
> is the same as MOTU 828 mk3 FireWire. However at higher sampling rate, it
> is different. MOTU 828 mk3 Hybrid has additional 4 dummy data chunks for
> rx packet.
> 
> This commit fixes the issue to which I address at a commit f2ac3b839540
> ("ALSA: firewire-motu: sequence replay for source packet header").
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Thanks, applied.


Takashi
diff mbox series

Patch

diff --git a/sound/firewire/motu/motu-protocol-v3.c b/sound/firewire/motu/motu-protocol-v3.c
index 4e6b0e449ee4..77e61e89770b 100644
--- a/sound/firewire/motu/motu-protocol-v3.c
+++ b/sound/firewire/motu/motu-protocol-v3.c
@@ -185,7 +185,7 @@  int snd_motu_protocol_v3_get_clock_source(struct snd_motu *motu,
 		return err;
 	data = be32_to_cpu(reg) & V3_CLOCK_SOURCE_MASK;
 
-	if (motu->spec == &snd_motu_spec_828mk3)
+	if (motu->spec == &snd_motu_spec_828mk3_fw || motu->spec == &snd_motu_spec_828mk3_hybrid)
 		return detect_clock_source_828mk3(motu, data, src);
 	else
 		return v3_detect_clock_source(motu, data, src);
@@ -284,14 +284,14 @@  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)
+	if (motu->spec == &snd_motu_spec_828mk3_fw || motu->spec == &snd_motu_spec_828mk3_hybrid)
 		return detect_packet_formats_828mk3(motu, data);
 	else
 		return 0;
 }
 
 
-const struct snd_motu_spec snd_motu_spec_828mk3 = {
+const struct snd_motu_spec snd_motu_spec_828mk3_fw = {
 	.name = "828mk3",
 	.protocol_version = SND_MOTU_PROTOCOL_V3,
 	.flags = SND_MOTU_SPEC_RX_MIDI_3RD_Q |
@@ -300,6 +300,15 @@  const struct snd_motu_spec snd_motu_spec_828mk3 = {
 	.rx_fixed_pcm_chunks = {14, 14, 10},
 };
 
+const struct snd_motu_spec snd_motu_spec_828mk3_hybrid = {
+	.name = "828mk3",
+	.protocol_version = SND_MOTU_PROTOCOL_V3,
+	.flags = SND_MOTU_SPEC_RX_MIDI_3RD_Q |
+		 SND_MOTU_SPEC_TX_MIDI_3RD_Q,
+	.tx_fixed_pcm_chunks = {18, 18, 14},
+	.rx_fixed_pcm_chunks = {14, 14, 14},	// Additional 4 dummy chunks at higher rate.
+};
+
 const struct snd_motu_spec snd_motu_spec_ultralite_mk3 = {
 	.name = "UltraLiteMk3",
 	.protocol_version = SND_MOTU_PROTOCOL_V3,
diff --git a/sound/firewire/motu/motu.c b/sound/firewire/motu/motu.c
index 0cae670d711c..543136578c70 100644
--- a/sound/firewire/motu/motu.c
+++ b/sound/firewire/motu/motu.c
@@ -156,10 +156,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, &snd_motu_spec_828mk3), // FireWire only.
+	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(0x000030, &snd_motu_spec_ultralite_mk3), // Hybrid.
-	SND_MOTU_DEV_ENTRY(0x000035, &snd_motu_spec_828mk3), // Hybrid.
+	SND_MOTU_DEV_ENTRY(0x000035, &snd_motu_spec_828mk3_hybrid), // Hybrid.
 	SND_MOTU_DEV_ENTRY(0x000033, &snd_motu_spec_audio_express),
 	SND_MOTU_DEV_ENTRY(0x000045, &snd_motu_spec_4pre),
 	{ }
diff --git a/sound/firewire/motu/motu.h b/sound/firewire/motu/motu.h
index a3deabdf9e34..73f36d1be515 100644
--- a/sound/firewire/motu/motu.h
+++ b/sound/firewire/motu/motu.h
@@ -130,7 +130,8 @@  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_828mk3_fw;
+extern const struct snd_motu_spec snd_motu_spec_828mk3_hybrid;
 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;