All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Mueller <andreas@stapelspeicher.org>
To: linux-kernel@vger.kernel.org
Cc: MatzeBraun@gmx.de, tiwai@suse.de
Subject: [PATCH] es1968: fix jitter on some maestro cards
Date: Sun, 30 Mar 2008 00:49:44 +0100	[thread overview]
Message-ID: <20080329234943.GA2899@slappy> (raw)

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

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.
I am barely used to driver-development so please take a look (esp. the channel
parameters), nevertheless it completely works for me.

Without this patch most of the stereo audio gets out of sync and really
distorted (oss-emulation with mplayer at 48000khz worked somehow).

CCed to those listed in the .c file.

Yours sincerely,
Andreas Mueller.

[-- Attachment #2: es1968_jitter.patch --]
[-- Type: text/plain, Size: 990 bytes --]

--- sound/pci/es1968.c.old	2008-03-29 19:17:16.771116317 +0100
+++ sound/pci/es1968.c	2008-03-30 00:14:35.363057160 +0100
@@ -1816,7 +1816,24 @@
 
 	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
  */
@@ -1937,8 +1954,11 @@
 		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) {

             reply	other threads:[~2008-03-29 23:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29 23:49 Andreas Mueller [this message]
2008-03-31 22:24 ` [PATCH] es1968: fix jitter on some maestro cards Rene Herman
2008-03-31 22:24   ` Rene Herman
2008-04-14 10:22   ` Takashi Iwai
2008-04-14 10:22     ` Takashi Iwai
2008-04-14 10:43     ` Rene Herman
2008-04-14 10:43       ` Rene Herman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080329234943.GA2899@slappy \
    --to=andreas@stapelspeicher.org \
    --cc=MatzeBraun@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.