All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de, tiwai@suse.de
Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sf.net
Subject: [PATCH 4/8] ALSA: oxfw: add MIDI capture port for SCS.1 models
Date: Tue, 22 Dec 2015 09:15:42 +0900	[thread overview]
Message-ID: <1450743346-14071-5-git-send-email-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <1450743346-14071-1-git-send-email-o-takashi@sakamocchi.jp>

This commit adds MIDI capture so that scs1x driver has.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/oxfw/oxfw-scs1x.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/sound/firewire/oxfw/oxfw-scs1x.c b/sound/firewire/oxfw/oxfw-scs1x.c
index 3e0349b..6ab63f2 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);
-- 
2.5.0

  parent reply	other threads:[~2015-12-22  0:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22  0:15 [PATCH 0/8] ALSA: oxfw: obsolete snd-scs1x with snd-oxfw Takashi Sakamoto
2015-12-22  0:15 ` [PATCH 1/8] ALSA: oxfw: add scs1x layer Takashi Sakamoto
2015-12-22  0:15 ` [PATCH 2/8] ALSA: oxfw: allocate own address region for SCS.1 series Takashi Sakamoto
2015-12-22  0:15 ` [PATCH 3/8] ALSA: oxfw: copy handlers of asynchronous transaction for MIDI capture Takashi Sakamoto
2015-12-22  0:15 ` Takashi Sakamoto [this message]
2015-12-22  0:15 ` [PATCH 5/8] ALSA: oxfw: copy handlers of asynchronous transaction for MIDI playback Takashi Sakamoto
2015-12-22  0:15 ` [PATCH 6/8] ALSA: oxfw: add MIDI playback port for SCS.1 models Takashi Sakamoto
2015-12-22  0:15 ` [PATCH 7/8] ALSA: oxfw: obsolete scs1x module Takashi Sakamoto
2015-12-22  0:15 ` [PATCH 8/8] ALSA: oxfw: add stream format quirk for SCS.1 models Takashi Sakamoto
2015-12-22  9:17 ` [PATCH 0/8] ALSA: oxfw: obsolete snd-scs1x with snd-oxfw Takashi Iwai
2015-12-22 10:44   ` Takashi Sakamoto
2015-12-22 10:53     ` Takashi Iwai
2015-12-22 10:58       ` Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450743346-14071-5-git-send-email-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=ffado-devel@lists.sf.net \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.