summaryrefslogtreecommitdiff
path: root/sound/pci/es1968.c
diff options
context:
space:
mode:
authorAndreas Mueller <andreas@stapelspeicher.org>2008-04-14 13:08:05 +0200
committerTakashi Iwai <tiwai@suse.de>2008-04-24 12:00:33 +0200
commitf24bfa53dab478e1bde2d7fd39d3c1a69dc518f1 (patch)
tree6c9285033393683f81dd82417677004e9693ebeb /sound/pci/es1968.c
parent62cef8212ffa9df3e6c5b358ea2382d90489d590 (diff)
[ALSA] es1968: fix jitter on some maestro cards
This patch suppresses jitter on several Maestro cards in stereo mode (ALSA of course). The patch is also incorporated in the *BSD drivers where I "ported" it from. Without this patch most of the stereo audio gets out of sync and really distorted (oss-emulation with mplayer at 48000khz worked somehow). Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/es1968.c')
-rw-r--r--sound/pci/es1968.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 67f03264f871..f8f3bb662d17 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1827,6 +1827,23 @@ snd_es1968_pcm(struct es1968 *chip, int device)
return 0;
}
+/*
+ * suppress jitter on some maestros when playing stereo
+ */
+static void snd_es1968_suppress_jitter(struct es1968 *chip, struct esschan *es)
+{
+ unsigned int cp1;
+ unsigned int cp2;
+ unsigned int diff;
+
+ cp1 = __apu_get_register(chip, 0, 5);
+ cp2 = __apu_get_register(chip, 1, 5);
+ diff = (cp1 > cp2 ? cp1 - cp2 : cp2 - cp1);
+
+ if (diff > 1) {
+ __maestro_write(chip, IDR0_DATA_PORT, cp1);
+ }
+}
/*
* update pointer
@@ -1948,8 +1965,11 @@ static irqreturn_t snd_es1968_interrupt(int irq, void *dev_id)
struct esschan *es;
spin_lock(&chip->substream_lock);
list_for_each_entry(es, &chip->substream_list, list) {
- if (es->running)
+ if (es->running) {
snd_es1968_update_pcm(chip, es);
+ if (es->fmt & ESS_FMT_STEREO)
+ snd_es1968_suppress_jitter(chip, es);
+ }
}
spin_unlock(&chip->substream_lock);
if (chip->in_measurement) {