aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-12-22 09:15:44 +0900
committerTakashi Iwai <tiwai@suse.de>2015-12-22 11:51:31 +0100
commit6f5dcb28df50eafb2d554c84f14c33677a5b95bd (patch)
tree75d0023612d4bf7a04e9ce4349394f4ba94cbb09 /sound/firewire
parentALSA: oxfw: copy handlers of asynchronous transaction for MIDI playback (diff)
downloadlinux-dev-6f5dcb28df50eafb2d554c84f14c33677a5b95bd.tar.xz
linux-dev-6f5dcb28df50eafb2d554c84f14c33677a5b95bd.zip
ALSA: oxfw: add MIDI playback port for SCS.1 models
This commit adds MIDI playback ports so that scs1x driver has. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r--sound/firewire/oxfw/oxfw-scs1x.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/sound/firewire/oxfw/oxfw-scs1x.c b/sound/firewire/oxfw/oxfw-scs1x.c
index 84eacdb9f4c5..bb53eb35721b 100644
--- a/sound/firewire/oxfw/oxfw-scs1x.c
+++ b/sound/firewire/oxfw/oxfw-scs1x.c
@@ -290,6 +290,45 @@ static struct snd_rawmidi_ops midi_capture_ops = {
.trigger = midi_capture_trigger,
};
+static int midi_playback_open(struct snd_rawmidi_substream *stream)
+{
+ return 0;
+}
+
+static int midi_playback_close(struct snd_rawmidi_substream *stream)
+{
+ return 0;
+}
+
+static void midi_playback_trigger(struct snd_rawmidi_substream *stream, int up)
+{
+ struct fw_scs1x *scs = stream->rmidi->private_data;
+
+ if (up) {
+ scs->output_status = 0;
+ scs->output_bytes = 1;
+ scs->output_escaped = false;
+ scs->output_idle = false;
+
+ ACCESS_ONCE(scs->output) = stream;
+ tasklet_schedule(&scs->tasklet);
+ } else {
+ ACCESS_ONCE(scs->output) = NULL;
+ }
+}
+static void midi_playback_drain(struct snd_rawmidi_substream *stream)
+{
+ struct fw_scs1x *scs = stream->rmidi->private_data;
+
+ wait_event(scs->idle_wait, scs->output_idle);
+}
+
+static struct snd_rawmidi_ops midi_playback_ops = {
+ .open = midi_playback_open,
+ .close = midi_playback_close,
+ .trigger = midi_playback_trigger,
+ .drain = midi_playback_drain,
+};
static int register_address(struct snd_oxfw *oxfw)
{
struct fw_scs1x *scs = oxfw->spec;
@@ -339,7 +378,7 @@ int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw)
goto err_allocated;
/* Use unique name for backward compatibility to scs1x module. */
- err = snd_rawmidi_new(oxfw->card, "SCS.1x", 0, 0, 1, &rmidi);
+ err = snd_rawmidi_new(oxfw->card, "SCS.1x", 0, 1, 1, &rmidi);
if (err < 0)
goto err_allocated;
rmidi->private_data = scs;
@@ -348,9 +387,13 @@ int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw)
snprintf(rmidi->name, sizeof(rmidi->name),
"%s MIDI", oxfw->card->shortname);
- rmidi->info_flags = SNDRV_RAWMIDI_INFO_INPUT;
+ rmidi->info_flags = SNDRV_RAWMIDI_INFO_INPUT |
+ SNDRV_RAWMIDI_INFO_OUTPUT |
+ SNDRV_RAWMIDI_INFO_DUPLEX;
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
&midi_capture_ops);
+ snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
+ &midi_playback_ops);
tasklet_init(&scs->tasklet, scs_output_tasklet, (unsigned long)scs);
init_waitqueue_head(&scs->idle_wait);