ALSA: bebob: expand delay of start for IR context just for version 3 firmware

As long as I investigated, there's some cases about the delay for device
between establishing OUTPUT_PLUG and transmitting first isoc packet. For
devices which support BeBoB protocol version 1 can transmit the packet
within several hundred milliseconds, while for devices which support
BeBoB protocol version 3 can transmit the packet within 2 seconds.

Devices with protocol version 1:
 * Edirol FA-66
 * Yamaha GO46
 * Terratec Phase x24 FW
 * M-Audio FireWire AudioPhile
 * M-Audio FireWire Solo
 * M-Audio FireWire 1814
 * M-Audio FireWire 410
 * Focusrite Saffire Pro 26 I/O

Devices with protocol version 3:
 * M-Audio Profire Lightbridge
 * Behringer FCA610
 * Phonic Firefly 202

At present ALSA bebob driver postpones starting IR context during
1.5 sec for all of supported devices. The delay is too long for
devices with protocol version 1, while it's not enough for devices with
protocol version 3.

This commit improves the delay for these protocols.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191101131323.17300-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Sakamoto 2019-11-01 22:13:22 +09:00 committed by Takashi Iwai
parent d3eabe939a
commit da5e83374f

View File

@ -7,7 +7,7 @@
#include "./bebob.h" #include "./bebob.h"
#define CALLBACK_TIMEOUT 2000 #define CALLBACK_TIMEOUT 2500
#define FW_ISO_RESOURCE_DELAY 1000 #define FW_ISO_RESOURCE_DELAY 1000
/* /*
@ -639,6 +639,7 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob)
if (!amdtp_stream_running(&bebob->rx_stream)) { if (!amdtp_stream_running(&bebob->rx_stream)) {
unsigned int curr_rate; unsigned int curr_rate;
unsigned int ir_delay_cycle;
if (bebob->maudio_special_quirk) { if (bebob->maudio_special_quirk) {
err = bebob->spec->rate->get(bebob, &curr_rate); err = bebob->spec->rate->get(bebob, &curr_rate);
@ -660,13 +661,18 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob)
// The device postpones start of transmission mostly for 1 sec // The device postpones start of transmission mostly for 1 sec
// after receives packets firstly. For safe, IR context starts // after receives packets firstly. For safe, IR context starts
// 1.5 sec (=12000 cycles) later. This is within 2.0 sec // 0.4 sec (=3200 cycles) later to version 1 or 2 firmware,
// (=CALLBACK_TIMEOUT). // 2.0 sec (=16000 cycles) for version 3 firmware. This is
// within 2.5 sec (=CALLBACK_TIMEOUT).
// Furthermore, some devices transfer isoc packets with // Furthermore, some devices transfer isoc packets with
// discontinuous counter in the beginning of packet streaming. // discontinuous counter in the beginning of packet streaming.
// The delay has an effect to avoid detection of this // The delay has an effect to avoid detection of this
// discontinuity. // discontinuity.
err = amdtp_domain_start(&bebob->domain, 12000); if (bebob->version < 2)
ir_delay_cycle = 3200;
else
ir_delay_cycle = 16000;
err = amdtp_domain_start(&bebob->domain, ir_delay_cycle);
if (err < 0) if (err < 0)
goto error; goto error;