All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Ernst Persson <ernstp@mac.com>
Cc: alsa-devel@lists.sourceforge.net, linuxppc-dev@lists.linuxppc.org
Subject: Re: Burgundy Auto-Mute problem
Date: Thu, 17 Jul 2003 12:11:30 +0200	[thread overview]
Message-ID: <s5hn0fdzcml.wl@alsa2.suse.de> (raw)
In-Reply-To: <200307171108.03928.ernstp@mac.com>

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

At Thu, 17 Jul 2003 11:08:03 +0200,
Ernst Persson wrote:
> 
> Hi all!
> 
> Now that the 2.6.0 kernel is out I'm trying to get ALSA working on my iMac 
> 266, since it's the default sound system now (and dmasound doesn't compile).
> 
> The first problem was that everything locked up when the ALSA drivers loaded.
> No error message, no kernel panic, just dead. And compiling ALSA with debug
> didn't help either.
> 
> After some debugging I found out that the driver crashed here, in
> sound/ppc/burgundy.c    in   int __init snd_pmac_burgundy_init(pmac_t *chip)
> 
> #ifdef PMAC_SUPPORT_AUTOMUTE
> 
> 	printk(KERN_INFO "Automute Enabled.\n");
> 
> 	if ((err = snd_pmac_add_automute(chip)) < 0)
> 		return err;
> 
> 	chip->detect_headphone = snd_pmac_burgundy_detect_headphone;
> 	chip->update_automute = snd_pmac_burgundy_update_automute;
> 	snd_pmac_burgundy_update_automute(chip, 0); /* update the status only */
> #endif
> So I commented out //#define PMAC_SUPPORT_AUTOMUTE in pmac.h and after that
> the driver loaded without problems.
> 
> But as soon as I touch any mixer (both the oss-emulated or with alsamixer)
> everything locks up again, in exactly the same way.

it seems that extend extend_wait() function waits for an infinite
loop.  could you try the attached patch?


Takashi

[-- Attachment #2: burgundy-fix.dif --]
[-- Type: application/octet-stream, Size: 1657 bytes --]

Index: alsa-kernel/ppc/burgundy.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/ppc/burgundy.c,v
retrieving revision 1.9
diff -u -r1.9 burgundy.c
--- alsa-kernel/ppc/burgundy.c	16 Aug 2002 15:05:05 -0000	1.9
+++ alsa-kernel/ppc/burgundy.c	17 Jul 2003 10:11:07 -0000
@@ -34,17 +34,27 @@
 inline static void
 snd_pmac_burgundy_busy_wait(pmac_t *chip)
 {
-	while (in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD)
-		;
+	int timeout = 50;
+	while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--)
+		udelay(1);
+	if (! timeout)
+		printk(KERN_DEBUG "burgundy_busy_wait: timeout\n");
 }
 
 inline static void
 snd_pmac_burgundy_extend_wait(pmac_t *chip)
 {
-	while (!(in_le32(&chip->awacs->codec_stat) & MASK_EXTEND))
-		;
-	while (in_le32(&chip->awacs->codec_stat) & MASK_EXTEND)
-		;
+	int timeout;
+	timeout = 50;
+	while (!(in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--)
+		udelay(1);
+	if (! timeout)
+		printk(KERN_DEBUG "burgundy_extend_wait: timeout #1\n");
+	timeout = 50;
+	while ((in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--)
+		udelay(1);
+	if (! timeout)
+		printk(KERN_DEBUG "burgundy_extend_wait: timeout #2\n");
 }
 
 static void
@@ -66,7 +76,6 @@
 	unsigned val = 0;
 	unsigned long flags;
 
-	/* should have timeouts here */
 	spin_lock_irqsave(&chip->reg_lock, flags);
 
 	out_le32(&chip->awacs->codec_ctrl, addr + 0x100000);
@@ -107,7 +116,6 @@
 	unsigned val = 0;
 	unsigned long flags;
 
-	/* should have timeouts here */
 	spin_lock_irqsave(&chip->reg_lock, flags);
 
 	out_le32(&chip->awacs->codec_ctrl, addr + 0x100000);

WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Ernst Persson <ernstp@mac.com>
Cc: alsa-devel@lists.sourceforge.net, linuxppc-dev@lists.linuxppc.org
Subject: Re: [Alsa-devel] Burgundy Auto-Mute problem
Date: Thu, 17 Jul 2003 12:11:30 +0200	[thread overview]
Message-ID: <s5hn0fdzcml.wl@alsa2.suse.de> (raw)
In-Reply-To: <200307171108.03928.ernstp@mac.com>

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

At Thu, 17 Jul 2003 11:08:03 +0200,
Ernst Persson wrote:
>
> Hi all!
>
> Now that the 2.6.0 kernel is out I'm trying to get ALSA working on my iMac
> 266, since it's the default sound system now (and dmasound doesn't compile).
>
> The first problem was that everything locked up when the ALSA drivers loaded.
> No error message, no kernel panic, just dead. And compiling ALSA with debug
> didn't help either.
>
> After some debugging I found out that the driver crashed here, in
> sound/ppc/burgundy.c    in   int __init snd_pmac_burgundy_init(pmac_t *chip)
>
> #ifdef PMAC_SUPPORT_AUTOMUTE
>
> 	printk(KERN_INFO "Automute Enabled.\n");
>
> 	if ((err = snd_pmac_add_automute(chip)) < 0)
> 		return err;
>
> 	chip->detect_headphone = snd_pmac_burgundy_detect_headphone;
> 	chip->update_automute = snd_pmac_burgundy_update_automute;
> 	snd_pmac_burgundy_update_automute(chip, 0); /* update the status only */
> #endif
> So I commented out //#define PMAC_SUPPORT_AUTOMUTE in pmac.h and after that
> the driver loaded without problems.
>
> But as soon as I touch any mixer (both the oss-emulated or with alsamixer)
> everything locks up again, in exactly the same way.

it seems that extend extend_wait() function waits for an infinite
loop.  could you try the attached patch?


Takashi

[-- Attachment #2: burgundy-fix.dif --]
[-- Type: application/octet-stream, Size: 1651 bytes --]

Index: alsa-kernel/ppc/burgundy.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/ppc/burgundy.c,v
retrieving revision 1.9
diff -u -r1.9 burgundy.c
--- alsa-kernel/ppc/burgundy.c	16 Aug 2002 15:05:05 -0000	1.9
+++ alsa-kernel/ppc/burgundy.c	17 Jul 2003 10:11:07 -0000
@@ -34,17 +34,27 @@
 inline static void
 snd_pmac_burgundy_busy_wait(pmac_t *chip)
 {
-	while (in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD)
-		;
+	int timeout = 50;
+	while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--)
+		udelay(1);
+	if (! timeout)
+		printk(KERN_DEBUG "burgundy_busy_wait: timeout\n");
 }

 inline static void
 snd_pmac_burgundy_extend_wait(pmac_t *chip)
 {
-	while (!(in_le32(&chip->awacs->codec_stat) & MASK_EXTEND))
-		;
-	while (in_le32(&chip->awacs->codec_stat) & MASK_EXTEND)
-		;
+	int timeout;
+	timeout = 50;
+	while (!(in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--)
+		udelay(1);
+	if (! timeout)
+		printk(KERN_DEBUG "burgundy_extend_wait: timeout #1\n");
+	timeout = 50;
+	while ((in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--)
+		udelay(1);
+	if (! timeout)
+		printk(KERN_DEBUG "burgundy_extend_wait: timeout #2\n");
 }

 static void
@@ -66,7 +76,6 @@
 	unsigned val = 0;
 	unsigned long flags;

-	/* should have timeouts here */
 	spin_lock_irqsave(&chip->reg_lock, flags);

 	out_le32(&chip->awacs->codec_ctrl, addr + 0x100000);
@@ -107,7 +116,6 @@
 	unsigned val = 0;
 	unsigned long flags;

-	/* should have timeouts here */
 	spin_lock_irqsave(&chip->reg_lock, flags);

 	out_le32(&chip->awacs->codec_ctrl, addr + 0x100000);

  reply	other threads:[~2003-07-17 10:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-17  9:08 Burgundy Auto-Mute problem Ernst Persson
2003-07-17  9:08 ` Ernst Persson
2003-07-17 10:11 ` Takashi Iwai [this message]
2003-07-17 10:11   ` [Alsa-devel] " Takashi Iwai
2003-07-17 15:16   ` Ernst Persson
2003-07-17 15:16     ` [Alsa-devel] " Ernst Persson

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=s5hn0fdzcml.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=ernstp@mac.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /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.