summaryrefslogtreecommitdiff
path: root/sound/firewire/oxfw/oxfw.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-12-09 00:10:46 +0900
committerTakashi Iwai <tiwai@suse.de>2014-12-10 10:48:59 +0100
commitb0ac00095fe1485f60bb8ea7326426d3d02a1aec (patch)
treeffc60793adba922ceb4fa9ca34f63cc552a2c79b /sound/firewire/oxfw/oxfw.c
parentec4dba5053e1109368fb80d1c0b88f2a9c971122 (diff)
ALSA: oxfw: Add support AMDTP in-stream
Previous commit adds support for some devices which can capture PCM samples. These devices transmit AMDTP stream in non-blocking mode. This commit adds functionality to handle AMDTP incoming stream. OXFW seems to have two quirks: - Transmits packets with non-zero dbc in its beginning - Transmits packets with wrong values in syt field For the first quirk, this commit adds CIP_SKIP_INIT_DBC_CHECK flag for incoming stream to skip first check of dbc. For the second quirk, this commit doesn't add duplex stream which Fireworks/BeBoB drivers use. So OXFW driver generates syt value for outgoing stream. Here are examples of a sequence of packets transmitted by Behringer F-Control Audio 202. There are differences between sequences of syt value when OXFW driver transfers outgoing stream or not. When driver gives no outgoing stream: Index Payload CIP_Header_0 CIP_Header_1 38 14 00020092 900103D1 39 12 00020098 900102FF 40 12 0002009D 9001027F 41 14 000200A2 90010396 42 14 000200A8 900102E8 43 12 000200AE 90010219 44 14 000200B3 90010331 45 12 000200B9 9001025F 46 14 000200BE 90010376 47 12 000200C4 900102A1 00 12 000200C9 9001023E 01 14 000200CE 90010358 02 12 000200D4 90010289 03 16 000200D9 900103A3 04 12 000200E0 900102DD 05 14 000200E5 900103F1 06 12 000200EB 90010335 07 12 000200F0 90010263 08 14 000200F5 9001037C 09 12 000200FB 900102AE When driver gives outgoing stream: Index Payload CIP_Header_0 CIP_Header_1 38 12 000200BD 900104A8 39 14 000200C2 900104A8 40 12 000200C8 900104AC 41 14 000200CD 900104A9 42 12 000200D3 900104B1 43 14 000200D8 900104A8 44 12 000200DE 900104AA 45 14 000200E3 900104A9 46 14 000200E9 900104AE 47 12 000200EF 900104A8 00 14 000200F4 900104AD 01 12 000200FA 900104A7 02 14 000200FF 900104A9 03 12 00020005 900104A9 04 14 0002000A 900104B1 05 12 00020010 900104AA 06 14 00020015 900104AD 07 12 0002001B 900104A7 08 14 00020020 900104AC 09 12 00020026 900104A7 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/oxfw/oxfw.c')
-rw-r--r--sound/firewire/oxfw/oxfw.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
index 797af33c7bcb..23c00a2bb7d3 100644
--- a/sound/firewire/oxfw/oxfw.c
+++ b/sound/firewire/oxfw/oxfw.c
@@ -109,8 +109,10 @@ static void oxfw_card_free(struct snd_card *card)
struct snd_oxfw *oxfw = card->private_data;
unsigned int i;
- for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++)
+ for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
+ kfree(oxfw->tx_stream_formats[i]);
kfree(oxfw->rx_stream_formats[i]);
+ }
mutex_destroy(&oxfw->mutex);
}
@@ -157,13 +159,20 @@ static int oxfw_probe(struct fw_unit *unit,
snd_oxfw_proc_init(oxfw);
- err = snd_oxfw_stream_init_simplex(oxfw);
+ err = snd_oxfw_stream_init_simplex(oxfw, &oxfw->rx_stream);
if (err < 0)
goto error;
+ if (oxfw->has_output) {
+ err = snd_oxfw_stream_init_simplex(oxfw, &oxfw->tx_stream);
+ if (err < 0)
+ goto error;
+ }
err = snd_card_register(card);
if (err < 0) {
- snd_oxfw_stream_destroy_simplex(oxfw);
+ snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
+ if (oxfw->has_output)
+ snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
goto error;
}
dev_set_drvdata(&unit->device, oxfw);
@@ -181,7 +190,11 @@ static void oxfw_bus_reset(struct fw_unit *unit)
fcp_bus_reset(oxfw->unit);
mutex_lock(&oxfw->mutex);
- snd_oxfw_stream_update_simplex(oxfw);
+
+ snd_oxfw_stream_update_simplex(oxfw, &oxfw->rx_stream);
+ if (oxfw->has_output)
+ snd_oxfw_stream_update_simplex(oxfw, &oxfw->tx_stream);
+
mutex_unlock(&oxfw->mutex);
}
@@ -191,7 +204,9 @@ static void oxfw_remove(struct fw_unit *unit)
snd_card_disconnect(oxfw->card);
- snd_oxfw_stream_destroy_simplex(oxfw);
+ snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
+ if (oxfw->has_output)
+ snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
snd_card_free_when_closed(oxfw->card);
}