aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-09-18 22:21:59 -0400
committerTakashi Iwai <tiwai@suse.de>2015-09-29 06:48:49 -0400
commit03e2a67eed7bf2e4c701587080bc8d60dd45209c (patch)
treefc564a3251471f2b26db4b0b7b740fa5ae9f7041
parentf65be911c0e13fab28919e17c9fa00c38dc4ff2f (diff)
ALSA: firewire-lib: move MIDI trigger helper function to AM824 layer
In IEC 61883-6, MIDI messages are transferred in MIDI conformant data channel. Essentially, packet streaming layer is not responsible for MIDI functionality. This commit moves MIDI trigger helper function from the layer to AM824 layer. The rest of codes related to MIDI functionality will be moved in later commits. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/firewire/amdtp-am824.c18
-rw-r--r--sound/firewire/amdtp-am824.h4
-rw-r--r--sound/firewire/amdtp-stream.h18
-rw-r--r--sound/firewire/bebob/bebob_midi.c16
-rw-r--r--sound/firewire/dice/dice-midi.c12
-rw-r--r--sound/firewire/fireworks/fireworks_midi.c12
-rw-r--r--sound/firewire/oxfw/oxfw-midi.c16
7 files changed, 50 insertions, 46 deletions
diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c
index 5d99a9921d50..540a101661e2 100644
--- a/sound/firewire/amdtp-am824.c
+++ b/sound/firewire/amdtp-am824.c
@@ -101,6 +101,24 @@ int amdtp_am824_add_pcm_hw_constraints(struct amdtp_stream *s,
101EXPORT_SYMBOL_GPL(amdtp_am824_add_pcm_hw_constraints); 101EXPORT_SYMBOL_GPL(amdtp_am824_add_pcm_hw_constraints);
102 102
103/** 103/**
104 * amdtp_am824_midi_trigger - start/stop playback/capture with a MIDI device
105 * @s: the AMDTP stream
106 * @port: index of MIDI port
107 * @midi: the MIDI device to be started, or %NULL to stop the current device
108 *
109 * Call this function on a running isochronous stream to enable the actual
110 * transmission of MIDI data. This function should be called from the MIDI
111 * device's .trigger callback.
112 */
113void amdtp_am824_midi_trigger(struct amdtp_stream *s, unsigned int port,
114 struct snd_rawmidi_substream *midi)
115{
116 if (port < s->midi_ports)
117 ACCESS_ONCE(s->midi[port]) = midi;
118}
119EXPORT_SYMBOL_GPL(amdtp_am824_midi_trigger);
120
121/**
104 * amdtp_am824_init - initialize an AMDTP stream structure to handle AM824 122 * amdtp_am824_init - initialize an AMDTP stream structure to handle AM824
105 * data block 123 * data block
106 * @s: the AMDTP stream to initialize 124 * @s: the AMDTP stream to initialize
diff --git a/sound/firewire/amdtp-am824.h b/sound/firewire/amdtp-am824.h
index 7c21e9972fad..65e6093a4460 100644
--- a/sound/firewire/amdtp-am824.h
+++ b/sound/firewire/amdtp-am824.h
@@ -2,6 +2,7 @@
2#define SOUND_FIREWIRE_AMDTP_AM824_H_INCLUDED 2#define SOUND_FIREWIRE_AMDTP_AM824_H_INCLUDED
3 3
4#include <sound/pcm.h> 4#include <sound/pcm.h>
5#include <sound/rawmidi.h>
5 6
6#include "amdtp-stream.h" 7#include "amdtp-stream.h"
7 8
@@ -19,6 +20,9 @@ void amdtp_am824_set_midi_position(struct amdtp_stream *s,
19int amdtp_am824_add_pcm_hw_constraints(struct amdtp_stream *s, 20int amdtp_am824_add_pcm_hw_constraints(struct amdtp_stream *s,
20 struct snd_pcm_runtime *runtime); 21 struct snd_pcm_runtime *runtime);
21 22
23void amdtp_am824_midi_trigger(struct amdtp_stream *s, unsigned int port,
24 struct snd_rawmidi_substream *midi);
25
22int amdtp_am824_init(struct amdtp_stream *s, struct fw_unit *unit, 26int amdtp_am824_init(struct amdtp_stream *s, struct fw_unit *unit,
23 enum amdtp_stream_direction dir, enum cip_flags flags); 27 enum amdtp_stream_direction dir, enum cip_flags flags);
24#endif 28#endif
diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h
index d915940a14c9..984f02ac2aed 100644
--- a/sound/firewire/amdtp-stream.h
+++ b/sound/firewire/amdtp-stream.h
@@ -248,24 +248,6 @@ static inline void amdtp_stream_pcm_trigger(struct amdtp_stream *s,
248 ACCESS_ONCE(s->pcm) = pcm; 248 ACCESS_ONCE(s->pcm) = pcm;
249} 249}
250 250
251/**
252 * amdtp_stream_midi_trigger - start/stop playback/capture with a MIDI device
253 * @s: the AMDTP stream
254 * @port: index of MIDI port
255 * @midi: the MIDI device to be started, or %NULL to stop the current device
256 *
257 * Call this function on a running isochronous stream to enable the actual
258 * transmission of MIDI data. This function should be called from the MIDI
259 * device's .trigger callback.
260 */
261static inline void amdtp_stream_midi_trigger(struct amdtp_stream *s,
262 unsigned int port,
263 struct snd_rawmidi_substream *midi)
264{
265 if (port < s->midi_ports)
266 ACCESS_ONCE(s->midi[port]) = midi;
267}
268
269static inline bool cip_sfc_is_base_44100(enum cip_sfc sfc) 251static inline bool cip_sfc_is_base_44100(enum cip_sfc sfc)
270{ 252{
271 return sfc & 1; 253 return sfc & 1;
diff --git a/sound/firewire/bebob/bebob_midi.c b/sound/firewire/bebob/bebob_midi.c
index 5681143925cd..90d95be499b0 100644
--- a/sound/firewire/bebob/bebob_midi.c
+++ b/sound/firewire/bebob/bebob_midi.c
@@ -72,11 +72,11 @@ static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up)
72 spin_lock_irqsave(&bebob->lock, flags); 72 spin_lock_irqsave(&bebob->lock, flags);
73 73
74 if (up) 74 if (up)
75 amdtp_stream_midi_trigger(&bebob->tx_stream, 75 amdtp_am824_midi_trigger(&bebob->tx_stream,
76 substrm->number, substrm); 76 substrm->number, substrm);
77 else 77 else
78 amdtp_stream_midi_trigger(&bebob->tx_stream, 78 amdtp_am824_midi_trigger(&bebob->tx_stream,
79 substrm->number, NULL); 79 substrm->number, NULL);
80 80
81 spin_unlock_irqrestore(&bebob->lock, flags); 81 spin_unlock_irqrestore(&bebob->lock, flags);
82} 82}
@@ -89,11 +89,11 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
89 spin_lock_irqsave(&bebob->lock, flags); 89 spin_lock_irqsave(&bebob->lock, flags);
90 90
91 if (up) 91 if (up)
92 amdtp_stream_midi_trigger(&bebob->rx_stream, 92 amdtp_am824_midi_trigger(&bebob->rx_stream,
93 substrm->number, substrm); 93 substrm->number, substrm);
94 else 94 else
95 amdtp_stream_midi_trigger(&bebob->rx_stream, 95 amdtp_am824_midi_trigger(&bebob->rx_stream,
96 substrm->number, NULL); 96 substrm->number, NULL);
97 97
98 spin_unlock_irqrestore(&bebob->lock, flags); 98 spin_unlock_irqrestore(&bebob->lock, flags);
99} 99}
diff --git a/sound/firewire/dice/dice-midi.c b/sound/firewire/dice/dice-midi.c
index fe43ce791f84..151b09f240f2 100644
--- a/sound/firewire/dice/dice-midi.c
+++ b/sound/firewire/dice/dice-midi.c
@@ -52,10 +52,10 @@ static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up)
52 spin_lock_irqsave(&dice->lock, flags); 52 spin_lock_irqsave(&dice->lock, flags);
53 53
54 if (up) 54 if (up)
55 amdtp_stream_midi_trigger(&dice->tx_stream, 55 amdtp_am824_midi_trigger(&dice->tx_stream,
56 substrm->number, substrm); 56 substrm->number, substrm);
57 else 57 else
58 amdtp_stream_midi_trigger(&dice->tx_stream, 58 amdtp_am824_midi_trigger(&dice->tx_stream,
59 substrm->number, NULL); 59 substrm->number, NULL);
60 60
61 spin_unlock_irqrestore(&dice->lock, flags); 61 spin_unlock_irqrestore(&dice->lock, flags);
@@ -69,11 +69,11 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
69 spin_lock_irqsave(&dice->lock, flags); 69 spin_lock_irqsave(&dice->lock, flags);
70 70
71 if (up) 71 if (up)
72 amdtp_stream_midi_trigger(&dice->rx_stream, 72 amdtp_am824_midi_trigger(&dice->rx_stream,
73 substrm->number, substrm); 73 substrm->number, substrm);
74 else 74 else
75 amdtp_stream_midi_trigger(&dice->rx_stream, 75 amdtp_am824_midi_trigger(&dice->rx_stream,
76 substrm->number, NULL); 76 substrm->number, NULL);
77 77
78 spin_unlock_irqrestore(&dice->lock, flags); 78 spin_unlock_irqrestore(&dice->lock, flags);
79} 79}
diff --git a/sound/firewire/fireworks/fireworks_midi.c b/sound/firewire/fireworks/fireworks_midi.c
index cf9c65260439..fba01bbba456 100644
--- a/sound/firewire/fireworks/fireworks_midi.c
+++ b/sound/firewire/fireworks/fireworks_midi.c
@@ -73,10 +73,10 @@ static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up)
73 spin_lock_irqsave(&efw->lock, flags); 73 spin_lock_irqsave(&efw->lock, flags);
74 74
75 if (up) 75 if (up)
76 amdtp_stream_midi_trigger(&efw->tx_stream, 76 amdtp_am824_midi_trigger(&efw->tx_stream,
77 substrm->number, substrm); 77 substrm->number, substrm);
78 else 78 else
79 amdtp_stream_midi_trigger(&efw->tx_stream, 79 amdtp_am824_midi_trigger(&efw->tx_stream,
80 substrm->number, NULL); 80 substrm->number, NULL);
81 81
82 spin_unlock_irqrestore(&efw->lock, flags); 82 spin_unlock_irqrestore(&efw->lock, flags);
@@ -90,11 +90,11 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
90 spin_lock_irqsave(&efw->lock, flags); 90 spin_lock_irqsave(&efw->lock, flags);
91 91
92 if (up) 92 if (up)
93 amdtp_stream_midi_trigger(&efw->rx_stream, 93 amdtp_am824_midi_trigger(&efw->rx_stream,
94 substrm->number, substrm); 94 substrm->number, substrm);
95 else 95 else
96 amdtp_stream_midi_trigger(&efw->rx_stream, 96 amdtp_am824_midi_trigger(&efw->rx_stream,
97 substrm->number, NULL); 97 substrm->number, NULL);
98 98
99 spin_unlock_irqrestore(&efw->lock, flags); 99 spin_unlock_irqrestore(&efw->lock, flags);
100} 100}
diff --git a/sound/firewire/oxfw/oxfw-midi.c b/sound/firewire/oxfw/oxfw-midi.c
index 540a30338516..37a86cf69cbf 100644
--- a/sound/firewire/oxfw/oxfw-midi.c
+++ b/sound/firewire/oxfw/oxfw-midi.c
@@ -90,11 +90,11 @@ static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up)
90 spin_lock_irqsave(&oxfw->lock, flags); 90 spin_lock_irqsave(&oxfw->lock, flags);
91 91
92 if (up) 92 if (up)
93 amdtp_stream_midi_trigger(&oxfw->tx_stream, 93 amdtp_am824_midi_trigger(&oxfw->tx_stream,
94 substrm->number, substrm); 94 substrm->number, substrm);
95 else 95 else
96 amdtp_stream_midi_trigger(&oxfw->tx_stream, 96 amdtp_am824_midi_trigger(&oxfw->tx_stream,
97 substrm->number, NULL); 97 substrm->number, NULL);
98 98
99 spin_unlock_irqrestore(&oxfw->lock, flags); 99 spin_unlock_irqrestore(&oxfw->lock, flags);
100} 100}
@@ -107,11 +107,11 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
107 spin_lock_irqsave(&oxfw->lock, flags); 107 spin_lock_irqsave(&oxfw->lock, flags);
108 108
109 if (up) 109 if (up)
110 amdtp_stream_midi_trigger(&oxfw->rx_stream, 110 amdtp_am824_midi_trigger(&oxfw->rx_stream,
111 substrm->number, substrm); 111 substrm->number, substrm);
112 else 112 else
113 amdtp_stream_midi_trigger(&oxfw->rx_stream, 113 amdtp_am824_midi_trigger(&oxfw->rx_stream,
114 substrm->number, NULL); 114 substrm->number, NULL);
115 115
116 spin_unlock_irqrestore(&oxfw->lock, flags); 116 spin_unlock_irqrestore(&oxfw->lock, flags);
117} 117}