From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 17 Jul 2003 12:11:30 +0200 Message-ID: From: Takashi Iwai To: Ernst Persson Cc: alsa-devel@lists.sourceforge.net, linuxppc-dev@lists.linuxppc.org Subject: Re: [Alsa-devel] Burgundy Auto-Mute problem In-Reply-To: <200307171108.03928.ernstp@mac.com> References: <200307171108.03928.ernstp@mac.com> MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: multipart/mixed; boundary="Multipart_Thu_Jul_17_12:11:30_2003-1" Sender: owner-linuxppc-dev@lists.linuxppc.org List-Id: --Multipart_Thu_Jul_17_12:11:30_2003-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Thu_Jul_17_12:11:30_2003-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="burgundy-fix.dif" Content-Transfer-Encoding: 7bit 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); --Multipart_Thu_Jul_17_12:11:30_2003-1-- ** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/