From 8bd172dc96fba8ba5a7560afdc1ff7461c278e86 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 3 May 2011 16:51:56 +0200 Subject: ALSA: lola - Allow granularity changes Add some sanity checks. Change PCM parameters appropriately per granularity. Signed-off-by: Takashi Iwai --- sound/pci/lola/lola_pcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound/pci/lola/lola_pcm.c') diff --git a/sound/pci/lola/lola_pcm.c b/sound/pci/lola/lola_pcm.c index dc2e811dcb3c..4bb5b5bd6371 100644 --- a/sound/pci/lola/lola_pcm.c +++ b/sound/pci/lola/lola_pcm.c @@ -178,14 +178,16 @@ static int lola_pcm_open(struct snd_pcm_substream *substream) str->opened = 1; runtime->hw = lola_pcm_hw; runtime->hw.channels_max = pcm->num_streams - str->index; + runtime->hw.rate_min = chip->sample_rate_min; + runtime->hw.rate_max = chip->sample_rate_max; snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); /* period size = multiple of chip->granularity (8, 16 or 32 frames) * use LOLA_GRANULARITY_MAX = 32 for instance */ snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, - LOLA_GRANULARITY_MAX); + chip->granularity); snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - LOLA_GRANULARITY_MAX); + chip->granularity); mutex_unlock(&chip->open_mutex); return 0; } -- cgit v1.2.3