aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeikki Lindholm <holindho@cs.helsinki.fi>2007-11-23 16:59:18 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-12-11 15:08:14 -0500
commit174eb8e8cb1ec97904ddeaae54366a03789162ef (patch)
tree800a304bcac7e6b403d7f9f606fde9ebfa7accd3
parent78f3b0b672c79df9ffa55399a7d6fc4b173e9b4b (diff)
V4L/DVB (6666): saa7134-alsa: fix period handling
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>
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index b9c5cf7dc849..ece177de72a5 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -457,7 +457,7 @@ static struct snd_pcm_hardware snd_card_saa7134_capture =
457 .buffer_bytes_max = (256*1024), 457 .buffer_bytes_max = (256*1024),
458 .period_bytes_min = 64, 458 .period_bytes_min = 64,
459 .period_bytes_max = (256*1024), 459 .period_bytes_max = (256*1024),
460 .periods_min = 2, 460 .periods_min = 4,
461 .periods_max = 1024, 461 .periods_max = 1024,
462}; 462};
463 463
@@ -491,7 +491,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
491 491
492 snd_assert(period_size >= 0x100 && period_size <= 0x10000, 492 snd_assert(period_size >= 0x100 && period_size <= 0x10000,
493 return -EINVAL); 493 return -EINVAL);
494 snd_assert(periods >= 2, return -EINVAL); 494 snd_assert(periods >= 4, return -EINVAL);
495 snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL); 495 snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL);
496 496
497 dev = saa7134->dev; 497 dev = saa7134->dev;
@@ -647,7 +647,14 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
647 saa7134_tvaudio_setmute(dev); 647 saa7134_tvaudio_setmute(dev);
648 } 648 }
649 649
650 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 650 err = snd_pcm_hw_constraint_integer(runtime,
651 SNDRV_PCM_HW_PARAM_PERIODS);
652 if (err < 0)
653 return err;
654
655 err = snd_pcm_hw_constraint_step(runtime, 0,
656 SNDRV_PCM_HW_PARAM_PERIODS, 2);
657 if (err < 0)
651 return err; 658 return err;
652 659
653 return 0; 660 return 0;