summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134/saa7134-alsa.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-11-23 19:59:18 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-11-23 19:59:18 -0200
commitef4c26c70d9f69bb8a7ce769de5135983f8cf02b (patch)
treea3cb051e95730f25389ceede8c0b3af8ce4d5f38 /linux/drivers/media/video/saa7134/saa7134-alsa.c
parent6bf79234893ea220ff70dd6b649e67a495abd9a3 (diff)
downloadmediapointer-dvb-s2-ef4c26c70d9f69bb8a7ce769de5135983f8cf02b.tar.gz
mediapointer-dvb-s2-ef4c26c70d9f69bb8a7ce769de5135983f8cf02b.tar.bz2
saa7134-alsa: fix period handling
From: Heikki Lindholm <holindho@cs.helsinki.fi> The period handling in saa7134-alsa is broken in two ways. First, the minimum number of periods of two does not work, because the dma is setup two periods ahead in the irq handler. Fix the minimum to four periods. Second, the code assumes that the number of periods is divisible by two, which isn't always the case on ALSA. Fix by adding a constraint. Signed-off-by: Heikki Lindholm <holindho@cs.helsinki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-alsa.c')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-alsa.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c
index 456f74eb7..c6715b054 100644
--- a/linux/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c
@@ -471,7 +471,7 @@ static struct snd_pcm_hardware snd_card_saa7134_capture =
.buffer_bytes_max = (256*1024),
.period_bytes_min = 64,
.period_bytes_max = (256*1024),
- .periods_min = 2,
+ .periods_min = 4,
.periods_max = 1024,
};
@@ -505,7 +505,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
snd_assert(period_size >= 0x100 && period_size <= 0x10000,
return -EINVAL);
- snd_assert(periods >= 2, return -EINVAL);
+ snd_assert(periods >= 4, return -EINVAL);
snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL);
dev = saa7134->dev;
@@ -661,7 +661,14 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
saa7134_tvaudio_setmute(dev);
}
- if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
+ err = snd_pcm_hw_constraint_integer(runtime,
+ SNDRV_PCM_HW_PARAM_PERIODS);
+ if (err < 0)
+ return err;
+
+ err = snd_pcm_hw_constraint_step(runtime, 0,
+ SNDRV_PCM_HW_PARAM_PERIODS, 2);
+ if (err < 0)
return err;
return 0;