aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-10-30 13:43:14 -0400
committerTakashi Iwai <tiwai@suse.de>2015-10-30 14:34:13 -0400
commit5918f962207329089371d87adbd033830d3f5cf5 (patch)
treef8836db3ec7dc265795693ffb74d41d9c0c98c5a
parentb43ddca4a8d8c9b5439898bd3077736091696ceb (diff)
ALSA: firewire-digi00x: rename identifiers of MIDI operation for physical ports
In following commit, new functions and variables are added for operations of MIDI control port. This commit is a preparation. Current identifiers are renamed so that they mean physical MIDI ports. 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.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/sound/firewire/digi00x/digi00x-midi.c b/sound/firewire/digi00x/digi00x-midi.c
index 9aa8b4623108..1d649e3975a0 100644
--- a/sound/firewire/digi00x/digi00x-midi.c
+++ b/sound/firewire/digi00x/digi00x-midi.c
@@ -8,7 +8,7 @@
8 8
9#include "digi00x.h" 9#include "digi00x.h"
10 10
11static int midi_open(struct snd_rawmidi_substream *substream) 11static int midi_phys_open(struct snd_rawmidi_substream *substream)
12{ 12{
13 struct snd_dg00x *dg00x = substream->rmidi->private_data; 13 struct snd_dg00x *dg00x = substream->rmidi->private_data;
14 int err; 14 int err;
@@ -31,7 +31,7 @@ static int midi_open(struct snd_rawmidi_substream *substream)
31 return err; 31 return err;
32} 32}
33 33
34static int midi_close(struct snd_rawmidi_substream *substream) 34static int midi_phys_close(struct snd_rawmidi_substream *substream)
35{ 35{
36 struct snd_dg00x *dg00x = substream->rmidi->private_data; 36 struct snd_dg00x *dg00x = substream->rmidi->private_data;
37 37
@@ -48,65 +48,69 @@ static int midi_close(struct snd_rawmidi_substream *substream)
48 return 0; 48 return 0;
49} 49}
50 50
51static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up) 51static void midi_phys_capture_trigger(struct snd_rawmidi_substream *substream,
52 int up)
52{ 53{
53 struct snd_dg00x *dg00x = substrm->rmidi->private_data; 54 struct snd_dg00x *dg00x = substream->rmidi->private_data;
54 unsigned long flags; 55 unsigned long flags;
55 56
56 spin_lock_irqsave(&dg00x->lock, flags); 57 spin_lock_irqsave(&dg00x->lock, flags);
57 58
58 /* This port is for asynchronous transaction. */ 59 /* This port is for asynchronous transaction. */
59 if (substrm->number == 0) { 60 if (substream->number == 0) {
60 if (up) 61 if (up)
61 dg00x->in_control = substrm; 62 dg00x->in_control = substream;
62 else 63 else
63 dg00x->in_control = NULL; 64 dg00x->in_control = NULL;
64 } else { 65 } else {
65 if (up) 66 if (up)
66 amdtp_dot_midi_trigger(&dg00x->tx_stream, 67 amdtp_dot_midi_trigger(&dg00x->tx_stream,
67 substrm->number - 1, substrm); 68 substream->number - 1,
69 substream);
68 else 70 else
69 amdtp_dot_midi_trigger(&dg00x->tx_stream, 71 amdtp_dot_midi_trigger(&dg00x->tx_stream,
70 substrm->number - 1, NULL); 72 substream->number - 1, NULL);
71 } 73 }
72 74
73 spin_unlock_irqrestore(&dg00x->lock, flags); 75 spin_unlock_irqrestore(&dg00x->lock, flags);
74} 76}
75 77
76static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up) 78static void midi_phys_playback_trigger(struct snd_rawmidi_substream *substream,
79 int up)
77{ 80{
78 struct snd_dg00x *dg00x = substrm->rmidi->private_data; 81 struct snd_dg00x *dg00x = substream->rmidi->private_data;
79 unsigned long flags; 82 unsigned long flags;
80 83
81 spin_lock_irqsave(&dg00x->lock, flags); 84 spin_lock_irqsave(&dg00x->lock, flags);
82 85
83 /* This port is for asynchronous transaction. */ 86 /* This port is for asynchronous transaction. */
84 if (substrm->number == 0) { 87 if (substream->number == 0) {
85 if (up) 88 if (up)
86 snd_fw_async_midi_port_run(&dg00x->out_control, 89 snd_fw_async_midi_port_run(&dg00x->out_control,
87 substrm); 90 substream);
88 } else { 91 } else {
89 if (up) 92 if (up)
90 amdtp_dot_midi_trigger(&dg00x->rx_stream, 93 amdtp_dot_midi_trigger(&dg00x->rx_stream,
91 substrm->number - 1, substrm); 94 substream->number - 1,
95 substream);
92 else 96 else
93 amdtp_dot_midi_trigger(&dg00x->rx_stream, 97 amdtp_dot_midi_trigger(&dg00x->rx_stream,
94 substrm->number - 1, NULL); 98 substream->number - 1, NULL);
95 } 99 }
96 100
97 spin_unlock_irqrestore(&dg00x->lock, flags); 101 spin_unlock_irqrestore(&dg00x->lock, flags);
98} 102}
99 103
100static struct snd_rawmidi_ops midi_capture_ops = { 104static struct snd_rawmidi_ops midi_phys_capture_ops = {
101 .open = midi_open, 105 .open = midi_phys_open,
102 .close = midi_close, 106 .close = midi_phys_close,
103 .trigger = midi_capture_trigger, 107 .trigger = midi_phys_capture_trigger,
104}; 108};
105 109
106static struct snd_rawmidi_ops midi_playback_ops = { 110static struct snd_rawmidi_ops midi_phys_playback_ops = {
107 .open = midi_open, 111 .open = midi_phys_open,
108 .close = midi_close, 112 .close = midi_phys_close,
109 .trigger = midi_playback_trigger, 113 .trigger = midi_phys_playback_trigger,
110}; 114};
111 115
112static void set_midi_substream_names(struct snd_dg00x *dg00x, 116static void set_midi_substream_names(struct snd_dg00x *dg00x,
@@ -144,13 +148,13 @@ int snd_dg00x_create_midi_devices(struct snd_dg00x *dg00x)
144 148
145 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT; 149 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT;
146 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, 150 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
147 &midi_capture_ops); 151 &midi_phys_capture_ops);
148 str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]; 152 str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT];
149 set_midi_substream_names(dg00x, str); 153 set_midi_substream_names(dg00x, str);
150 154
151 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT; 155 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT;
152 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, 156 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
153 &midi_playback_ops); 157 &midi_phys_playback_ops);
154 str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]; 158 str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT];
155 set_midi_substream_names(dg00x, str); 159 set_midi_substream_names(dg00x, str);
156 160