All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cs4231: remove two auto-calibrations during chip initialization
@ 2007-09-18 10:17 Krzysztof Helt
  2007-09-18 10:38 ` Rene Herman
  0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Helt @ 2007-09-18 10:17 UTC (permalink / raw)
  To: Alsa-devel

From: Krzysztof Helt <krzysztof.h1@wp.pl>

The initialization function did auto-calibration after each
register setting. This patch merges more register changes
before auto-calibration is done.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
---

This is in the init() function so it is called just once.
The patch is about cutting fat from cs4231 drivers as
this change does not affect how they operate in any
major way.

diff -urp alsa-driver-1.0.15rc2/sound/isa/cs423x/cs4231_lib.c linux-2.6.23/sound/isa/cs423x/cs4231_lib.c
--- alsa-driver-1.0.15rc2/sound/isa/cs423x/cs4231_lib.c	2007-09-12 13:33:51.000000000 +0200
+++ linux-2.6.23/sound/isa/cs423x/cs4231_lib.c	2007-09-18 08:37:08.000000000 +0200
@@ -652,15 +652,7 @@ static void snd_cs4231_init(struct snd_c
 			     CS4231_CALIB_MODE);
 	chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB;
 	snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]);
-	spin_unlock_irqrestore(&chip->reg_lock, flags);
-	snd_cs4231_mce_down(chip);
-
-#ifdef SNDRV_DEBUG_MCE
-	snd_printk("init: (2)\n");
-#endif
 
-	snd_cs4231_mce_up(chip);
-	spin_lock_irqsave(&chip->reg_lock, flags);
 	snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]);
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
 	snd_cs4231_mce_down(chip);
@@ -676,15 +668,6 @@ static void snd_cs4231_init(struct snd_c
 	snd_cs4231_mce_up(chip);
 	spin_lock_irqsave(&chip->reg_lock, flags);
 	snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT]);
-	spin_unlock_irqrestore(&chip->reg_lock, flags);
-	snd_cs4231_mce_down(chip);
-
-#ifdef SNDRV_DEBUG_MCE
-	snd_printk("init: (4)\n");
-#endif
-
-	snd_cs4231_mce_up(chip);
-	spin_lock_irqsave(&chip->reg_lock, flags);
 	snd_cs4231_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT]);
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
 	snd_cs4231_mce_down(chip);
diff -urp linux-2.6.23.ref/sound/sparc/cs4231.c linux-2.6.23/sound/sparc/cs4231.c
--- linux-2.6.23.ref/sound/sparc/cs4231.c	2007-09-18 09:26:12.000000000 +0200
+++ linux-2.6.23/sound/sparc/cs4231.c	2007-09-18 09:26:54.000000000 +0200
@@ -733,15 +733,6 @@ static void __init snd_cs4231_init(struc
 					    CS4231_CALIB_MODE);
 	chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB;
 	snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]);
-	spin_unlock_irqrestore(&chip->lock, flags);
-	snd_cs4231_mce_down(chip);
-
-#ifdef SNDRV_DEBUG_MCE
-	snd_printdd("init: (2)\n");
-#endif
-
-	snd_cs4231_mce_up(chip);
-	spin_lock_irqsave(&chip->lock, flags);
 	snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]);
 	spin_unlock_irqrestore(&chip->lock, flags);
 	snd_cs4231_mce_down(chip);
@@ -757,15 +748,6 @@ static void __init snd_cs4231_init(struc
 	snd_cs4231_mce_up(chip);
 	spin_lock_irqsave(&chip->lock, flags);
 	snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT]);
-	spin_unlock_irqrestore(&chip->lock, flags);
-	snd_cs4231_mce_down(chip);
-
-#ifdef SNDRV_DEBUG_MCE
-	snd_printdd("init: (4)\n");
-#endif
-
-	snd_cs4231_mce_up(chip);
-	spin_lock_irqsave(&chip->lock, flags);
 	snd_cs4231_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT]);
 	spin_unlock_irqrestore(&chip->lock, flags);
 	snd_cs4231_mce_down(chip);

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

* Re: [PATCH] cs4231: remove two auto-calibrations during chip initialization
  2007-09-18 10:17 [PATCH] cs4231: remove two auto-calibrations during chip initialization Krzysztof Helt
@ 2007-09-18 10:38 ` Rene Herman
  2007-09-18 11:08   ` Jaroslav Kysela
  0 siblings, 1 reply; 4+ messages in thread
From: Rene Herman @ 2007-09-18 10:38 UTC (permalink / raw)
  To: Krzysztof Helt; +Cc: Alsa-devel, Jaroslav Kysela

On 09/18/2007 12:17 PM, Krzysztof Helt wrote:

> From: Krzysztof Helt <krzysztof.h1@wp.pl>
> 
> The initialization function did auto-calibration after each
> register setting. This patch merges more register changes
> before auto-calibration is done.

Seems to make sense but am a little uneasy about these -- someone very much 
did it this way on purpose originally it seems. Jaroslav, that someone was 
you I believe? Do you remember anything about this?

> Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> ---
> 
> This is in the init() function so it is called just once.
> The patch is about cutting fat from cs4231 drivers as
> this change does not affect how they operate in any
> major way.
> 
> diff -urp alsa-driver-1.0.15rc2/sound/isa/cs423x/cs4231_lib.c linux-2.6.23/sound/isa/cs423x/cs4231_lib.c
> --- alsa-driver-1.0.15rc2/sound/isa/cs423x/cs4231_lib.c	2007-09-12 13:33:51.000000000 +0200
> +++ linux-2.6.23/sound/isa/cs423x/cs4231_lib.c	2007-09-18 08:37:08.000000000 +0200
> @@ -652,15 +652,7 @@ static void snd_cs4231_init(struct snd_c
>  			     CS4231_CALIB_MODE);
>  	chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB;
>  	snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]);
> -	spin_unlock_irqrestore(&chip->reg_lock, flags);
> -	snd_cs4231_mce_down(chip);
> -
> -#ifdef SNDRV_DEBUG_MCE
> -	snd_printk("init: (2)\n");
> -#endif
>  
> -	snd_cs4231_mce_up(chip);
> -	spin_lock_irqsave(&chip->reg_lock, flags);
>  	snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]);
>  	spin_unlock_irqrestore(&chip->reg_lock, flags);
>  	snd_cs4231_mce_down(chip);
> @@ -676,15 +668,6 @@ static void snd_cs4231_init(struct snd_c
>  	snd_cs4231_mce_up(chip);
>  	spin_lock_irqsave(&chip->reg_lock, flags);
>  	snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT]);
> -	spin_unlock_irqrestore(&chip->reg_lock, flags);
> -	snd_cs4231_mce_down(chip);
> -
> -#ifdef SNDRV_DEBUG_MCE
> -	snd_printk("init: (4)\n");
> -#endif
> -
> -	snd_cs4231_mce_up(chip);
> -	spin_lock_irqsave(&chip->reg_lock, flags);
>  	snd_cs4231_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT]);
>  	spin_unlock_irqrestore(&chip->reg_lock, flags);
>  	snd_cs4231_mce_down(chip);
> diff -urp linux-2.6.23.ref/sound/sparc/cs4231.c linux-2.6.23/sound/sparc/cs4231.c
> --- linux-2.6.23.ref/sound/sparc/cs4231.c	2007-09-18 09:26:12.000000000 +0200
> +++ linux-2.6.23/sound/sparc/cs4231.c	2007-09-18 09:26:54.000000000 +0200
> @@ -733,15 +733,6 @@ static void __init snd_cs4231_init(struc
>  					    CS4231_CALIB_MODE);
>  	chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB;
>  	snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]);
> -	spin_unlock_irqrestore(&chip->lock, flags);
> -	snd_cs4231_mce_down(chip);
> -
> -#ifdef SNDRV_DEBUG_MCE
> -	snd_printdd("init: (2)\n");
> -#endif
> -
> -	snd_cs4231_mce_up(chip);
> -	spin_lock_irqsave(&chip->lock, flags);
>  	snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]);
>  	spin_unlock_irqrestore(&chip->lock, flags);
>  	snd_cs4231_mce_down(chip);
> @@ -757,15 +748,6 @@ static void __init snd_cs4231_init(struc
>  	snd_cs4231_mce_up(chip);
>  	spin_lock_irqsave(&chip->lock, flags);
>  	snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT]);
> -	spin_unlock_irqrestore(&chip->lock, flags);
> -	snd_cs4231_mce_down(chip);
> -
> -#ifdef SNDRV_DEBUG_MCE
> -	snd_printdd("init: (4)\n");
> -#endif
> -
> -	snd_cs4231_mce_up(chip);
> -	spin_lock_irqsave(&chip->lock, flags);
>  	snd_cs4231_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT]);
>  	spin_unlock_irqrestore(&chip->lock, flags);
>  	snd_cs4231_mce_down(chip);

Rene.

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

* Re: [PATCH] cs4231: remove two auto-calibrations during chip initialization
  2007-09-18 10:38 ` Rene Herman
@ 2007-09-18 11:08   ` Jaroslav Kysela
  2007-09-18 11:26     ` Rene Herman
  0 siblings, 1 reply; 4+ messages in thread
From: Jaroslav Kysela @ 2007-09-18 11:08 UTC (permalink / raw)
  To: Rene Herman; +Cc: Krzysztof Helt, Alsa-devel

On Tue, 18 Sep 2007, Rene Herman wrote:

> On 09/18/2007 12:17 PM, Krzysztof Helt wrote:
> 
> > From: Krzysztof Helt <krzysztof.h1@wp.pl>
> > 
> > The initialization function did auto-calibration after each
> > register setting. This patch merges more register changes
> > before auto-calibration is done.
> 
> Seems to make sense but am a little uneasy about these -- someone very much
> did it this way on purpose originally it seems. Jaroslav, that someone was you
> I believe? Do you remember anything about this?

If I remember correctly, it was workaround for some CS4231 chips to fix 
the noise audio issue (the chip was not initialized correctly in some 
cases). I would make a whitelist for "non-buggy" tested chips to skip 
double calibration.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

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

* Re: [PATCH] cs4231: remove two auto-calibrations during chip initialization
  2007-09-18 11:08   ` Jaroslav Kysela
@ 2007-09-18 11:26     ` Rene Herman
  0 siblings, 0 replies; 4+ messages in thread
From: Rene Herman @ 2007-09-18 11:26 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Krzysztof Helt, Alsa-devel

On 09/18/2007 01:08 PM, Jaroslav Kysela wrote:

> On Tue, 18 Sep 2007, Rene Herman wrote:
> 
>> On 09/18/2007 12:17 PM, Krzysztof Helt wrote:
>>
>>> From: Krzysztof Helt <krzysztof.h1@wp.pl>
>>>
>>> The initialization function did auto-calibration after each
>>> register setting. This patch merges more register changes
>>> before auto-calibration is done.
>> Seems to make sense but am a little uneasy about these -- someone very much
>> did it this way on purpose originally it seems. Jaroslav, that someone was you
>> I believe? Do you remember anything about this?
> 
> If I remember correctly, it was workaround for some CS4231 chips to fix 
> the noise audio issue (the chip was not initialized correctly in some 
> cases). I would make a whitelist for "non-buggy" tested chips to skip 
> double calibration.

Okay thanks. For reference, I have:

AD1848
AD1848KP
AD1845JP
AD1845XP
AD1846JP

CS4248-KL
CS4231
CS4231A-KL
CS4232-KQ
CS4235-XQ3
CS4236B-KQ
CS4237B-XQ3
CS4239-KQ

(Won't be testing right now, but will be generally available).

Rene.

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

end of thread, other threads:[~2007-09-18 11:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18 10:17 [PATCH] cs4231: remove two auto-calibrations during chip initialization Krzysztof Helt
2007-09-18 10:38 ` Rene Herman
2007-09-18 11:08   ` Jaroslav Kysela
2007-09-18 11:26     ` 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.