Skip to content

Commit

Permalink
ALSA: oxfw: perform sequence replay for media clock recovery
Browse files Browse the repository at this point in the history
This commit takes ALSA oxfw driver to perform sequence replay for media
clock recovery. Unfortunately, OXFW970 ASIC and its firmware has a quirk
called jumbo payload which skips several isochronous cycles for packet
transmission, thus the sequence replay is just adopted to OXFW971 ASIC.
As well as Fireworks, OXFW ASICs also ignores presentation time against
the way in IEC 61883-1/6.

The sequence replay is tested with below models:
 * Tascam FireOne
 * Stanton Magnetics SCS.1m
 * Apogee Duet FireWire

For below models, the sequence replay is tested to be disabled:

 * Griffin FireWave
 * Behringer F-Control Audio 202
 * Loud Technology Tapco Link.FireWire 4x6
 * Loud Technology Mackie Onyx Satellite

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210531025103.17880-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Sakamoto authored and Takashi Iwai committed Jun 1, 2021
1 parent a105f64 commit 029ffc4
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions sound/firewire/oxfw/oxfw-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ static int init_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream)
struct cmp_connection *conn;
enum cmp_direction c_dir;
enum amdtp_stream_direction s_dir;
unsigned int flags;
unsigned int flags = CIP_UNAWARE_SYT;
int err;

if (!(oxfw->quirks & SND_OXFW_QUIRK_BLOCKING_TRANSMISSION))
flags = CIP_NONBLOCKING;
flags |= CIP_NONBLOCKING;
else
flags = CIP_BLOCKING;
flags |= CIP_BLOCKING;

if (stream == &oxfw->tx_stream) {
conn = &oxfw->out_conn;
Expand Down Expand Up @@ -337,6 +337,9 @@ int snd_oxfw_stream_start_duplex(struct snd_oxfw *oxfw)
}

if (!amdtp_stream_running(&oxfw->rx_stream)) {
unsigned int tx_init_skip_cycles = 0;
bool replay_seq = false;

err = start_stream(oxfw, &oxfw->rx_stream);
if (err < 0) {
dev_err(&oxfw->unit->device,
Expand All @@ -352,9 +355,20 @@ int snd_oxfw_stream_start_duplex(struct snd_oxfw *oxfw)
"fail to prepare tx stream: %d\n", err);
goto error;
}

if (oxfw->quirks & SND_OXFW_QUIRK_JUMBO_PAYLOAD) {
// Just after changing sampling transfer frequency, many cycles are
// skipped for packet transmission.
tx_init_skip_cycles = 400;
} else {
replay_seq = true;
}
}

err = amdtp_domain_start(&oxfw->domain, 0, false, false);
// NOTE: The device ignores presentation time expressed by the value of syt field
// of CIP header in received packets. The sequence of the number of data blocks per
// packet is important for media clock recovery.
err = amdtp_domain_start(&oxfw->domain, tx_init_skip_cycles, replay_seq, false);
if (err < 0)
goto error;

Expand Down

0 comments on commit 029ffc4

Please sign in to comment.