]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ALSA: firewire-lib: add data block processing layer for AM824 format
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 19 Sep 2015 02:21:55 +0000 (11:21 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 29 Sep 2015 10:47:45 +0000 (12:47 +0200)
This commit adds data block processing layer for AM824 format. The new
layer initializes streaming layer with its value for fmt field.

Currently, most implementation of data block processing still remains
streaming layer. In later commits, these codes will be moved to the layer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
13 files changed:
sound/firewire/Makefile
sound/firewire/amdtp-am824.c [new file with mode: 0644]
sound/firewire/amdtp-am824.h [new file with mode: 0644]
sound/firewire/amdtp-stream.c
sound/firewire/amdtp-stream.h
sound/firewire/bebob/bebob.h
sound/firewire/bebob/bebob_stream.c
sound/firewire/dice/dice-stream.c
sound/firewire/dice/dice.h
sound/firewire/fireworks/fireworks.h
sound/firewire/fireworks/fireworks_stream.c
sound/firewire/oxfw/oxfw-stream.c
sound/firewire/oxfw/oxfw.h

index 102e342ddc38e82149482c253adc6dc829618e19..6a8a71371efd5f4e34eae5965a93f182cee71277 100644 (file)
@@ -1,5 +1,5 @@
 snd-firewire-lib-objs := lib.o iso-resources.o packets-buffer.o \
-                        fcp.o cmp.o amdtp-stream.o
+                        fcp.o cmp.o amdtp-stream.o amdtp-am824.o
 snd-oxfw-objs := oxfw.o
 snd-isight-objs := isight.o
 snd-scs1x-objs := scs1x.o
diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c
new file mode 100644 (file)
index 0000000..da4b643
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * AM824 format in Audio and Music Data Transmission Protocol (IEC 61883-6)
+ *
+ * Copyright (c) 2015 Takashi Sakamoto <o-takashi@sakamocchi.jp>
+ *
+ * Licensed under the terms of the GNU General Public License, version 2.
+ */
+
+#include "amdtp-am824.h"
+
+#define CIP_FMT_AM             0x10
+
+/**
+ * amdtp_am824_init - initialize an AMDTP stream structure to handle AM824
+ *                   data block
+ * @s: the AMDTP stream to initialize
+ * @unit: the target of the stream
+ * @dir: the direction of stream
+ * @flags: the packet transmission method to use
+ */
+int amdtp_am824_init(struct amdtp_stream *s, struct fw_unit *unit,
+                    enum amdtp_stream_direction dir, enum cip_flags flags)
+{
+       return amdtp_stream_init(s, unit, dir, flags, CIP_FMT_AM);
+}
+EXPORT_SYMBOL_GPL(amdtp_am824_init);
diff --git a/sound/firewire/amdtp-am824.h b/sound/firewire/amdtp-am824.h
new file mode 100644 (file)
index 0000000..ed96ac5
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef SOUND_FIREWIRE_AMDTP_AM824_H_INCLUDED
+#define SOUND_FIREWIRE_AMDTP_AM824_H_INCLUDED
+
+#include "amdtp-stream.h"
+
+int amdtp_am824_init(struct amdtp_stream *s, struct fw_unit *unit,
+                    enum amdtp_stream_direction dir, enum cip_flags flags);
+#endif
index ec65ebf8f04a3ab6fce76ff0e208c0e5142f9131..2254eec4521b998716249dae6c22d65a58cbde5e 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/firewire.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/sched.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/rawmidi.h>
@@ -78,9 +77,11 @@ static void pcm_period_tasklet(unsigned long data);
  * @unit: the target of the stream
  * @dir: the direction of stream
  * @flags: the packet transmission method to use
+ * @fmt: the value of fmt field in CIP header
  */
 int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
-                     enum amdtp_stream_direction dir, enum cip_flags flags)
+                     enum amdtp_stream_direction dir, enum cip_flags flags,
+                     unsigned int fmt)
 {
        s->unit = unit;
        s->direction = dir;
@@ -94,7 +95,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
        s->callbacked = false;
        s->sync_slave = NULL;
 
-       s->fmt = CIP_FMT_AM;
+       s->fmt = fmt;
 
        return 0;
 }
index 883bb1a7e25fa56d509dc183a7d02ea2d91f6d58..5f96affe37b754d597a35d5d51e83632e55ce2d9 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/mutex.h>
+#include <linux/sched.h>
 #include <sound/asound.h>
 #include "packets-buffer.h"
 
@@ -174,7 +175,7 @@ struct amdtp_stream {
 
 int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
                      enum amdtp_stream_direction dir,
-                     enum cip_flags flags);
+                     enum cip_flags flags, unsigned int fmt);
 void amdtp_stream_destroy(struct amdtp_stream *s);
 
 int amdtp_stream_set_parameters(struct amdtp_stream *s,
index 72a1c5e404fd821d34245e13dae41436c96744d8..d3c9d8de289b16a6fd0e52e48b73aae0cb77cf85 100644 (file)
@@ -31,7 +31,7 @@
 #include "../fcp.h"
 #include "../packets-buffer.h"
 #include "../iso-resources.h"
-#include "../amdtp-stream.h"
+#include "../amdtp-am824.h"
 #include "../cmp.h"
 
 /* basic register addresses on DM1000/DM1100/DM1500 */
index 920a3b8844eef02678edf54451a3d4e7ea24c91f..34bc3a419993491dde0dd1c9b08c094d5bbfe23b 100644 (file)
@@ -537,8 +537,8 @@ int snd_bebob_stream_init_duplex(struct snd_bebob *bebob)
        if (err < 0)
                goto end;
 
-       err = amdtp_stream_init(&bebob->tx_stream, bebob->unit,
-                               AMDTP_IN_STREAM, CIP_BLOCKING);
+       err = amdtp_am824_init(&bebob->tx_stream, bebob->unit,
+                              AMDTP_IN_STREAM, CIP_BLOCKING);
        if (err < 0) {
                amdtp_stream_destroy(&bebob->tx_stream);
                destroy_both_connections(bebob);
@@ -566,8 +566,8 @@ int snd_bebob_stream_init_duplex(struct snd_bebob *bebob)
        if (bebob->maudio_special_quirk)
                bebob->tx_stream.flags |= CIP_EMPTY_HAS_WRONG_DBC;
 
-       err = amdtp_stream_init(&bebob->rx_stream, bebob->unit,
-                               AMDTP_OUT_STREAM, CIP_BLOCKING);
+       err = amdtp_am824_init(&bebob->rx_stream, bebob->unit,
+                              AMDTP_OUT_STREAM, CIP_BLOCKING);
        if (err < 0) {
                amdtp_stream_destroy(&bebob->tx_stream);
                amdtp_stream_destroy(&bebob->rx_stream);
index e4c6c20d70a092d91fbe2fc185982a9e94165782..917860e88b66367be3ac73fb1705a239828cd67f 100644 (file)
@@ -305,7 +305,7 @@ static int init_stream(struct snd_dice *dice, struct amdtp_stream *stream)
                goto end;
        resources->channels_mask = 0x00000000ffffffffuLL;
 
-       err = amdtp_stream_init(stream, dice->unit, dir, CIP_BLOCKING);
+       err = amdtp_am824_init(stream, dice->unit, dir, CIP_BLOCKING);
        if (err < 0) {
                amdtp_stream_destroy(stream);
                fw_iso_resources_destroy(resources);
index 29578c19e9778d6dce9f58736086696cf0f7bbf6..101550ac1a242fc35af22f9f291b0fc2771d4532 100644 (file)
@@ -34,7 +34,7 @@
 #include <sound/pcm_params.h>
 #include <sound/rawmidi.h>
 
-#include "../amdtp-stream.h"
+#include "../amdtp-am824.h"
 #include "../iso-resources.h"
 #include "../lib.h"
 #include "dice-interface.h"
index d54f17134495ced5ce41bfa5a858c965c5c98295..c7cb7deafe48487fd802fbf5ce84e34c2f5ab2eb 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "../packets-buffer.h"
 #include "../iso-resources.h"
-#include "../amdtp-stream.h"
+#include "../amdtp-am824.h"
 #include "../cmp.h"
 #include "../lib.h"
 
index 85a72e63913d4c0fcfdbcaf9186aaa8c847eb8a2..8cac5b987cc1cab2a8955df20940d689fdf13c86 100644 (file)
@@ -31,7 +31,7 @@ init_stream(struct snd_efw *efw, struct amdtp_stream *stream)
        if (err < 0)
                goto end;
 
-       err = amdtp_stream_init(stream, efw->unit, s_dir, CIP_BLOCKING);
+       err = amdtp_am824_init(stream, efw->unit, s_dir, CIP_BLOCKING);
        if (err < 0) {
                amdtp_stream_destroy(stream);
                cmp_connection_destroy(conn);
index 318f78e1a313694386a7e5fae20806462f8a3143..83683414793fae4e5f8759cddbf1d824dfdf196b 100644 (file)
@@ -228,7 +228,7 @@ int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw,
        if (err < 0)
                goto end;
 
-       err = amdtp_stream_init(stream, oxfw->unit, s_dir, CIP_NONBLOCKING);
+       err = amdtp_am824_init(stream, oxfw->unit, s_dir, CIP_NONBLOCKING);
        if (err < 0) {
                amdtp_stream_destroy(stream);
                cmp_connection_destroy(conn);
index 2c3d20b61cbe00748bf780b1bf7dc714719eb656..2441459d2e5844d246589a47b40ba474bdaeddd7 100644 (file)
@@ -28,7 +28,7 @@
 #include "../fcp.h"
 #include "../packets-buffer.h"
 #include "../iso-resources.h"
-#include "../amdtp-stream.h"
+#include "../amdtp-am824.h"
 #include "../cmp.h"
 
 struct device_info {