diff mbox

[22/49] fireworks/firewire-lib: Add a quirk for empty packet with TAG0

Message ID 1398433530-13136-23-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State Accepted
Commit 7ab566453fe32d6745a82772a16e9bc34c5403a5
Delegated to: Takashi Iwai
Headers show

Commit Message

Takashi Sakamoto April 25, 2014, 1:45 p.m. UTC
Fireworks has a quirk to transmit empty packets with TAG0. This commit
adds handling this quirk for full duplex stream synchronization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/amdtp.c                      | 9 ++++++---
 sound/firewire/amdtp.h                      | 2 ++
 sound/firewire/fireworks/fireworks_stream.c | 2 ++
 3 files changed, 10 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c
index 5b88461..dce4c6d 100644
--- a/sound/firewire/amdtp.c
+++ b/sound/firewire/amdtp.c
@@ -815,7 +815,7 @@  int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
 	};
 	unsigned int header_size;
 	enum dma_data_direction dir;
-	int type, err;
+	int type, tag, err;
 
 	mutex_lock(&s->mutex);
 
@@ -869,9 +869,12 @@  int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
 	} while (s->packet_index > 0);
 
 	/* NOTE: TAG1 matches CIP. This just affects in stream. */
+	tag = FW_ISO_CONTEXT_MATCH_TAG1;
+	if (s->flags & CIP_EMPTY_WITH_TAG0)
+		tag |= FW_ISO_CONTEXT_MATCH_TAG0;
+
 	s->callbacked = false;
-	err = fw_iso_context_start(s->context, -1, 0,
-				   FW_ISO_CONTEXT_MATCH_TAG1);
+	err = fw_iso_context_start(s->context, -1, 0, tag);
 	if (err < 0)
 		goto err_context;
 
diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h
index 3de3463..96b96ec 100644
--- a/sound/firewire/amdtp.h
+++ b/sound/firewire/amdtp.h
@@ -18,11 +18,13 @@ 
  *	the overall sample rate comes out right.
  * @CIP_SYNC_TO_DEVICE: In sync to device mode, time stamp in out packets is
  *	generated by in packets. Defaultly this driver generates timestamp.
+ * @CIP_EMPTY_WITH_TAG0: Only for in-stream. Empty in-packets have TAG0.
  */
 enum cip_flags {
 	CIP_NONBLOCKING		= 0x00,
 	CIP_BLOCKING		= 0x01,
 	CIP_SYNC_TO_DEVICE	= 0x02,
+	CIP_EMPTY_WITH_TAG0	= 0x04,
 };
 
 /**
diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c
index ec62aa6..360e871 100644
--- a/sound/firewire/fireworks/fireworks_stream.c
+++ b/sound/firewire/fireworks/fireworks_stream.c
@@ -194,6 +194,8 @@  int snd_efw_stream_init_duplex(struct snd_efw *efw)
 	err = init_stream(efw, &efw->tx_stream);
 	if (err < 0)
 		goto end;
+	/* Fireworks transmits NODATA packets with TAG0. */
+	efw->tx_stream.flags |= CIP_EMPTY_WITH_TAG0;
 
 	err = init_stream(efw, &efw->rx_stream);
 	if (err < 0) {