aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/fireface/ff-pcm.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-06-07 20:11:03 -0400
committerTakashi Iwai <tiwai@suse.de>2017-06-08 03:15:44 -0400
commit55799c5ab99e8762e58c387e39f9fa36e8f14158 (patch)
tree77cfa81930583eeeec15f0ef783b1d9be9475986 /sound/firewire/fireface/ff-pcm.c
parentc6706de0ce8bc8cd1e336b8cf0acabf1adedba6c (diff)
ALSA: firewire: arrange common PCM info/constraints for AMDTP engine applications
In ALSA firewire stack, 8 drivers uses IEC 61883-1/6 engine for data transmission. They have common PCM info/constraints and duplicated codes. This commit unifies the codes into fireiwre-lib. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/fireface/ff-pcm.c')
-rw-r--r--sound/firewire/fireface/ff-pcm.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/sound/firewire/fireface/ff-pcm.c b/sound/firewire/fireface/ff-pcm.c
index ad974b5a2561..d12a0e3a4219 100644
--- a/sound/firewire/fireface/ff-pcm.c
+++ b/sound/firewire/fireface/ff-pcm.c
@@ -91,18 +91,6 @@ static void limit_channels_and_rates(struct snd_pcm_hardware *hw,
91 } 91 }
92} 92}
93 93
94static void limit_period_and_buffer(struct snd_pcm_hardware *hw)
95{
96 hw->periods_min = 2; /* SNDRV_PCM_INFO_BATCH */
97 hw->periods_max = UINT_MAX;
98
99 hw->period_bytes_min = 4 * hw->channels_max; /* bytes for a frame */
100
101 /* Just to prevent from allocating much pages. */
102 hw->period_bytes_max = hw->period_bytes_min * 2048;
103 hw->buffer_bytes_max = hw->period_bytes_max * hw->periods_min;
104}
105
106static int pcm_init_hw_params(struct snd_ff *ff, 94static int pcm_init_hw_params(struct snd_ff *ff,
107 struct snd_pcm_substream *substream) 95 struct snd_pcm_substream *substream)
108{ 96{
@@ -111,13 +99,6 @@ static int pcm_init_hw_params(struct snd_ff *ff,
111 const unsigned int *pcm_channels; 99 const unsigned int *pcm_channels;
112 int err; 100 int err;
113 101
114 runtime->hw.info = SNDRV_PCM_INFO_BATCH |
115 SNDRV_PCM_INFO_BLOCK_TRANSFER |
116 SNDRV_PCM_INFO_INTERLEAVED |
117 SNDRV_PCM_INFO_JOINT_DUPLEX |
118 SNDRV_PCM_INFO_MMAP |
119 SNDRV_PCM_INFO_MMAP_VALID;
120
121 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { 102 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
122 runtime->hw.formats = SNDRV_PCM_FMTBIT_S32; 103 runtime->hw.formats = SNDRV_PCM_FMTBIT_S32;
123 s = &ff->tx_stream; 104 s = &ff->tx_stream;
@@ -128,9 +109,7 @@ static int pcm_init_hw_params(struct snd_ff *ff,
128 pcm_channels = ff->spec->pcm_playback_channels; 109 pcm_channels = ff->spec->pcm_playback_channels;
129 } 110 }
130 111
131 /* limit rates */
132 limit_channels_and_rates(&runtime->hw, pcm_channels); 112 limit_channels_and_rates(&runtime->hw, pcm_channels);
133 limit_period_and_buffer(&runtime->hw);
134 113
135 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 114 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
136 hw_rule_channels, (void *)pcm_channels, 115 hw_rule_channels, (void *)pcm_channels,