aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob/bebob_pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/firewire/bebob/bebob_pcm.c')
-rw-r--r--sound/firewire/bebob/bebob_pcm.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/sound/firewire/bebob/bebob_pcm.c b/sound/firewire/bebob/bebob_pcm.c
index 9e27eb8e1dd4..e6adab3ef42e 100644
--- a/sound/firewire/bebob/bebob_pcm.c
+++ b/sound/firewire/bebob/bebob_pcm.c
@@ -92,19 +92,6 @@ limit_channels_and_rates(struct snd_pcm_hardware *hw,
92 } 92 }
93} 93}
94 94
95static void
96limit_period_and_buffer(struct snd_pcm_hardware *hw)
97{
98 hw->periods_min = 2; /* SNDRV_PCM_INFO_BATCH */
99 hw->periods_max = UINT_MAX;
100
101 hw->period_bytes_min = 4 * hw->channels_max; /* bytes for a frame */
102
103 /* Just to prevent from allocating much pages. */
104 hw->period_bytes_max = hw->period_bytes_min * 2048;
105 hw->buffer_bytes_max = hw->period_bytes_max * hw->periods_min;
106}
107
108static int 95static int
109pcm_init_hw_params(struct snd_bebob *bebob, 96pcm_init_hw_params(struct snd_bebob *bebob,
110 struct snd_pcm_substream *substream) 97 struct snd_pcm_substream *substream)
@@ -114,13 +101,6 @@ pcm_init_hw_params(struct snd_bebob *bebob,
114 struct snd_bebob_stream_formation *formations; 101 struct snd_bebob_stream_formation *formations;
115 int err; 102 int err;
116 103
117 runtime->hw.info = SNDRV_PCM_INFO_BATCH |
118 SNDRV_PCM_INFO_BLOCK_TRANSFER |
119 SNDRV_PCM_INFO_INTERLEAVED |
120 SNDRV_PCM_INFO_JOINT_DUPLEX |
121 SNDRV_PCM_INFO_MMAP |
122 SNDRV_PCM_INFO_MMAP_VALID;
123
124 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { 104 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
125 runtime->hw.formats = AM824_IN_PCM_FORMAT_BITS; 105 runtime->hw.formats = AM824_IN_PCM_FORMAT_BITS;
126 s = &bebob->tx_stream; 106 s = &bebob->tx_stream;
@@ -132,7 +112,6 @@ pcm_init_hw_params(struct snd_bebob *bebob,
132 } 112 }
133 113
134 limit_channels_and_rates(&runtime->hw, formations); 114 limit_channels_and_rates(&runtime->hw, formations);
135 limit_period_and_buffer(&runtime->hw);
136 115
137 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 116 err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
138 hw_rule_channels, formations, 117 hw_rule_channels, formations,
@@ -224,8 +203,6 @@ pcm_capture_hw_params(struct snd_pcm_substream *substream,
224 mutex_unlock(&bebob->mutex); 203 mutex_unlock(&bebob->mutex);
225 } 204 }
226 205
227 amdtp_am824_set_pcm_format(&bebob->tx_stream, params_format(hw_params));
228
229 return 0; 206 return 0;
230} 207}
231static int 208static int
@@ -246,8 +223,6 @@ pcm_playback_hw_params(struct snd_pcm_substream *substream,
246 mutex_unlock(&bebob->mutex); 223 mutex_unlock(&bebob->mutex);
247 } 224 }
248 225
249 amdtp_am824_set_pcm_format(&bebob->rx_stream, params_format(hw_params));
250
251 return 0; 226 return 0;
252} 227}
253 228
@@ -359,6 +334,20 @@ pcm_playback_pointer(struct snd_pcm_substream *sbstrm)
359 return amdtp_stream_pcm_pointer(&bebob->rx_stream); 334 return amdtp_stream_pcm_pointer(&bebob->rx_stream);
360} 335}
361 336
337static int pcm_capture_ack(struct snd_pcm_substream *substream)
338{
339 struct snd_bebob *bebob = substream->private_data;
340
341 return amdtp_stream_pcm_ack(&bebob->tx_stream);
342}
343
344static int pcm_playback_ack(struct snd_pcm_substream *substream)
345{
346 struct snd_bebob *bebob = substream->private_data;
347
348 return amdtp_stream_pcm_ack(&bebob->rx_stream);
349}
350
362int snd_bebob_create_pcm_devices(struct snd_bebob *bebob) 351int snd_bebob_create_pcm_devices(struct snd_bebob *bebob)
363{ 352{
364 static const struct snd_pcm_ops capture_ops = { 353 static const struct snd_pcm_ops capture_ops = {
@@ -370,6 +359,7 @@ int snd_bebob_create_pcm_devices(struct snd_bebob *bebob)
370 .prepare = pcm_capture_prepare, 359 .prepare = pcm_capture_prepare,
371 .trigger = pcm_capture_trigger, 360 .trigger = pcm_capture_trigger,
372 .pointer = pcm_capture_pointer, 361 .pointer = pcm_capture_pointer,
362 .ack = pcm_capture_ack,
373 .page = snd_pcm_lib_get_vmalloc_page, 363 .page = snd_pcm_lib_get_vmalloc_page,
374 }; 364 };
375 static const struct snd_pcm_ops playback_ops = { 365 static const struct snd_pcm_ops playback_ops = {
@@ -381,6 +371,7 @@ int snd_bebob_create_pcm_devices(struct snd_bebob *bebob)
381 .prepare = pcm_playback_prepare, 371 .prepare = pcm_playback_prepare,
382 .trigger = pcm_playback_trigger, 372 .trigger = pcm_playback_trigger,
383 .pointer = pcm_playback_pointer, 373 .pointer = pcm_playback_pointer,
374 .ack = pcm_playback_ack,
384 .page = snd_pcm_lib_get_vmalloc_page, 375 .page = snd_pcm_lib_get_vmalloc_page,
385 .mmap = snd_pcm_lib_mmap_vmalloc, 376 .mmap = snd_pcm_lib_mmap_vmalloc,
386 }; 377 };