summaryrefslogtreecommitdiff
path: root/sound/firewire
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-12-22 03:15:42 +0300
committerTakashi Iwai <tiwai@suse.de>2015-12-22 13:51:29 +0300
commit8250427dc1a2f0a4f9de0ee5a3324fa6c75b44a1 (patch)
treef90e3d317d686e1a606d70ee50b4a755f0a4055b /sound/firewire
parent13b8b78c7fd65abf8b100cc05166cca1d10a1e80 (diff)
downloadlinux-8250427dc1a2f0a4f9de0ee5a3324fa6c75b44a1.tar.xz
ALSA: oxfw: add MIDI capture port for SCS.1 models
This commit adds MIDI capture 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.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/sound/firewire/oxfw/oxfw-scs1x.c b/sound/firewire/oxfw/oxfw-scs1x.c
index 3e0349bced96..6ab63f23b345 100644
--- a/sound/firewire/oxfw/oxfw-scs1x.c
+++ b/sound/firewire/oxfw/oxfw-scs1x.c
@@ -106,6 +106,34 @@ end:
fw_send_response(card, request, rcode);
}
+static int midi_capture_open(struct snd_rawmidi_substream *stream)
+{
+ return 0;
+}
+
+static int midi_capture_close(struct snd_rawmidi_substream *stream)
+{
+ return 0;
+}
+
+static void midi_capture_trigger(struct snd_rawmidi_substream *stream, int up)
+{
+ struct fw_scs1x *scs = stream->rmidi->private_data;
+
+ if (up) {
+ scs->input_escape_count = 0;
+ ACCESS_ONCE(scs->input) = stream;
+ } else {
+ ACCESS_ONCE(scs->input) = NULL;
+ }
+}
+
+static struct snd_rawmidi_ops midi_capture_ops = {
+ .open = midi_capture_open,
+ .close = midi_capture_close,
+ .trigger = midi_capture_trigger,
+};
+
static int register_address(struct snd_oxfw *oxfw)
{
struct fw_scs1x *scs = oxfw->spec;
@@ -154,7 +182,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, 0, &rmidi);
+ err = snd_rawmidi_new(oxfw->card, "SCS.1x", 0, 0, 1, &rmidi);
if (err < 0)
goto err_allocated;
rmidi->private_data = scs;
@@ -163,6 +191,10 @@ 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;
+ snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
+ &midi_capture_ops);
+
return 0;
err_allocated:
fw_core_remove_address_handler(&scs->hss_handler);