Commit f5e09ef0985ff01af6b4a12954840467f153a41c
Committed by
Takashi Iwai
1 parent
b32300a4ce
Exists in
master
and in
4 other branches
[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>
Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff
sound/spi/at73c213.c
... | ... | @@ -210,7 +210,13 @@ |
210 | 210 | { |
211 | 211 | struct snd_at73c213 *chip = snd_pcm_substream_chip(substream); |
212 | 212 | struct snd_pcm_runtime *runtime = substream->runtime; |
213 | + int err; | |
213 | 214 | |
215 | + /* ensure buffer_size is a multiple of period_size */ | |
216 | + err = snd_pcm_hw_constraint_integer(runtime, | |
217 | + SNDRV_PCM_HW_PARAM_PERIODS); | |
218 | + if (err < 0) | |
219 | + return err; | |
214 | 220 | snd_at73c213_playback_hw.rate_min = chip->bitrate; |
215 | 221 | snd_at73c213_playback_hw.rate_max = chip->bitrate; |
216 | 222 | runtime->hw = snd_at73c213_playback_hw; |