From 5ec85c198eff077e99bc5ff615eb9618004962e2 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Mon, 24 May 2021 12:13:46 +0900 Subject: [PATCH] ALSA: bebob: distinguish M-Audio ProFire Lightbridge quirk In former commit, ALSA IEC 61883-1/6 packet streaming engine drops initial tx packets till the packet includes any event. This allows ALSA bebob driver not to give option to skip initial packet since the engine does drop the initial packet. However, M-Audio ProFire Lightbridge has a quirk to stop packet transmission after start multiplexing event to the packet. After several thousands cycles, it restart packet transmission again. This commit specializes the usage of initial skip option for the model. Additionally, this commit expands timeout enough to wait processing content of tx packet. Signed-off-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20210524031346.50539-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai --- sound/firewire/bebob/bebob.c | 10 +++++++++- sound/firewire/bebob/bebob.h | 1 + sound/firewire/bebob/bebob_stream.c | 12 +++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index 90e98a6..5938aa3 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c @@ -64,6 +64,7 @@ static DECLARE_BITMAP(devices_used, SNDRV_CARDS); #define MODEL_MAUDIO_AUDIOPHILE_BOTH 0x00010060 #define MODEL_MAUDIO_FW1814 0x00010071 #define MODEL_MAUDIO_PROJECTMIX 0x00010091 +#define MODEL_MAUDIO_PROFIRELIGHTBRIDGE 0x000100a1 static int name_device(struct snd_bebob *bebob) @@ -210,6 +211,13 @@ do_registration(struct work_struct *work) if (err < 0) goto error; + // M-Audio ProFire Lightbridge has a quirk to transfer packets with discontinuous cycle or + // data block counter in early stage of packet streaming. The cycle span from the first + // packet with event is variable. + if (bebob->entry->vendor_id == VEN_MAUDIO1 && + bebob->entry->model_id == MODEL_MAUDIO_PROFIRELIGHTBRIDGE) + bebob->discontinuity_quirk = true; + err = snd_bebob_stream_init_duplex(bebob); if (err < 0) goto error; @@ -476,7 +484,7 @@ static const struct ieee1394_device_id bebob_id_table[] = { /* M-Audio NRV10 */ SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, 0x00010081, &maudio_nrv10_spec), /* M-Audio, ProFireLightbridge */ - SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, 0x000100a1, &spec_normal), + SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, MODEL_MAUDIO_PROFIRELIGHTBRIDGE, &spec_normal), /* Firewire 1814 */ SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, 0x00010070, NULL), /* bootloader */ SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, MODEL_MAUDIO_FW1814, diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h index 4e0ed84..cba6793 100644 --- a/sound/firewire/bebob/bebob.h +++ b/sound/firewire/bebob/bebob.h @@ -115,6 +115,7 @@ struct snd_bebob { /* For BeBoB version quirk. */ unsigned int version; + bool discontinuity_quirk; struct amdtp_domain domain; }; diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 975670a..91306da 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -7,7 +7,7 @@ #include "./bebob.h" -#define READY_TIMEOUT_MS 2500 +#define READY_TIMEOUT_MS 4000 /* * NOTE; @@ -644,12 +644,14 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) if (err < 0) goto error; - // Some devices transfer isoc packets with discontinuous counter in the beginning - // of packet streaming. - if (bebob->version < 2) - tx_init_skip_cycles = 3200; + if (!bebob->discontinuity_quirk) + tx_init_skip_cycles = 0; else tx_init_skip_cycles = 16000; + + // MEMO: In the early stage of packet streaming, the device transfers NODATA packets. + // After several hundred cycles, it begins to multiplex event into the packet with + // syt information. err = amdtp_domain_start(&bebob->domain, tx_init_skip_cycles); if (err < 0) goto error; -- 2.7.4