Skip to content

Commit

Permalink
ALSA: firewire-digi00x: rename identifiers of MIDI operation for phys…
Browse files Browse the repository at this point in the history
…ical 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 <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
takaswie authored and tiwai committed Oct 30, 2015
1 parent b43ddca commit 5918f96
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions sound/firewire/digi00x/digi00x-midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#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;
int err;
Expand All @@ -31,7 +31,7 @@ static int midi_open(struct snd_rawmidi_substream *substream)
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;

Expand All @@ -48,65 +48,69 @@ static int midi_close(struct snd_rawmidi_substream *substream)
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;

spin_lock_irqsave(&dg00x->lock, flags);

/* This port is for asynchronous transaction. */
if (substrm->number == 0) {
if (substream->number == 0) {
if (up)
dg00x->in_control = substrm;
dg00x->in_control = substream;
else
dg00x->in_control = NULL;
} else {
if (up)
amdtp_dot_midi_trigger(&dg00x->tx_stream,
substrm->number - 1, substrm);
substream->number - 1,
substream);
else
amdtp_dot_midi_trigger(&dg00x->tx_stream,
substrm->number - 1, NULL);
substream->number - 1, NULL);
}

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;

spin_lock_irqsave(&dg00x->lock, flags);

/* This port is for asynchronous transaction. */
if (substrm->number == 0) {
if (substream->number == 0) {
if (up)
snd_fw_async_midi_port_run(&dg00x->out_control,
substrm);
substream);
} else {
if (up)
amdtp_dot_midi_trigger(&dg00x->rx_stream,
substrm->number - 1, substrm);
substream->number - 1,
substream);
else
amdtp_dot_midi_trigger(&dg00x->rx_stream,
substrm->number - 1, NULL);
substream->number - 1, NULL);
}

spin_unlock_irqrestore(&dg00x->lock, flags);
}

static struct snd_rawmidi_ops midi_capture_ops = {
.open = midi_open,
.close = midi_close,
.trigger = midi_capture_trigger,
static struct snd_rawmidi_ops midi_phys_capture_ops = {
.open = midi_phys_open,
.close = midi_phys_close,
.trigger = midi_phys_capture_trigger,
};

static struct snd_rawmidi_ops midi_playback_ops = {
.open = midi_open,
.close = midi_close,
.trigger = midi_playback_trigger,
static struct snd_rawmidi_ops midi_phys_playback_ops = {
.open = midi_phys_open,
.close = midi_phys_close,
.trigger = midi_phys_playback_trigger,
};

static void set_midi_substream_names(struct snd_dg00x *dg00x,
Expand Down Expand Up @@ -144,13 +148,13 @@ int snd_dg00x_create_midi_devices(struct snd_dg00x *dg00x)

rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT;
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
&midi_capture_ops);
&midi_phys_capture_ops);
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT];
set_midi_substream_names(dg00x, str);

rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT;
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
&midi_playback_ops);
&midi_phys_playback_ops);
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT];
set_midi_substream_names(dg00x, str);

Expand Down

0 comments on commit 5918f96

Please sign in to comment.