aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-10-10 23:30:18 -0400
committerTakashi Iwai <tiwai@suse.de>2015-10-11 12:26:14 -0400
commitb47f525f760f29c4689a7d9bf768c28fcaac2281 (patch)
tree2735782f109b3ab07398694df8c946b95077086c
parent3646a54acda65afdd76737d40c0994b991742e01 (diff)
ALSA: firewire-digi00x: add support of asynchronous transaction for outgoing MIDI messages to physical controls
In previous commit, asynchronous transaction for incoming MIDI messages from physical controls is supported. The physical controls may be controlled by receiving MIDI messages at a certain address. This commit supports asynchronous transaction for this purpose. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/firewire/digi00x/digi00x-transaction.c29
-rw-r--r--sound/firewire/digi00x/digi00x.h1
2 files changed, 26 insertions, 4 deletions
diff --git a/sound/firewire/digi00x/digi00x-transaction.c b/sound/firewire/digi00x/digi00x-transaction.c
index 8bf5ed5e5f3e..554324d8c602 100644
--- a/sound/firewire/digi00x/digi00x-transaction.c
+++ b/sound/firewire/digi00x/digi00x-transaction.c
@@ -9,6 +9,18 @@
9#include <sound/asound.h> 9#include <sound/asound.h>
10#include "digi00x.h" 10#include "digi00x.h"
11 11
12static int fill_midi_message(struct snd_rawmidi_substream *substream, u8 *buf)
13{
14 int bytes;
15
16 buf[0] = 0x80;
17 bytes = snd_rawmidi_transmit_peek(substream, buf + 1, 2);
18 if (bytes >= 0)
19 buf[3] = 0xc0 | bytes;
20
21 return bytes;
22}
23
12static void handle_midi_control(struct snd_dg00x *dg00x, __be32 *buf, 24static void handle_midi_control(struct snd_dg00x *dg00x, __be32 *buf,
13 unsigned int length) 25 unsigned int length)
14{ 26{
@@ -102,15 +114,24 @@ int snd_dg00x_transaction_register(struct snd_dg00x *dg00x)
102 return err; 114 return err;
103 115
104 err = snd_dg00x_transaction_reregister(dg00x); 116 err = snd_dg00x_transaction_reregister(dg00x);
105 if (err < 0) { 117 if (err < 0)
106 fw_core_remove_address_handler(&dg00x->async_handler); 118 goto error;
107 dg00x->async_handler.address_callback = NULL; 119
108 } 120 err = snd_fw_async_midi_port_init(&dg00x->out_control, dg00x->unit,
121 DG00X_ADDR_BASE + DG00X_OFFSET_MMC,
122 4, fill_midi_message);
123 if (err < 0)
124 goto error;
109 125
110 return err; 126 return err;
127error:
128 fw_core_remove_address_handler(&dg00x->async_handler);
129 dg00x->async_handler.address_callback = NULL;
130 return err;
111} 131}
112 132
113void snd_dg00x_transaction_unregister(struct snd_dg00x *dg00x) 133void snd_dg00x_transaction_unregister(struct snd_dg00x *dg00x)
114{ 134{
135 snd_fw_async_midi_port_destroy(&dg00x->out_control);
115 fw_core_remove_address_handler(&dg00x->async_handler); 136 fw_core_remove_address_handler(&dg00x->async_handler);
116} 137}
diff --git a/sound/firewire/digi00x/digi00x.h b/sound/firewire/digi00x/digi00x.h
index 630f6aabb909..907e73993677 100644
--- a/sound/firewire/digi00x/digi00x.h
+++ b/sound/firewire/digi00x/digi00x.h
@@ -56,6 +56,7 @@ struct snd_dg00x {
56 56
57 /* For asynchronous MIDI controls. */ 57 /* For asynchronous MIDI controls. */
58 struct snd_rawmidi_substream *in_control; 58 struct snd_rawmidi_substream *in_control;
59 struct snd_fw_async_midi_port out_control;
59}; 60};
60 61
61#define DG00X_ADDR_BASE 0xffffe0000000ull 62#define DG00X_ADDR_BASE 0xffffe0000000ull