Commit 35efa5c4 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: firewire-tascam: add streaming functionality

This commit adds streaming functionality for both direction. To utilize
the sequence of the number of data blocks in packets, full duplex with
synchronization is applied.

Besides, TASCAM FireWire series allows drivers to decide which PCM data
channels are enabled. For convenience, this driver always enable whole the
data channels.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 47faeea2
snd-firewire-tascam-objs := tascam-proc.o amdtp-tascam.o tascam.o
snd-firewire-tascam-objs := tascam-proc.o amdtp-tascam.o tascam-stream.o \
tascam.o
obj-$(CONFIG_SND_FIREWIRE_TASCAM) += snd-firewire-tascam.o
This diff is collapsed.
......@@ -82,6 +82,8 @@ static void tscm_card_free(struct snd_card *card)
{
struct snd_tscm *tscm = card->private_data;
snd_tscm_stream_destroy_duplex(tscm);
fw_unit_put(tscm->unit);
mutex_destroy(&tscm->mutex);
......@@ -115,6 +117,10 @@ static int snd_tscm_probe(struct fw_unit *unit,
snd_tscm_proc_init(tscm);
err = snd_tscm_stream_init_duplex(tscm);
if (err < 0)
goto error;
err = snd_card_register(card);
if (err < 0)
goto error;
......@@ -129,7 +135,11 @@ static int snd_tscm_probe(struct fw_unit *unit,
static void snd_tscm_update(struct fw_unit *unit)
{
return;
struct snd_tscm *tscm = dev_get_drvdata(&unit->device);
mutex_lock(&tscm->mutex);
snd_tscm_stream_update_duplex(tscm);
mutex_unlock(&tscm->mutex);
}
static void snd_tscm_remove(struct fw_unit *unit)
......
......@@ -26,6 +26,7 @@
#include "../lib.h"
#include "../amdtp-stream.h"
#include "../iso-resources.h"
struct snd_tscm_spec {
const char *const name;
......@@ -45,6 +46,12 @@ struct snd_tscm {
struct mutex mutex;
const struct snd_tscm_spec *spec;
struct fw_iso_resources tx_resources;
struct fw_iso_resources rx_resources;
struct amdtp_stream tx_stream;
struct amdtp_stream rx_stream;
unsigned int substreams_counter;
};
#define TSCM_ADDR_BASE 0xffff00000000ull
......@@ -54,6 +61,26 @@ struct snd_tscm {
#define TSCM_OFFSET_FIRMWARE_ARM 0x0008
#define TSCM_OFFSET_FIRMWARE_HW 0x000c
#define TSCM_OFFSET_ISOC_TX_CH 0x0200
#define TSCM_OFFSET_UNKNOWN 0x0204
#define TSCM_OFFSET_START_STREAMING 0x0208
#define TSCM_OFFSET_ISOC_RX_CH 0x020c
#define TSCM_OFFSET_ISOC_RX_ON 0x0210 /* Little conviction. */
#define TSCM_OFFSET_TX_PCM_CHANNELS 0x0214
#define TSCM_OFFSET_RX_PCM_CHANNELS 0x0218
#define TSCM_OFFSET_MULTIPLEX_MODE 0x021c
#define TSCM_OFFSET_ISOC_TX_ON 0x0220
/* Unknown 0x0224 */
#define TSCM_OFFSET_CLOCK_STATUS 0x0228
#define TSCM_OFFSET_SET_OPTION 0x022c
enum snd_tscm_clock {
SND_TSCM_CLOCK_INTERNAL = 0,
SND_TSCM_CLOCK_WORD = 1,
SND_TSCM_CLOCK_SPDIF = 2,
SND_TSCM_CLOCK_ADAT = 3,
};
int amdtp_tscm_init(struct amdtp_stream *s, struct fw_unit *unit,
enum amdtp_stream_direction dir, unsigned int pcm_channels);
int amdtp_tscm_set_parameters(struct amdtp_stream *s, unsigned int rate);
......@@ -61,6 +88,15 @@ int amdtp_tscm_add_pcm_hw_constraints(struct amdtp_stream *s,
struct snd_pcm_runtime *runtime);
void amdtp_tscm_set_pcm_format(struct amdtp_stream *s, snd_pcm_format_t format);
int snd_tscm_stream_get_rate(struct snd_tscm *tscm, unsigned int *rate);
int snd_tscm_stream_get_clock(struct snd_tscm *tscm,
enum snd_tscm_clock *clock);
int snd_tscm_stream_init_duplex(struct snd_tscm *tscm);
void snd_tscm_stream_update_duplex(struct snd_tscm *tscm);
void snd_tscm_stream_destroy_duplex(struct snd_tscm *tscm);
int snd_tscm_stream_start_duplex(struct snd_tscm *tscm, unsigned int rate);
void snd_tscm_stream_stop_duplex(struct snd_tscm *tscm);
void snd_tscm_proc_init(struct snd_tscm *tscm);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment