From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Re: ALSA 1.0.0pre1 is released - intel8x0 is oopsing (2.6) Date: Thu, 20 Nov 2003 16:33:18 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <1069291828.485.28.camel@cmn37.stanford.edu> <3FBC70F5.3060706@starhub.net.sg> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Thu_Nov_20_16:33:18_2003-1" Return-path: In-Reply-To: <3FBC70F5.3060706@starhub.net.sg> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: R CHAN Cc: perex@suse.cz, alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Thu_Nov_20_16:33:18_2003-1 Content-Type: text/plain; charset=US-ASCII At Thu, 20 Nov 2003 15:44:53 +0800, R CHAN wrote: > > Just tried ALSA CVS and 2.6.0-test9 current bk. > CVS snd-intel8x0 is oopsing. could you try the attached patch? Takashi --Multipart_Thu_Nov_20_16:33:18_2003-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="intel8x0-fix.dif" Content-Transfer-Encoding: 7bit Index: alsa-kernel/include/ac97_codec.h =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/include/ac97_codec.h,v retrieving revision 1.34 diff -u -r1.34 ac97_codec.h --- alsa-kernel/include/ac97_codec.h 18 Nov 2003 11:48:28 -0000 1.34 +++ alsa-kernel/include/ac97_codec.h 20 Nov 2003 15:22:47 -0000 @@ -479,7 +479,7 @@ int snd_ac97_pcm_assign(ac97_bus_t *ac97, unsigned short pcms_count, - struct ac97_pcm *pcms); + const struct ac97_pcm *pcms); int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, enum ac97_pcm_cfg cfg, unsigned short slots); int snd_ac97_pcm_close(struct ac97_pcm *pcm); Index: alsa-kernel/pci/intel8x0.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/intel8x0.c,v retrieving revision 1.101 diff -u -r1.101 intel8x0.c --- alsa-kernel/pci/intel8x0.c 18 Nov 2003 11:48:28 -0000 1.101 +++ alsa-kernel/pci/intel8x0.c 20 Nov 2003 15:30:21 -0000 @@ -892,8 +892,10 @@ err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); if (err < 0) return err; - if (ichdev->pcm_open_flag) + if (ichdev->pcm_open_flag) { snd_ac97_pcm_close(ichdev->pcm); + ichdev->pcm_open_flag = 0; + } err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params), params_channels(hw_params), ichdev->pcm->r[0].slots); @@ -906,8 +908,10 @@ { ichdev_t *ichdev = get_ichdev(substream); - if (ichdev->pcm_open_flag) + if (ichdev->pcm_open_flag) { snd_ac97_pcm_close(ichdev->pcm); + ichdev->pcm_open_flag = 0; + } return snd_pcm_lib_free_pages(substream); } @@ -1765,14 +1769,16 @@ goto __err; chip->ac97_bus = pbus; ac97.pci = chip->pci; - if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) { - __err: - /* clear the cold-reset bit for the next chance */ - if (chip->device_type != DEVICE_ALI) - iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD); - return err; + for (i = 0; i < codecs; i++) { + ac97.num = i; + if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) { + snd_printk(KERN_ERR "Unable to initialize codec #%d\n", i); + if (i == 0) + goto __err; + continue; + } + chip->ac97[i] = x97; } - chip->ac97[0] = x97; /* tune up the primary codec */ snd_ac97_tune_hardware(chip->ac97[0], ac97_quirks); /* enable separate SDINs for ICH4 */ @@ -1784,7 +1790,7 @@ i -= 2; /* do not allocate PCM2IN and MIC2 */ if (spdif_idx < 0) i--; /* do not allocate S/PDIF */ - err = snd_ac97_pcm_assign(pbus, ARRAY_SIZE(ac97_pcm_defs), ac97_pcm_defs); + err = snd_ac97_pcm_assign(pbus, i, ac97_pcm_defs); if (err < 0) goto __err; chip->ichd[ICHD_PCMOUT].pcm = &pbus->pcms[0]; @@ -1826,6 +1832,12 @@ } chip->in_ac97_init = 0; return 0; + + __err: + /* clear the cold-reset bit for the next chance */ + if (chip->device_type != DEVICE_ALI) + iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD); + return err; } Index: alsa-kernel/pci/ac97/ac97_pcm.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_pcm.c,v retrieving revision 1.2 diff -u -r1.2 ac97_pcm.c --- alsa-kernel/pci/ac97/ac97_pcm.c 18 Nov 2003 13:51:31 -0000 1.2 +++ alsa-kernel/pci/ac97/ac97_pcm.c 20 Nov 2003 15:23:34 -0000 @@ -260,7 +260,7 @@ unsigned short slots = 0; if (ac97_is_rev22(ac97)) { /* Note: it's simply emulation of AMAP behaviour */ - u8 es; + u16 es; es = ac97->regs[AC97_EXTENDED_STATUS] &= ~AC97_EI_DACS_SLOT_MASK; switch (ac97->addr) { case 1: @@ -357,11 +357,7 @@ case AC97_PCM_MIC_ADC_RATE: idx = AC97_RATES_MIC_ADC; break; default: idx = AC97_RATES_SPDIF; break; } - if (rates == ~0) { - rates = pcm->r[dbl].codec[cidx]->rates[idx]; - } else { - rates &= pcm->r[dbl].codec[cidx]->rates[idx]; - } + rates &= pcm->r[dbl].codec[cidx]->rates[idx]; } return rates; } @@ -378,7 +374,7 @@ */ int snd_ac97_pcm_assign(ac97_bus_t *bus, unsigned short pcms_count, - struct ac97_pcm *pcms) + const struct ac97_pcm *pcms) { int i, j, k; struct ac97_pcm *pcm, *rpcms, *rpcm; @@ -389,7 +385,7 @@ unsigned int rates; ac97_t *codec; - rpcms = snd_kcalloc(sizeof(struct ac97_pcm), GFP_KERNEL); + rpcms = snd_kcalloc(sizeof(struct ac97_pcm) * pcms_count, GFP_KERNEL); if (rpcms == NULL) return -ENOMEM; memset(avail_slots, 0, sizeof(avail_slots)); @@ -421,6 +417,7 @@ rpcm->exclusive = pcm->exclusive; rpcm->private_value = pcm->private_value; rpcm->bus = bus; + rpcm->rates = ~0; slots = pcm->r[0].slots; for (j = 0; j < 4 && slots; j++) { rates = ~0; @@ -448,11 +445,7 @@ } slots &= ~tmp; rpcm->r[0].slots |= tmp; - if (j == 0) { - pcm->rates = rates; - } else { - pcm->rates &= rates; - } + rpcm->rates &= rates; } } bus->pcms_count = pcms_count; --Multipart_Thu_Nov_20_16:33:18_2003-1-- ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/