aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-09-18 22:21:57 -0400
committerTakashi Iwai <tiwai@suse.de>2015-09-29 06:48:19 -0400
commitbc8500da3e62cd6a896407a1b330a2eb21817c22 (patch)
tree74259f781b6999135349f5670c0bbd907f28936f
parent51c29fd21389d9995a8a18a91eeb8dd1220a2119 (diff)
ALSA: firewire-lib: move PCM substream constraint to AM824 layer
In IEC 61883-6, PCM frames are transferred in Multi Bit Linear Audio data channel. The data channel transfers 16/20/24 bit PCM samples. Thus, PCM substream has a constrain about it. This commit moves codes related to the constraint from packet streaming layer to AM824 data block processing layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/firewire/amdtp-am824.c20
-rw-r--r--sound/firewire/amdtp-am824.h5
-rw-r--r--sound/firewire/amdtp-stream.c5
-rw-r--r--sound/firewire/bebob/bebob_pcm.c2
-rw-r--r--sound/firewire/dice/dice-pcm.c2
-rw-r--r--sound/firewire/fireworks/fireworks_pcm.c2
-rw-r--r--sound/firewire/oxfw/oxfw-pcm.c2
7 files changed, 29 insertions, 9 deletions
diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c
index f5edcbfa3157..7adaba356579 100644
--- a/sound/firewire/amdtp-am824.c
+++ b/sound/firewire/amdtp-am824.c
@@ -53,6 +53,26 @@ int amdtp_am824_set_parameters(struct amdtp_stream *s, unsigned int rate,
53EXPORT_SYMBOL_GPL(amdtp_am824_set_parameters); 53EXPORT_SYMBOL_GPL(amdtp_am824_set_parameters);
54 54
55/** 55/**
56 * amdtp_am824_add_pcm_hw_constraints - add hw constraints for PCM substream
57 * @s: the AMDTP stream for AM824 data block, must be initialized.
58 * @runtime: the PCM substream runtime
59 *
60 */
61int amdtp_am824_add_pcm_hw_constraints(struct amdtp_stream *s,
62 struct snd_pcm_runtime *runtime)
63{
64 int err;
65
66 err = amdtp_stream_add_pcm_hw_constraints(s, runtime);
67 if (err < 0)
68 return err;
69
70 /* AM824 in IEC 61883-6 can deliver 24bit data. */
71 return snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
72}
73EXPORT_SYMBOL_GPL(amdtp_am824_add_pcm_hw_constraints);
74
75/**
56 * amdtp_am824_init - initialize an AMDTP stream structure to handle AM824 76 * amdtp_am824_init - initialize an AMDTP stream structure to handle AM824
57 * data block 77 * data block
58 * @s: the AMDTP stream to initialize 78 * @s: the AMDTP stream to initialize
diff --git a/sound/firewire/amdtp-am824.h b/sound/firewire/amdtp-am824.h
index cfc0d61e0db4..4aaed9048d82 100644
--- a/sound/firewire/amdtp-am824.h
+++ b/sound/firewire/amdtp-am824.h
@@ -1,6 +1,8 @@
1#ifndef SOUND_FIREWIRE_AMDTP_AM824_H_INCLUDED 1#ifndef SOUND_FIREWIRE_AMDTP_AM824_H_INCLUDED
2#define SOUND_FIREWIRE_AMDTP_AM824_H_INCLUDED 2#define SOUND_FIREWIRE_AMDTP_AM824_H_INCLUDED
3 3
4#include <sound/pcm.h>
5
4#include "amdtp-stream.h" 6#include "amdtp-stream.h"
5 7
6int amdtp_am824_set_parameters(struct amdtp_stream *s, unsigned int rate, 8int amdtp_am824_set_parameters(struct amdtp_stream *s, unsigned int rate,
@@ -8,6 +10,9 @@ int amdtp_am824_set_parameters(struct amdtp_stream *s, unsigned int rate,
8 unsigned int midi_ports, 10 unsigned int midi_ports,
9 bool double_pcm_frames); 11 bool double_pcm_frames);
10 12
13int amdtp_am824_add_pcm_hw_constraints(struct amdtp_stream *s,
14 struct snd_pcm_runtime *runtime);
15
11int amdtp_am824_init(struct amdtp_stream *s, struct fw_unit *unit, 16int amdtp_am824_init(struct amdtp_stream *s, struct fw_unit *unit,
12 enum amdtp_stream_direction dir, enum cip_flags flags); 17 enum amdtp_stream_direction dir, enum cip_flags flags);
13#endif 18#endif
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 53d84e9bf241..def4fb4b1cce 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -140,11 +140,6 @@ int amdtp_stream_add_pcm_hw_constraints(struct amdtp_stream *s,
140{ 140{
141 int err; 141 int err;
142 142
143 /* AM824 in IEC 61883-6 can deliver 24bit data */
144 err = snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
145 if (err < 0)
146 goto end;
147
148 /* 143 /*
149 * Currently firewire-lib processes 16 packets in one software 144 * Currently firewire-lib processes 16 packets in one software
150 * interrupt callback. This equals to 2msec but actually the 145 * interrupt callback. This equals to 2msec but actually the
diff --git a/sound/firewire/bebob/bebob_pcm.c b/sound/firewire/bebob/bebob_pcm.c
index c0f018a61fdc..50610ca4b480 100644
--- a/sound/firewire/bebob/bebob_pcm.c
+++ b/sound/firewire/bebob/bebob_pcm.c
@@ -146,7 +146,7 @@ pcm_init_hw_params(struct snd_bebob *bebob,
146 if (err < 0) 146 if (err < 0)
147 goto end; 147 goto end;
148 148
149 err = amdtp_stream_add_pcm_hw_constraints(s, runtime); 149 err = amdtp_am824_add_pcm_hw_constraints(s, runtime);
150end: 150end:
151 return err; 151 return err;
152} 152}
diff --git a/sound/firewire/dice/dice-pcm.c b/sound/firewire/dice/dice-pcm.c
index 4e67b1da0fe6..f5f30079311f 100644
--- a/sound/firewire/dice/dice-pcm.c
+++ b/sound/firewire/dice/dice-pcm.c
@@ -156,7 +156,7 @@ static int init_hw_info(struct snd_dice *dice,
156 if (err < 0) 156 if (err < 0)
157 goto end; 157 goto end;
158 158
159 err = amdtp_stream_add_pcm_hw_constraints(stream, runtime); 159 err = amdtp_am824_add_pcm_hw_constraints(stream, runtime);
160end: 160end:
161 return err; 161 return err;
162} 162}
diff --git a/sound/firewire/fireworks/fireworks_pcm.c b/sound/firewire/fireworks/fireworks_pcm.c
index c30b2ffa8dfb..f186ab70f429 100644
--- a/sound/firewire/fireworks/fireworks_pcm.c
+++ b/sound/firewire/fireworks/fireworks_pcm.c
@@ -187,7 +187,7 @@ pcm_init_hw_params(struct snd_efw *efw,
187 if (err < 0) 187 if (err < 0)
188 goto end; 188 goto end;
189 189
190 err = amdtp_stream_add_pcm_hw_constraints(s, runtime); 190 err = amdtp_am824_add_pcm_hw_constraints(s, runtime);
191end: 191end:
192 return err; 192 return err;
193} 193}
diff --git a/sound/firewire/oxfw/oxfw-pcm.c b/sound/firewire/oxfw/oxfw-pcm.c
index 9c73930d0278..bddd28743a65 100644
--- a/sound/firewire/oxfw/oxfw-pcm.c
+++ b/sound/firewire/oxfw/oxfw-pcm.c
@@ -158,7 +158,7 @@ static int init_hw_params(struct snd_oxfw *oxfw,
158 if (err < 0) 158 if (err < 0)
159 goto end; 159 goto end;
160 160
161 err = amdtp_stream_add_pcm_hw_constraints(stream, runtime); 161 err = amdtp_am824_add_pcm_hw_constraints(stream, runtime);
162end: 162end:
163 return err; 163 return err;
164} 164}