diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2008-03-17 16:36:24 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 14:00:26 +0400 |
commit | f5e09ef0985ff01af6b4a12954840467f153a41c (patch) | |
tree | 81e8db50126018fe3fefd4a11d2e166aca48138d /sound/spi | |
parent | b32300a4ce78b4df92f33c455ffe644b36f0ff1a (diff) | |
download | linux-f5e09ef0985ff01af6b4a12954840467f153a41c.tar.xz |
[ALSA] at73c213: Add constraints for periods value
The interrupt handler always provide runtime->period_size data, so it
works correctly only if buffer_size was a multiple of period_size.
This patch fixes periodic click noise.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/spi')
-rw-r--r-- | sound/spi/at73c213.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index aa571152f034..09802e8a6fb8 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c @@ -210,7 +210,13 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream) { struct snd_at73c213 *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; + int err; + /* ensure buffer_size is a multiple of period_size */ + err = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (err < 0) + return err; snd_at73c213_playback_hw.rate_min = chip->bitrate; snd_at73c213_playback_hw.rate_max = chip->bitrate; runtime->hw = snd_at73c213_playback_hw; |