aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob/bebob.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2021-06-11 12:50:03 +0900
committerTakashi Iwai <tiwai@suse.de>2021-06-11 10:30:16 +0200
commit93cd12d6e88a4c6f9204633ff07781cde741e89e (patch)
treea644f20b83b2adf7928d18101ca6b53fc9a4833b /sound/firewire/bebob/bebob.c
parentALSA: bebob: delete workaround for protocol version 3 (diff)
downloadlinux-dev-93cd12d6e88a4c6f9204633ff07781cde741e89e.tar.xz
linux-dev-93cd12d6e88a4c6f9204633ff07781cde741e89e.zip
ALSA: bebob: code refactoring for model-dependent quirks
This commit adds enumeration and structure member as code refactoring regarding to model-dependent quirks. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611035003.26852-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/bebob/bebob.c')
-rw-r--r--sound/firewire/bebob/bebob.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
index 25222cc27e43..452317e53565 100644
--- a/sound/firewire/bebob/bebob.c
+++ b/sound/firewire/bebob/bebob.c
@@ -159,6 +159,30 @@ check_audiophile_booted(struct fw_unit *unit)
return strncmp(name, "FW Audiophile Bootloader", 24) != 0;
}
+static int detect_quirks(struct snd_bebob *bebob, const struct ieee1394_device_id *entry)
+{
+ if (entry->vendor_id == VEN_MAUDIO1) {
+ switch (entry->model_id) {
+ case MODEL_MAUDIO_PROFIRELIGHTBRIDGE:
+ // 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.
+ bebob->quirks |= SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC;
+ break;
+ case MODEL_MAUDIO_FW1814:
+ case MODEL_MAUDIO_PROJECTMIX:
+ // At high sampling rate, M-Audio special firmware transmits empty packet
+ // with the value of dbc incremented by 8.
+ bebob->quirks |= SND_BEBOB_QUIRK_WRONG_DBC;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return 0;
+}
+
static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry)
{
unsigned int card_index;
@@ -219,6 +243,10 @@ static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *en
if (err < 0)
goto error;
+ err = detect_quirks(bebob, entry);
+ if (err < 0)
+ goto error;
+
if (bebob->spec == &maudio_special_spec) {
if (entry->model_id == MODEL_MAUDIO_FW1814)
err = snd_bebob_maudio_special_discover(bebob, true);
@@ -230,12 +258,6 @@ static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *en
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 (entry->vendor_id == VEN_MAUDIO1 && entry->model_id == MODEL_MAUDIO_PROFIRELIGHTBRIDGE)
- bebob->discontinuity_quirk = true;
-
err = snd_bebob_stream_init_duplex(bebob);
if (err < 0)
goto error;