aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-10-30 13:43:15 -0400
committerTakashi Iwai <tiwai@suse.de>2015-10-30 14:34:32 -0400
commitc5fcee0373b390ab8508022951eabd0bd0e06a48 (patch)
treef69b1e28567a4f8b99c76872dbb258ca7ea5b2c5
parent5918f962207329089371d87adbd033830d3f5cf5 (diff)
ALSA: firewire-digi00x: add MIDI operations for MIDI control port
Digi 002/003 family has two types of MIDI port; one is for physical MIDI port and another is for MIDI control message. The former is transferred in isochronous packet, and the latter is transferred by asynchronous transaction. These transmission mechanisms are completely different, while current ALSA digi00x driver defines a set of operations for them with several condition statements. As a result, codes for the operation are messy. This commit adds a set of MIDI operation for control MIDI ports. In later commit, it's applied as an operation for ALSA rawmidi character device. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/firewire/digi00x/digi00x-midi.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/sound/firewire/digi00x/digi00x-midi.c b/sound/firewire/digi00x/digi00x-midi.c
index 1d649e3975a0..527f4b31f5c6 100644
--- a/sound/firewire/digi00x/digi00x-midi.c
+++ b/sound/firewire/digi00x/digi00x-midi.c
@@ -113,6 +113,69 @@ static struct snd_rawmidi_ops midi_phys_playback_ops = {
113 .trigger = midi_phys_playback_trigger, 113 .trigger = midi_phys_playback_trigger,
114}; 114};
115 115
116static int midi_ctl_open(struct snd_rawmidi_substream *substream)
117{
118 /* Do nothing. */
119 return 0;
120}
121
122static int midi_ctl_capture_close(struct snd_rawmidi_substream *substream)
123{
124 /* Do nothing. */
125 return 0;
126}
127
128static int midi_ctl_playback_close(struct snd_rawmidi_substream *substream)
129{
130 struct snd_dg00x *dg00x = substream->rmidi->private_data;
131
132 snd_fw_async_midi_port_finish(&dg00x->out_control);
133
134 return 0;
135}
136
137static void midi_ctl_capture_trigger(struct snd_rawmidi_substream *substream,
138 int up)
139{
140 struct snd_dg00x *dg00x = substream->rmidi->private_data;
141 unsigned long flags;
142
143 spin_lock_irqsave(&dg00x->lock, flags);
144
145 if (up)
146 dg00x->in_control = substream;
147 else
148 dg00x->in_control = NULL;
149
150 spin_unlock_irqrestore(&dg00x->lock, flags);
151}
152
153static void midi_ctl_playback_trigger(struct snd_rawmidi_substream *substream,
154 int up)
155{
156 struct snd_dg00x *dg00x = substream->rmidi->private_data;
157 unsigned long flags;
158
159 spin_lock_irqsave(&dg00x->lock, flags);
160
161 if (up)
162 snd_fw_async_midi_port_run(&dg00x->out_control, substream);
163
164 spin_unlock_irqrestore(&dg00x->lock, flags);
165}
166
167static struct snd_rawmidi_ops midi_ctl_capture_ops = {
168 .open = midi_ctl_open,
169 .close = midi_ctl_capture_close,
170 .trigger = midi_ctl_capture_trigger,
171};
172
173static struct snd_rawmidi_ops midi_ctl_playback_ops = {
174 .open = midi_ctl_open,
175 .close = midi_ctl_playback_close,
176 .trigger = midi_ctl_playback_trigger,
177};
178
116static void set_midi_substream_names(struct snd_dg00x *dg00x, 179static void set_midi_substream_names(struct snd_dg00x *dg00x,
117 struct snd_rawmidi_str *str) 180 struct snd_rawmidi_str *str)
118{ 181{