Skip to content

Commit

Permalink
[ALSA] at73c213: Add constraints for periods value
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
atsushi-nemoto authored and tiwai committed Apr 24, 2008
1 parent b32300a commit f5e09ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/spi/at73c213.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f5e09ef

Please sign in to comment.