All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] es1968: fix jitter on some maestro cards
@ 2008-03-29 23:49 Andreas Mueller
  2008-03-31 22:24   ` Rene Herman
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Mueller @ 2008-03-29 23:49 UTC (permalink / raw
  To: linux-kernel; +Cc: MatzeBraun, tiwai

[-- 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) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] es1968: fix jitter on some maestro cards
  2008-03-29 23:49 [PATCH] es1968: fix jitter on some maestro cards Andreas Mueller
@ 2008-03-31 22:24   ` Rene Herman
  0 siblings, 0 replies; 7+ messages in thread
From: Rene Herman @ 2008-03-31 22:24 UTC (permalink / raw
  To: Andreas Mueller; +Cc: linux-kernel, MatzeBraun, tiwai, ALSA devel

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

On 30-03-08 00:49, Andreas Mueller wrote:

> 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.

Added the alsa-devel list (and re-attached the patch). My TerraTec DMX (ESS 
Canyon3D, ES1970MS-3D) doesn't need this but doesn't seem to suffer from it 
either. Otherwise no idea about this.

Rene.

[-- 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) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] es1968: fix jitter on some maestro cards
@ 2008-03-31 22:24   ` Rene Herman
  0 siblings, 0 replies; 7+ messages in thread
From: Rene Herman @ 2008-03-31 22:24 UTC (permalink / raw
  To: Andreas Mueller; +Cc: tiwai, ALSA devel, linux-kernel, MatzeBraun

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

On 30-03-08 00:49, Andreas Mueller wrote:

> 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.

Added the alsa-devel list (and re-attached the patch). My TerraTec DMX (ESS 
Canyon3D, ES1970MS-3D) doesn't need this but doesn't seem to suffer from it 
either. Otherwise no idea about this.

Rene.

[-- 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) {

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] es1968: fix jitter on some maestro cards
  2008-03-31 22:24   ` Rene Herman
@ 2008-04-14 10:22     ` Takashi Iwai
  -1 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2008-04-14 10:22 UTC (permalink / raw
  To: Rene Herman; +Cc: Andreas Mueller, linux-kernel, MatzeBraun, ALSA devel

At Tue, 01 Apr 2008 00:24:43 +0200,
Rene Herman wrote:
> 
> On 30-03-08 00:49, Andreas Mueller wrote:
> 
> > 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.
> 
> Added the alsa-devel list (and re-attached the patch). My TerraTec DMX (ESS 
> Canyon3D, ES1970MS-3D) doesn't need this but doesn't seem to suffer from it 
> either. Otherwise no idea about this.

This should depend on the sample rate you use.  48k would work without
the patch.

Anyway, I applied it to ALSA tree now.  Thanks.


Takashi

> 
> Rene.
> [2 es1968_jitter.patch <text/plain (7bit)>]
> --- 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) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] es1968: fix jitter on some maestro cards
@ 2008-04-14 10:22     ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2008-04-14 10:22 UTC (permalink / raw
  To: Rene Herman; +Cc: ALSA devel, Andreas Mueller, linux-kernel, MatzeBraun

At Tue, 01 Apr 2008 00:24:43 +0200,
Rene Herman wrote:
> 
> On 30-03-08 00:49, Andreas Mueller wrote:
> 
> > 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.
> 
> Added the alsa-devel list (and re-attached the patch). My TerraTec DMX (ESS 
> Canyon3D, ES1970MS-3D) doesn't need this but doesn't seem to suffer from it 
> either. Otherwise no idea about this.

This should depend on the sample rate you use.  48k would work without
the patch.

Anyway, I applied it to ALSA tree now.  Thanks.


Takashi

> 
> Rene.
> [2 es1968_jitter.patch <text/plain (7bit)>]
> --- 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) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] es1968: fix jitter on some maestro cards
  2008-04-14 10:22     ` Takashi Iwai
@ 2008-04-14 10:43       ` Rene Herman
  -1 siblings, 0 replies; 7+ messages in thread
From: Rene Herman @ 2008-04-14 10:43 UTC (permalink / raw
  To: Takashi Iwai; +Cc: Andreas Mueller, linux-kernel, MatzeBraun, ALSA devel

On 14-04-08 12:22, Takashi Iwai wrote:

> At Tue, 01 Apr 2008 00:24:43 +0200,
> Rene Herman wrote:
>> On 30-03-08 00:49, Andreas Mueller wrote:
>>
>>> 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.
>> Added the alsa-devel list (and re-attached the patch). My TerraTec DMX (ESS 
>> Canyon3D, ES1970MS-3D) doesn't need this but doesn't seem to suffer from it 
>> either. Otherwise no idea about this.
> 
> This should depend on the sample rate you use.  48k would work without
> the patch.

Just to be clear archive-wise -- on this Canyon3D, so does 44100.

> Anyway, I applied it to ALSA tree now.  Thanks.

Rene.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] es1968: fix jitter on some maestro cards
@ 2008-04-14 10:43       ` Rene Herman
  0 siblings, 0 replies; 7+ messages in thread
From: Rene Herman @ 2008-04-14 10:43 UTC (permalink / raw
  To: Takashi Iwai; +Cc: ALSA devel, Andreas Mueller, linux-kernel, MatzeBraun

On 14-04-08 12:22, Takashi Iwai wrote:

> At Tue, 01 Apr 2008 00:24:43 +0200,
> Rene Herman wrote:
>> On 30-03-08 00:49, Andreas Mueller wrote:
>>
>>> 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.
>> Added the alsa-devel list (and re-attached the patch). My TerraTec DMX (ESS 
>> Canyon3D, ES1970MS-3D) doesn't need this but doesn't seem to suffer from it 
>> either. Otherwise no idea about this.
> 
> This should depend on the sample rate you use.  48k would work without
> the patch.

Just to be clear archive-wise -- on this Canyon3D, so does 44100.

> Anyway, I applied it to ALSA tree now.  Thanks.

Rene.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-04-14 10:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-29 23:49 [PATCH] es1968: fix jitter on some maestro cards Andreas Mueller
2008-03-31 22:24 ` 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

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.