summaryrefslogtreecommitdiff
path: root/sound/firewire/motu/motu-stream.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-03-22 21:30:23 +0900
committerTakashi Iwai <tiwai@suse.de>2017-03-28 12:33:56 +0200
commit9e796e7d59e71f8a556cfbdc2ffa3aff0555dd0e (patch)
tree2248865f8f2695690589c5792cda0092f0afc1e8 /sound/firewire/motu/motu-stream.c
parentdd49b2d1f04af9b1f44e9fe82c85f374f662c61b (diff)
ALSA: firewire-motu: add MIDI functionality
In MOTU FireWire series, MIDI messages are multiplexed to isochronous packets as well as PCM frames, while the way is different from the one in IEC 61883-6. MIDI messages are put into a certain position in message chunks. One data block can includes one byte of the MIDI messages. When data block includes a MIDI byte, the block has a flag in a certain position of the message chunk. These positions are unique depending on protocols. Once a data block includes a MIDI byte, some following data blocks includes no MIDI bytes. Next MIDI byte appears on a data block corresponding to next cycle of physical MIDI bus. This seems to avoid buffer overflow caused by bandwidth differences between IEEE 1394 bus and physical MIDI bus. This commit adds MIDI functionality to transfer/receive MIDI messages. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/motu/motu-stream.c')
-rw-r--r--sound/firewire/motu/motu-stream.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c
index 9aa698fc8da2..911d3487f775 100644
--- a/sound/firewire/motu/motu-stream.c
+++ b/sound/firewire/motu/motu-stream.c
@@ -28,22 +28,25 @@
static int start_both_streams(struct snd_motu *motu, unsigned int rate)
{
+ unsigned int midi_ports = 0;
__be32 reg;
u32 data;
int err;
+ if (motu->spec->flags & SND_MOTU_SPEC_HAS_MIDI)
+ midi_ports = 1;
+
/* Set packet formation to our packet streaming engine. */
- err = amdtp_motu_set_parameters(&motu->rx_stream, rate,
+ err = amdtp_motu_set_parameters(&motu->rx_stream, rate, midi_ports,
&motu->rx_packet_formats);
if (err < 0)
return err;
- err = amdtp_motu_set_parameters(&motu->tx_stream, rate,
+ err = amdtp_motu_set_parameters(&motu->tx_stream, rate, midi_ports,
&motu->tx_packet_formats);
if (err < 0)
return err;
-
/* Get isochronous resources on the bus. */
err = fw_iso_resources_allocate(&motu->rx_resources,
amdtp_stream_get_max_payload(&motu->rx_stream),