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>
This commit is contained in:
parent
b43ddca4a8
commit
5918f96220
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "digi00x.h"
|
#include "digi00x.h"
|
||||||
|
|
||||||
static int midi_open(struct snd_rawmidi_substream *substream)
|
static int midi_phys_open(struct snd_rawmidi_substream *substream)
|
||||||
{
|
{
|
||||||
struct snd_dg00x *dg00x = substream->rmidi->private_data;
|
struct snd_dg00x *dg00x = substream->rmidi->private_data;
|
||||||
int err;
|
int err;
|
||||||
|
@ -31,7 +31,7 @@ static int midi_open(struct snd_rawmidi_substream *substream)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int midi_close(struct snd_rawmidi_substream *substream)
|
static int midi_phys_close(struct snd_rawmidi_substream *substream)
|
||||||
{
|
{
|
||||||
struct snd_dg00x *dg00x = substream->rmidi->private_data;
|
struct snd_dg00x *dg00x = substream->rmidi->private_data;
|
||||||
|
|
||||||
|
@ -48,65 +48,69 @@ static int midi_close(struct snd_rawmidi_substream *substream)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up)
|
static void midi_phys_capture_trigger(struct snd_rawmidi_substream *substream,
|
||||||
|
int up)
|
||||||
{
|
{
|
||||||
struct snd_dg00x *dg00x = substrm->rmidi->private_data;
|
struct snd_dg00x *dg00x = substream->rmidi->private_data;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&dg00x->lock, flags);
|
spin_lock_irqsave(&dg00x->lock, flags);
|
||||||
|
|
||||||
/* This port is for asynchronous transaction. */
|
/* This port is for asynchronous transaction. */
|
||||||
if (substrm->number == 0) {
|
if (substream->number == 0) {
|
||||||
if (up)
|
if (up)
|
||||||
dg00x->in_control = substrm;
|
dg00x->in_control = substream;
|
||||||
else
|
else
|
||||||
dg00x->in_control = NULL;
|
dg00x->in_control = NULL;
|
||||||
} else {
|
} else {
|
||||||
if (up)
|
if (up)
|
||||||
amdtp_dot_midi_trigger(&dg00x->tx_stream,
|
amdtp_dot_midi_trigger(&dg00x->tx_stream,
|
||||||
substrm->number - 1, substrm);
|
substream->number - 1,
|
||||||
|
substream);
|
||||||
else
|
else
|
||||||
amdtp_dot_midi_trigger(&dg00x->tx_stream,
|
amdtp_dot_midi_trigger(&dg00x->tx_stream,
|
||||||
substrm->number - 1, NULL);
|
substream->number - 1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&dg00x->lock, flags);
|
spin_unlock_irqrestore(&dg00x->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
|
static void midi_phys_playback_trigger(struct snd_rawmidi_substream *substream,
|
||||||
|
int up)
|
||||||
{
|
{
|
||||||
struct snd_dg00x *dg00x = substrm->rmidi->private_data;
|
struct snd_dg00x *dg00x = substream->rmidi->private_data;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&dg00x->lock, flags);
|
spin_lock_irqsave(&dg00x->lock, flags);
|
||||||
|
|
||||||
/* This port is for asynchronous transaction. */
|
/* This port is for asynchronous transaction. */
|
||||||
if (substrm->number == 0) {
|
if (substream->number == 0) {
|
||||||
if (up)
|
if (up)
|
||||||
snd_fw_async_midi_port_run(&dg00x->out_control,
|
snd_fw_async_midi_port_run(&dg00x->out_control,
|
||||||
substrm);
|
substream);
|
||||||
} else {
|
} else {
|
||||||
if (up)
|
if (up)
|
||||||
amdtp_dot_midi_trigger(&dg00x->rx_stream,
|
amdtp_dot_midi_trigger(&dg00x->rx_stream,
|
||||||
substrm->number - 1, substrm);
|
substream->number - 1,
|
||||||
|
substream);
|
||||||
else
|
else
|
||||||
amdtp_dot_midi_trigger(&dg00x->rx_stream,
|
amdtp_dot_midi_trigger(&dg00x->rx_stream,
|
||||||
substrm->number - 1, NULL);
|
substream->number - 1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&dg00x->lock, flags);
|
spin_unlock_irqrestore(&dg00x->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct snd_rawmidi_ops midi_capture_ops = {
|
static struct snd_rawmidi_ops midi_phys_capture_ops = {
|
||||||
.open = midi_open,
|
.open = midi_phys_open,
|
||||||
.close = midi_close,
|
.close = midi_phys_close,
|
||||||
.trigger = midi_capture_trigger,
|
.trigger = midi_phys_capture_trigger,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_rawmidi_ops midi_playback_ops = {
|
static struct snd_rawmidi_ops midi_phys_playback_ops = {
|
||||||
.open = midi_open,
|
.open = midi_phys_open,
|
||||||
.close = midi_close,
|
.close = midi_phys_close,
|
||||||
.trigger = midi_playback_trigger,
|
.trigger = midi_phys_playback_trigger,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void set_midi_substream_names(struct snd_dg00x *dg00x,
|
static void set_midi_substream_names(struct snd_dg00x *dg00x,
|
||||||
|
@ -144,13 +148,13 @@ int snd_dg00x_create_midi_devices(struct snd_dg00x *dg00x)
|
||||||
|
|
||||||
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT;
|
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT;
|
||||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
|
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
|
||||||
&midi_capture_ops);
|
&midi_phys_capture_ops);
|
||||||
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT];
|
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT];
|
||||||
set_midi_substream_names(dg00x, str);
|
set_midi_substream_names(dg00x, str);
|
||||||
|
|
||||||
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT;
|
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT;
|
||||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
|
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
|
||||||
&midi_playback_ops);
|
&midi_phys_playback_ops);
|
||||||
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT];
|
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT];
|
||||||
set_midi_substream_names(dg00x, str);
|
set_midi_substream_names(dg00x, str);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue