printk("vortex: out of A3D sources. Sorry\n"); 
printk(KERN_ERR "vortex: out of A3D sources. Sorry\n"); 
vortex_adb_allocroute(vortex_t * vortex, int dma, int nr_ch, int dir, int type){	stream_t *stream;	int i, en;		if ((nr_ch == 3)	    || ((dir == SNDRV_PCM_STREAM_CAPTURE) && (nr_ch > 2)))		return -EBUSY;	if (dma >= 0) {		en = 0;		vortex_adb_checkinout(vortex,				      vortex->dma_adb[dma].resources, en,				      VORTEX_RESOURCE_DMA);	} else {		en = 1;		if ((dma =		     vortex_adb_checkinout(vortex, NULL, en,					   VORTEX_RESOURCE_DMA)) < 0)			return -EBUSY;	}	stream = &vortex->dma_adb[dma];	stream->dma = dma;	stream->dir = dir;	stream->type = type;	/* PLAYBACK ROUTES. */	if (dir == SNDRV_PCM_STREAM_PLAYBACK) {		int src[4], mix[4], ch_top;#ifndef CHIP_AU8820		int a3d = 0;#endif		/* Get SRC and MIXER hardware resources. */		if (stream->type != VORTEX_PCM_SPDIF) {			for (i = 0; i < nr_ch; i++) {				if ((src[i] = vortex_adb_checkinout(vortex,							   stream->resources, en,							   VORTEX_RESOURCE_SRC)) < 0) {					memset(stream->resources, 0,					       sizeof(unsigned char) *					       VORTEX_RESOURCE_LAST);					return -EBUSY;				}				if (stream->type != VORTEX_PCM_A3D) {					if ((mix[i] = vortex_adb_checkinout(vortex,								   stream->resources,								   en,								   VORTEX_RESOURCE_MIXIN)) < 0) {						memset(stream->resources,						       0,						       sizeof(unsigned char) * VORTEX_RESOURCE_LAST);						return -EBUSY;					}				}			}		}#ifndef CHIP_AU8820		if (stream->type == VORTEX_PCM_A3D) {			if ((a3d =			     vortex_adb_checkinout(vortex,						   stream->resources, en,						   VORTEX_RESOURCE_A3D)) < 0) {				memset(stream->resources, 0,				       sizeof(unsigned char) *				       VORTEX_RESOURCE_LAST);				printk("vortex: out of A3D sources. Sorry\n");				return -EBUSY;			}			/* (De)Initialize A3D hardware source. */			vortex_Vort3D_InitializeSource(&(vortex->a3d[a3d]), en);		}		/* Make SPDIF out exclusive to "spdif" device when in use. */		if ((stream->type == VORTEX_PCM_SPDIF) && (en)) {			vortex_route(vortex, 0, 0x14,				     ADB_MIXOUT(vortex->mixspdif[0]),				     ADB_SPDIFOUT(0));			vortex_route(vortex, 0, 0x14,				     ADB_MIXOUT(vortex->mixspdif[1]),				     ADB_SPDIFOUT(1));		}#endif		/* Make playback routes. */		for (i = 0; i < nr_ch; i++) {			if (stream->type == VORTEX_PCM_ADB) {				vortex_connection_adbdma_src(vortex, en,							     src[nr_ch - 1],							     dma,							     src[i]);				vortex_connection_src_mixin(vortex, en,							    0x11, src[i],							    mix[i]);				vortex_connection_mixin_mix(vortex, en,							    mix[i],							    MIX_PLAYB(i), 0);#ifndef CHIP_AU8820				vortex_connection_mixin_mix(vortex, en,							    mix[i],							    MIX_SPDIF(i % 2), 0);				vortex_mix_setinputvolumebyte(vortex,							      MIX_SPDIF(i % 2),							      mix[i],							      MIX_DEFIGAIN);#endif			}#ifndef CHIP_AU8820			if (stream->type == VORTEX_PCM_A3D) {				vortex_connection_adbdma_src(vortex, en,							     src[nr_ch - 1], 								 dma,							     src[i]);				vortex_route(vortex, en, 0x11, ADB_SRCOUT(src[i]), ADB_A3DIN(a3d));				/* XTalk test. */				//vortex_route(vortex, en, 0x11, dma, ADB_XTALKIN(i?9:4));				//vortex_route(vortex, en, 0x11, ADB_SRCOUT(src[i]), ADB_XTALKIN(i?4:9));			}			if (stream->type == VORTEX_PCM_SPDIF)				vortex_route(vortex, en, 0x14,					     ADB_DMA(stream->dma),					     ADB_SPDIFOUT(i));#endif		}		if (stream->type != VORTEX_PCM_SPDIF && stream->type != VORTEX_PCM_A3D) {			ch_top = (VORTEX_IS_QUAD(vortex) ? 4 : 2);			for (i = nr_ch; i < ch_top; i++) {				vortex_connection_mixin_mix(vortex, en,							    mix[i % nr_ch],							    MIX_PLAYB(i), 0);#ifndef CHIP_AU8820				vortex_connection_mixin_mix(vortex, en,							    mix[i % nr_ch],							    MIX_SPDIF(i % 2),								0);				vortex_mix_setinputvolumebyte(vortex,							      MIX_SPDIF(i % 2),							      mix[i % nr_ch],							      MIX_DEFIGAIN);#endif			}		}#ifndef CHIP_AU8820		else {			if (nr_ch == 1 && stream->type == VORTEX_PCM_SPDIF)				vortex_route(vortex, en, 0x14,					     ADB_DMA(stream->dma),					     ADB_SPDIFOUT(1));		}		/* Reconnect SPDIF out when "spdif" device is down. */		if ((stream->type == VORTEX_PCM_SPDIF) && (!en)) {			vortex_route(vortex, 1, 0x14,				     ADB_MIXOUT(vortex->mixspdif[0]),				     ADB_SPDIFOUT(0));			vortex_route(vortex, 1, 0x14,				     ADB_MIXOUT(vortex->mixspdif[1]),				     ADB_SPDIFOUT(1));		}#endif	/* CAPTURE ROUTES. */	} else {		int src[2], mix[2];		/* Get SRC and MIXER hardware resources. */		for (i = 0; i < nr_ch; i++) {			if ((mix[i] =			     vortex_adb_checkinout(vortex,						   stream->resources, en,						   VORTEX_RESOURCE_MIXOUT))			    < 0) {				memset(stream->resources, 0,				       sizeof(unsigned char) *				       VORTEX_RESOURCE_LAST);				return -EBUSY;			}			if ((src[i] =			     vortex_adb_checkinout(vortex,						   stream->resources, en,						   VORTEX_RESOURCE_SRC)) < 0) {				memset(stream->resources, 0,				       sizeof(unsigned char) *				       VORTEX_RESOURCE_LAST);				return -EBUSY;			}		}		/* Make capture routes. */		vortex_connection_mixin_mix(vortex, en, MIX_CAPT(0), mix[0], 0);		vortex_connection_mix_src(vortex, en, 0x11, mix[0], src[0]);		if (nr_ch == 1) {			vortex_connection_mixin_mix(vortex, en,						    MIX_CAPT(1), mix[0], 0);			vortex_connection_src_adbdma(vortex, en,						     src[0],						     src[0], dma);		} else {			vortex_connection_mixin_mix(vortex, en,						    MIX_CAPT(1), mix[1], 0);			vortex_connection_mix_src(vortex, en, 0x11, mix[1],						  src[1]);			vortex_connection_src_src_adbdma(vortex, en,							 src[1], src[0],							 src[1], dma);		}	}	vortex->dma_adb[dma].nr_ch = nr_ch;#if 0	/* AC97 Codec channel setup. FIXME: this has no effect on some cards !! */	if (nr_ch < 4) {		/* Copy stereo to rear channel (surround) */		snd_ac97_write_cache(vortex->codec,				     AC97_SIGMATEL_DAC2INVERT,				     snd_ac97_read(vortex->codec,						   AC97_SIGMATEL_DAC2INVERT)				     | 4);	} else {		/* Allow separate front and rear channels. */		snd_ac97_write_cache(vortex->codec,				     AC97_SIGMATEL_DAC2INVERT,				     snd_ac97_read(vortex->codec,						   AC97_SIGMATEL_DAC2INVERT)				     & ~((u32)					 4));	}#endif	return dma;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/99b359ba10a582148c6725f428a33ba5356dd993/au88x0_core.c/buggy/sound/pci/au88x0/au88x0_core.c