diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/lola/lola.c | 27 | ||||
-rw-r--r-- | sound/pci/lola/lola.h | 1 | ||||
-rw-r--r-- | sound/pci/lola/lola_pcm.c | 6 |
3 files changed, 27 insertions, 7 deletions
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c index 3d2516b11f2..8ee22bee10c 100644 --- a/sound/pci/lola/lola.c +++ b/sound/pci/lola/lola.c | |||
@@ -587,14 +587,31 @@ static int __devinit lola_create(struct snd_card *card, struct pci_dev *pci, | |||
587 | chip->pci = pci; | 587 | chip->pci = pci; |
588 | chip->irq = -1; | 588 | chip->irq = -1; |
589 | 589 | ||
590 | chip->sample_rate_min = sample_rate_min[dev]; | ||
591 | chip->granularity = granularity[dev]; | 590 | chip->granularity = granularity[dev]; |
592 | /* FIXME */ | 591 | switch (chip->granularity) { |
593 | if (chip->granularity != LOLA_GRANULARITY_MAX) { | 592 | case 8: |
593 | chip->sample_rate_max = 48000; | ||
594 | break; | ||
595 | case 16: | ||
596 | chip->sample_rate_max = 96000; | ||
597 | break; | ||
598 | case 32: | ||
599 | chip->sample_rate_max = 192000; | ||
600 | break; | ||
601 | default: | ||
594 | snd_printk(KERN_WARNING SFX | 602 | snd_printk(KERN_WARNING SFX |
595 | "Only %d granularity is supported for now\n", | 603 | "Invalid granularity %d, reset to %d\n", |
596 | LOLA_GRANULARITY_MAX); | 604 | chip->granularity, LOLA_GRANULARITY_MAX); |
597 | chip->granularity = LOLA_GRANULARITY_MAX; | 605 | chip->granularity = LOLA_GRANULARITY_MAX; |
606 | chip->sample_rate_max = 192000; | ||
607 | break; | ||
608 | } | ||
609 | chip->sample_rate_min = sample_rate_min[dev]; | ||
610 | if (chip->sample_rate_min > chip->sample_rate_max) { | ||
611 | snd_printk(KERN_WARNING SFX | ||
612 | "Invalid sample_rate_min %d, reset to 16000\n", | ||
613 | chip->sample_rate_min); | ||
614 | chip->sample_rate_min = 16000; | ||
598 | } | 615 | } |
599 | 616 | ||
600 | err = pci_request_regions(pci, DRVNAME); | 617 | err = pci_request_regions(pci, DRVNAME); |
diff --git a/sound/pci/lola/lola.h b/sound/pci/lola/lola.h index 839779dc32f..bc8110ff6b4 100644 --- a/sound/pci/lola/lola.h +++ b/sound/pci/lola/lola.h | |||
@@ -367,6 +367,7 @@ struct lola { | |||
367 | /* parameters */ | 367 | /* parameters */ |
368 | unsigned int granularity; | 368 | unsigned int granularity; |
369 | unsigned int sample_rate_min; | 369 | unsigned int sample_rate_min; |
370 | unsigned int sample_rate_max; | ||
370 | 371 | ||
371 | /* flags */ | 372 | /* flags */ |
372 | unsigned int running :1; | 373 | unsigned int running :1; |
diff --git a/sound/pci/lola/lola_pcm.c b/sound/pci/lola/lola_pcm.c index dc2e811dcb3..4bb5b5bd637 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) | |||
178 | str->opened = 1; | 178 | str->opened = 1; |
179 | runtime->hw = lola_pcm_hw; | 179 | runtime->hw = lola_pcm_hw; |
180 | runtime->hw.channels_max = pcm->num_streams - str->index; | 180 | runtime->hw.channels_max = pcm->num_streams - str->index; |
181 | runtime->hw.rate_min = chip->sample_rate_min; | ||
182 | runtime->hw.rate_max = chip->sample_rate_max; | ||
181 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 183 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
182 | /* period size = multiple of chip->granularity (8, 16 or 32 frames) | 184 | /* period size = multiple of chip->granularity (8, 16 or 32 frames) |
183 | * use LOLA_GRANULARITY_MAX = 32 for instance | 185 | * use LOLA_GRANULARITY_MAX = 32 for instance |
184 | */ | 186 | */ |
185 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, | 187 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, |
186 | LOLA_GRANULARITY_MAX); | 188 | chip->granularity); |
187 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, | 189 | snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, |
188 | LOLA_GRANULARITY_MAX); | 190 | chip->granularity); |
189 | mutex_unlock(&chip->open_mutex); | 191 | mutex_unlock(&chip->open_mutex); |
190 | return 0; | 192 | return 0; |
191 | } | 193 | } |