summaryrefslogtreecommitdiff
path: root/sound/firewire/motu/motu-pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/firewire/motu/motu-pcm.c')
-rw-r--r--sound/firewire/motu/motu-pcm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c
index 7bbf8b86a33d..00e693da0cad 100644
--- a/sound/firewire/motu/motu-pcm.c
+++ b/sound/firewire/motu/motu-pcm.c
@@ -162,6 +162,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
if (src != SND_MOTU_CLOCK_SOURCE_INTERNAL ||
(motu->substreams_counter > 0 && d->events_per_period > 0)) {
unsigned int frames_per_period = d->events_per_period;
+ unsigned int frames_per_buffer = d->events_per_buffer;
unsigned int rate;
err = protocol->get_clock_rate(motu, &rate);
@@ -179,6 +180,14 @@ static int pcm_open(struct snd_pcm_substream *substream)
mutex_unlock(&motu->mutex);
goto err_locked;
}
+
+ err = snd_pcm_hw_constraint_minmax(substream->runtime,
+ SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
+ frames_per_buffer, frames_per_buffer);
+ if (err < 0) {
+ mutex_unlock(&motu->mutex);
+ goto err_locked;
+ }
}
}
@@ -216,10 +225,11 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
unsigned int rate = params_rate(hw_params);
unsigned int frames_per_period = params_period_size(hw_params);
+ unsigned int frames_per_buffer = params_buffer_size(hw_params);
mutex_lock(&motu->mutex);
err = snd_motu_stream_reserve_duplex(motu, rate,
- frames_per_period);
+ frames_per_period, frames_per_buffer);
if (err >= 0)
++motu->substreams_counter;
mutex_unlock(&motu->mutex);