Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Vojta <vojta@Math.Berkeley.EDU>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: another device for opl3sa2
Date: Fri, 27 Jul 2007 00:55:14 -0700	[thread overview]
Message-ID: <20070727075514.GA2368@math.berkeley.edu> (raw)
In-Reply-To: <s5hy7ht50ir.wl%tiwai@suse.de>

On Fri, Jul 06, 2007 at 11:45:00AM +0200, Takashi Iwai wrote:
>
> 0x0b = CS4231_TEST_INIT, and 0x20 = CS4231_CALIB_IN_PROGRESS.
> At least, mce_down() should show messages if the calibration gets
> timeout.  Did you see any related messages?  Or didn't you build with
> --with-debug=full?

I have now recompiled the alsa drivers from alsa-driver-hg20070718
and with --debug=full.

I found that the bug would also occur the first time playing a .wav file
after "aplay -t au file.au".

The difference between opl3sa2 and 4232 occurred because of the lines

	if ((timeout & CS4231_MCE) == 0 ||
	    !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) {
		return;
	}

in mce_down() in cs4231_lib.c.  With opl3sa2 it was always returning at this
step, hence it didn't finish recalibrating before trying to play the sound.

If I changed it so that the second test is always false for opl3sa2, then
sound would mostly work, but intermittently I would get messages about
"auto calibration time out" or "serious init problem - codec still busy".
If I put a printk() statement in the beginning of mce_down to help debug
this, then the problem would go away, so I put in udelay(100) and that
also made the problems go away.

Therefore, I submit the following patch.

Synopsis:  Fix bugs in mode change/recalibration for opl3sa2 driver.

Signed-off by:  Paul Vojta <vojta@math.berkeley.edu>


diff -ur /tmp/alsa-driver-hg20070718/alsa-kernel/include/cs4231.h alsa-driver-hg20070718/alsa-kernel/include/cs4231.h
--- /tmp/alsa-driver-hg20070718/alsa-kernel/include/cs4231.h	2006-10-10 17:00:21.000000000 -0700
+++ alsa-driver-hg20070718/alsa-kernel/include/cs4231.h	2007-07-21 00:39:55.000000000 -0700
@@ -210,7 +210,7 @@
 #define CS4231_HW_CS4239	0x0404	/* CS4239 - Crystal Clear (tm) stereo enhancement */
 /* compatible, but clones */
 #define CS4231_HW_INTERWAVE     0x1000	/* InterWave chip */
-#define CS4231_HW_OPL3SA2       0x1001	/* OPL3-SA2 chip */
+#define CS4231_HW_OPL3SA2       0x1101	/* OPL3-SA2 chip, similar to cs4231 */
 
 /* defines for codec.hwshare */
 #define CS4231_HWSHARE_IRQ	(1<<0)
diff -ur /tmp/alsa-driver-hg20070718/alsa-kernel/isa/cs423x/cs4231_lib.c alsa-driver-hg20070718/alsa-kernel/isa/cs423x/cs4231_lib.c
--- /tmp/alsa-driver-hg20070718/alsa-kernel/isa/cs423x/cs4231_lib.c	2007-02-22 17:00:24.000000000 -0800
+++ alsa-driver-hg20070718/alsa-kernel/isa/cs423x/cs4231_lib.c	2007-07-25 22:49:04.000000000 -0700
@@ -555,6 +555,9 @@
 			snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT] = pdfr);
 		}
 		spin_unlock_irqrestore(&chip->reg_lock, flags);
+		if (chip->hardware == CS4231_HW_OPL3SA2) {
+			udelay(100);	/* this seems to help */
+		}
 		snd_cs4231_mce_down(chip);
 	}
 	snd_cs4231_calibrate_mute(chip, 0);
diff -ur /tmp/alsa-driver-hg20070718/alsa-kernel/isa/opl3sa2.c alsa-driver-hg20070718/alsa-kernel/isa/opl3sa2.c
--- /tmp/alsa-driver-hg20070718/alsa-kernel/isa/opl3sa2.c	2007-07-04 17:00:11.000000000 -0700
+++ alsa-driver-hg20070718/alsa-kernel/isa/opl3sa2.c	2007-07-25 21:19:39.000000000 -0700
@@ -253,6 +253,7 @@
 		/* 0x03 - YM715B */
 		/* 0x04 - YM719 - OPL-SA4? */
 		/* 0x05 - OPL3-SA3 - Libretto 100 */
+		/* 0x07 - unknown - Neomagic MagicWave 3D */
 		break;
 	}
 	str[0] = chip->version + '0';

  parent reply	other threads:[~2007-07-27  7:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-03  0:27 another device for opl3sa2 Paul Vojta
2007-07-03 10:05 ` Takashi Iwai
2007-07-04  2:24   ` Paul Vojta
2007-07-04  8:53     ` Takashi Iwai
2007-07-05  8:03       ` Paul Vojta
2007-07-05 14:38         ` Takashi Iwai
2007-07-06  7:41           ` Paul Vojta
2007-07-06  9:45             ` Takashi Iwai
2007-07-08  8:02               ` Paul Vojta
2007-07-09 12:42                 ` Takashi Iwai
2007-07-09 18:14                   ` Paul Vojta
2007-07-27  7:55               ` Paul Vojta [this message]
2007-07-27 10:22                 ` Takashi Iwai

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=20070727075514.GA2368@math.berkeley.edu \
    --to=vojta@math.berkeley.edu \
    --cc=alsa-devel@alsa-project.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox