Skip to content

Commit

Permalink
ALSA: firewire-lib: add data block processing layer for AM824 format
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Takashi Sakamoto authored and Takashi Iwai committed Sep 29, 2015
1 parent d67c46b commit 5955815
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 16 deletions.
2 changes: 1 addition & 1 deletion sound/firewire/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions sound/firewire/amdtp-am824.c
Original file line number Diff line number Diff line change
@@ -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);
8 changes: 8 additions & 0 deletions sound/firewire/amdtp-am824.h
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions sound/firewire/amdtp-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion sound/firewire/amdtp-stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion sound/firewire/bebob/bebob.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 4 additions & 4 deletions sound/firewire/bebob/bebob_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sound/firewire/dice/dice-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sound/firewire/dice/dice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion sound/firewire/fireworks/fireworks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion sound/firewire/fireworks/fireworks_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sound/firewire/oxfw/oxfw-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sound/firewire/oxfw/oxfw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5955815

Please sign in to comment.