snd_printk("Installing spdif_bug patch: %s\n", emu->card_capabilities->name); 
snd_printk(KERN_INFO "Installing spdif_bug patch: %s\n", emu->card_capabilities->name); 
static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu){	int err, i, z, gpr, nctl;	const int playback = 10;	const int capture = playback + (SND_EMU10K1_PLAYBACK_CHANNELS * 2); /* we reserve 10 voices */	const int stereo_mix = capture + 2;	const int tmp = 0x88;	u32 ptr;	emu10k1_fx8010_code_t *icode = NULL;	emu10k1_fx8010_control_gpr_t *controls = NULL, *ctl;	u32 *gpr_map;	mm_segment_t seg;	spin_lock_init(&emu->fx8010.irq_lock);	INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);	if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL ||	    (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL ||	    (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) {		err = -ENOMEM;		goto __err;	}	gpr_map = (u32 __force *)icode->gpr_map;	icode->tram_data_map = icode->gpr_map + 512;	icode->tram_addr_map = icode->tram_data_map + 256;	icode->code = icode->tram_addr_map + 256;	/* clear free GPRs */	for (i = 0; i < 512; i++)		set_bit(i, icode->gpr_valid);			/* clear TRAM data & address lines */	for (i = 0; i < 256; i++)		set_bit(i, icode->tram_valid);	strcpy(icode->name, "Audigy DSP code for ALSA");	ptr = 0;	nctl = 0;	gpr = stereo_mix + 10;	/* stop FX processor */	snd_emu10k1_ptr_write(emu, A_DBG, 0, (emu->fx8010.dbg = 0) | A_DBG_SINGLE_STEP);	/* PCM front Playback Volume (independent from stereo mix) */	A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_FRONT));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_FRONT));	snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Front Playback Volume", gpr, 100);	gpr += 2;		/* PCM Surround Playback (independent from stereo mix) */	A_OP(icode, &ptr, iMAC0, A_GPR(playback+2), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_REAR));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+3), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_REAR));	snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Surround Playback Volume", gpr, 100);	gpr += 2;		/* PCM Side Playback (independent from stereo mix) */	if (emu->card_capabilities->spk71) {		A_OP(icode, &ptr, iMAC0, A_GPR(playback+6), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_SIDE));		A_OP(icode, &ptr, iMAC0, A_GPR(playback+7), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_SIDE));		snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Side Playback Volume", gpr, 100);		gpr += 2;	}	/* PCM Center Playback (independent from stereo mix) */	A_OP(icode, &ptr, iMAC0, A_GPR(playback+4), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_CENTER));	snd_emu10k1_init_mono_control(&controls[nctl++], "PCM Center Playback Volume", gpr, 100);	gpr++;	/* PCM LFE Playback (independent from stereo mix) */	A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LFE));	snd_emu10k1_init_mono_control(&controls[nctl++], "PCM LFE Playback Volume", gpr, 100);	gpr++;		/*	 * Stereo Mix	 */	/* Wave (PCM) Playback Volume (will be renamed later) */	A_OP(icode, &ptr, iMAC0, A_GPR(stereo_mix), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT));	A_OP(icode, &ptr, iMAC0, A_GPR(stereo_mix+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT));	snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Playback Volume", gpr, 100);	gpr += 2;	/* Synth Playback */	A_OP(icode, &ptr, iMAC0, A_GPR(stereo_mix+0), A_GPR(stereo_mix+0), A_GPR(gpr), A_FXBUS(FXBUS_MIDI_LEFT));	A_OP(icode, &ptr, iMAC0, A_GPR(stereo_mix+1), A_GPR(stereo_mix+1), A_GPR(gpr+1), A_FXBUS(FXBUS_MIDI_RIGHT));	snd_emu10k1_init_stereo_control(&controls[nctl++], "Synth Playback Volume", gpr, 100);	gpr += 2;	/* Wave (PCM) Capture */	A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT));	A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT));	snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Capture Volume", gpr, 0);	gpr += 2;	/* Synth Capture */	A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_GPR(capture+0), A_GPR(gpr), A_FXBUS(FXBUS_MIDI_LEFT));	A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+1), A_FXBUS(FXBUS_MIDI_RIGHT));	snd_emu10k1_init_stereo_control(&controls[nctl++], "Synth Capture Volume", gpr, 0);	gpr += 2;	/*	 * inputs	 */#define A_ADD_VOLUME_IN(var,vol,input) \A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))	/* AC'97 Playback Volume - used only for mic (renamed later) */	A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_AC97_L);	A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_AC97_R);	snd_emu10k1_init_stereo_control(&controls[nctl++], "AMic Playback Volume", gpr, 0);	gpr += 2;	/* AC'97 Capture Volume - used only for mic */	A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_AC97_L);	A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_AC97_R);	snd_emu10k1_init_stereo_control(&controls[nctl++], "Mic Capture Volume", gpr, 0);	gpr += 2;	/* mic capture buffer */		A_OP(icode, &ptr, iINTERP, A_EXTOUT(A_EXTOUT_MIC_CAP), A_EXTIN(A_EXTIN_AC97_L), 0xcd, A_EXTIN(A_EXTIN_AC97_R));	/* Audigy CD Playback Volume */	A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_SPDIF_CD_L);	A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_SPDIF_CD_R);	snd_emu10k1_init_stereo_control(&controls[nctl++],					emu->card_capabilities->ac97_chip ? "Audigy CD Playback Volume" : "CD Playback Volume",					gpr, 0);	gpr += 2;	/* Audigy CD Capture Volume */	A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_SPDIF_CD_L);	A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_SPDIF_CD_R);	snd_emu10k1_init_stereo_control(&controls[nctl++],					emu->card_capabilities->ac97_chip ? "Audigy CD Capture Volume" : "CD Capture Volume",					gpr, 0);	gpr += 2; 	/* Optical SPDIF Playback Volume */	A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L);	A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R);	snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",PLAYBACK,VOLUME), gpr, 0);	gpr += 2;	/* Optical SPDIF Capture Volume */	A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L);	A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R);	snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",CAPTURE,VOLUME), gpr, 0);	gpr += 2;	/* Line2 Playback Volume */	A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_LINE2_L);	A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_LINE2_R);	snd_emu10k1_init_stereo_control(&controls[nctl++],					emu->card_capabilities->ac97_chip ? "Line2 Playback Volume" : "Line Playback Volume",					gpr, 0);	gpr += 2;	/* Line2 Capture Volume */	A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_LINE2_L);	A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_LINE2_R);	snd_emu10k1_init_stereo_control(&controls[nctl++],					emu->card_capabilities->ac97_chip ? "Line2 Capture Volume" : "Line Capture Volume",					gpr, 0);	gpr += 2;        	/* Philips ADC Playback Volume */	A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_ADC_L);	A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_ADC_R);	snd_emu10k1_init_stereo_control(&controls[nctl++], "Analog Mix Playback Volume", gpr, 0);	gpr += 2;	/* Philips ADC Capture Volume */	A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_ADC_L);	A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_ADC_R);	snd_emu10k1_init_stereo_control(&controls[nctl++], "Analog Mix Capture Volume", gpr, 0);	gpr += 2;	/* Aux2 Playback Volume */	A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_AUX2_L);	A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_AUX2_R);	snd_emu10k1_init_stereo_control(&controls[nctl++],					emu->card_capabilities->ac97_chip ? "Aux2 Playback Volume" : "Aux Playback Volume",					gpr, 0);	gpr += 2;	/* Aux2 Capture Volume */	A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_AUX2_L);	A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_AUX2_R);	snd_emu10k1_init_stereo_control(&controls[nctl++],					emu->card_capabilities->ac97_chip ? "Aux2 Capture Volume" : "Aux Capture Volume",					gpr, 0);	gpr += 2;		/* Stereo Mix Front Playback Volume */	A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_GPR(playback), A_GPR(gpr), A_GPR(stereo_mix));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_GPR(playback+1), A_GPR(gpr+1), A_GPR(stereo_mix+1));	snd_emu10k1_init_stereo_control(&controls[nctl++], "Front Playback Volume", gpr, 100);	gpr += 2;		/* Stereo Mix Surround Playback */	A_OP(icode, &ptr, iMAC0, A_GPR(playback+2), A_GPR(playback+2), A_GPR(gpr), A_GPR(stereo_mix));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+3), A_GPR(playback+3), A_GPR(gpr+1), A_GPR(stereo_mix+1));	snd_emu10k1_init_stereo_control(&controls[nctl++], "Surround Playback Volume", gpr, 0);	gpr += 2;	/* Stereo Mix Center Playback */	/* Center = sub = Left/2 + Right/2 */	A_OP(icode, &ptr, iINTERP, A_GPR(tmp), A_GPR(stereo_mix), 0xcd, A_GPR(stereo_mix+1));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+4), A_GPR(playback+4), A_GPR(gpr), A_GPR(tmp));	snd_emu10k1_init_mono_control(&controls[nctl++], "Center Playback Volume", gpr, 0);	gpr++;	/* Stereo Mix LFE Playback */	A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_GPR(playback+5), A_GPR(gpr), A_GPR(tmp));	snd_emu10k1_init_mono_control(&controls[nctl++], "LFE Playback Volume", gpr, 0);	gpr++;		if (emu->card_capabilities->spk71) {		/* Stereo Mix Side Playback */		A_OP(icode, &ptr, iMAC0, A_GPR(playback+6), A_GPR(playback+6), A_GPR(gpr), A_GPR(stereo_mix));		A_OP(icode, &ptr, iMAC0, A_GPR(playback+7), A_GPR(playback+7), A_GPR(gpr+1), A_GPR(stereo_mix+1));		snd_emu10k1_init_stereo_control(&controls[nctl++], "Side Playback Volume", gpr, 0);		gpr += 2;	}	/*	 * outputs	 */#define A_PUT_OUTPUT(out,src) A_OP(icode, &ptr, iACC3, A_EXTOUT(out), A_C_00000000, A_C_00000000, A_GPR(src))#define A_PUT_STEREO_OUTPUT(out1,out2,src) \	{A_PUT_OUTPUT(out1,src); A_PUT_OUTPUT(out2,src+1);}#define _A_SWITCH(icode, ptr, dst, src, sw) \	A_OP((icode), ptr, iMACINT0, dst, A_C_00000000, src, sw);#define A_SWITCH(icode, ptr, dst, src, sw) \		_A_SWITCH(icode, ptr, A_GPR(dst), A_GPR(src), A_GPR(sw))#define _A_SWITCH_NEG(icode, ptr, dst, src) \	A_OP((icode), ptr, iANDXOR, dst, src, A_C_00000001, A_C_00000001);#define A_SWITCH_NEG(icode, ptr, dst, src) \		_A_SWITCH_NEG(icode, ptr, A_GPR(dst), A_GPR(src))	/*	 *  Process tone control	 */	A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 0), A_GPR(playback + 0), A_C_00000000, A_C_00000000); /* left */	A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 1), A_GPR(playback + 1), A_C_00000000, A_C_00000000); /* right */	A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 2), A_GPR(playback + 2), A_C_00000000, A_C_00000000); /* rear left */	A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 3), A_GPR(playback + 3), A_C_00000000, A_C_00000000); /* rear right */	A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 4), A_GPR(playback + 4), A_C_00000000, A_C_00000000); /* center */	A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), A_GPR(playback + 5), A_C_00000000, A_C_00000000); /* LFE */	if (emu->card_capabilities->spk71) {		A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 6), A_GPR(playback + 6), A_C_00000000, A_C_00000000); /* side left */		A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 7), A_GPR(playback + 7), A_C_00000000, A_C_00000000); /* side right */	}		ctl = &controls[nctl + 0];	ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;	strcpy(ctl->id.name, "Tone Control - Bass");	ctl->vcount = 2;	ctl->count = 10;	ctl->min = 0;	ctl->max = 40;	ctl->value[0] = ctl->value[1] = 20;	ctl->translation = EMU10K1_GPR_TRANSLATION_BASS;	ctl = &controls[nctl + 1];	ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;	strcpy(ctl->id.name, "Tone Control - Treble");	ctl->vcount = 2;	ctl->count = 10;	ctl->min = 0;	ctl->max = 40;	ctl->value[0] = ctl->value[1] = 20;	ctl->translation = EMU10K1_GPR_TRANSLATION_TREBLE;#define BASS_GPR	0x8c#define TREBLE_GPR	0x96	for (z = 0; z < 5; z++) {		int j;		for (j = 0; j < 2; j++) {			controls[nctl + 0].gpr[z * 2 + j] = BASS_GPR + z * 2 + j;			controls[nctl + 1].gpr[z * 2 + j] = TREBLE_GPR + z * 2 + j;		}	}	for (z = 0; z < 4; z++) {		/* front/rear/center-lfe/side */		int j, k, l, d;		for (j = 0; j < 2; j++) {	/* left/right */			k = 0xb0 + (z * 8) + (j * 4);			l = 0xe0 + (z * 8) + (j * 4);			d = playback + SND_EMU10K1_PLAYBACK_CHANNELS + z * 2 + j;			A_OP(icode, &ptr, iMAC0, A_C_00000000, A_C_00000000, A_GPR(d), A_GPR(BASS_GPR + 0 + j));			A_OP(icode, &ptr, iMACMV, A_GPR(k+1), A_GPR(k), A_GPR(k+1), A_GPR(BASS_GPR + 4 + j));			A_OP(icode, &ptr, iMACMV, A_GPR(k), A_GPR(d), A_GPR(k), A_GPR(BASS_GPR + 2 + j));			A_OP(icode, &ptr, iMACMV, A_GPR(k+3), A_GPR(k+2), A_GPR(k+3), A_GPR(BASS_GPR + 8 + j));			A_OP(icode, &ptr, iMAC0, A_GPR(k+2), A_GPR_ACCU, A_GPR(k+2), A_GPR(BASS_GPR + 6 + j));			A_OP(icode, &ptr, iACC3, A_GPR(k+2), A_GPR(k+2), A_GPR(k+2), A_C_00000000);			A_OP(icode, &ptr, iMAC0, A_C_00000000, A_C_00000000, A_GPR(k+2), A_GPR(TREBLE_GPR + 0 + j));			A_OP(icode, &ptr, iMACMV, A_GPR(l+1), A_GPR(l), A_GPR(l+1), A_GPR(TREBLE_GPR + 4 + j));			A_OP(icode, &ptr, iMACMV, A_GPR(l), A_GPR(k+2), A_GPR(l), A_GPR(TREBLE_GPR + 2 + j));			A_OP(icode, &ptr, iMACMV, A_GPR(l+3), A_GPR(l+2), A_GPR(l+3), A_GPR(TREBLE_GPR + 8 + j));			A_OP(icode, &ptr, iMAC0, A_GPR(l+2), A_GPR_ACCU, A_GPR(l+2), A_GPR(TREBLE_GPR + 6 + j));			A_OP(icode, &ptr, iMACINT0, A_GPR(l+2), A_C_00000000, A_GPR(l+2), A_C_00000010);			A_OP(icode, &ptr, iACC3, A_GPR(d), A_GPR(l+2), A_C_00000000, A_C_00000000);			if (z == 2)	/* center */				break;		}	}	nctl += 2;#undef BASS_GPR#undef TREBLE_GPR	for (z = 0; z < 8; z++) {		A_SWITCH(icode, &ptr, tmp + 0, playback + SND_EMU10K1_PLAYBACK_CHANNELS + z, gpr + 0);		A_SWITCH_NEG(icode, &ptr, tmp + 1, gpr + 0);		A_SWITCH(icode, &ptr, tmp + 1, playback + z, tmp + 1);		A_OP(icode, &ptr, iACC3, A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + z), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000);	}	snd_emu10k1_init_stereo_onoff_control(controls + nctl++, "Tone Control - Switch", gpr, 0);	gpr += 2;	/* Master volume (will be renamed later) */	A_OP(icode, &ptr, iMAC0, A_GPR(playback+0+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+0+SND_EMU10K1_PLAYBACK_CHANNELS));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+2+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+2+SND_EMU10K1_PLAYBACK_CHANNELS));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+3+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+3+SND_EMU10K1_PLAYBACK_CHANNELS));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+4+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+4+SND_EMU10K1_PLAYBACK_CHANNELS));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+5+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+5+SND_EMU10K1_PLAYBACK_CHANNELS));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+6+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+6+SND_EMU10K1_PLAYBACK_CHANNELS));	A_OP(icode, &ptr, iMAC0, A_GPR(playback+7+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+7+SND_EMU10K1_PLAYBACK_CHANNELS));	snd_emu10k1_init_mono_control(&controls[nctl++], "Wave Master Playback Volume", gpr, 0);	gpr += 2;	/* analog speakers */	A_PUT_STEREO_OUTPUT(A_EXTOUT_AFRONT_L, A_EXTOUT_AFRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);	A_PUT_STEREO_OUTPUT(A_EXTOUT_AREAR_L, A_EXTOUT_AREAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS);	A_PUT_OUTPUT(A_EXTOUT_ACENTER, playback+4 + SND_EMU10K1_PLAYBACK_CHANNELS);	A_PUT_OUTPUT(A_EXTOUT_ALFE, playback+5 + SND_EMU10K1_PLAYBACK_CHANNELS);	if (emu->card_capabilities->spk71)		A_PUT_STEREO_OUTPUT(A_EXTOUT_ASIDE_L, A_EXTOUT_ASIDE_R, playback+6 + SND_EMU10K1_PLAYBACK_CHANNELS);	/* headphone */	A_PUT_STEREO_OUTPUT(A_EXTOUT_HEADPHONE_L, A_EXTOUT_HEADPHONE_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);	/* digital outputs */	/* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */	/* IEC958 Optical Raw Playback Switch */ 	gpr_map[gpr++] = 0;	gpr_map[gpr++] = 0x1008;	gpr_map[gpr++] = 0xffff0000;	for (z = 0; z < 2; z++) {		A_OP(icode, &ptr, iMAC0, A_GPR(tmp + 2), A_FXBUS(FXBUS_PT_LEFT + z), A_C_00000000, A_C_00000000);		A_OP(icode, &ptr, iSKIP, A_GPR_COND, A_GPR_COND, A_GPR(gpr - 2), A_C_00000001);		A_OP(icode, &ptr, iACC3, A_GPR(tmp + 2), A_C_00000000, A_C_00010000, A_GPR(tmp + 2));		A_OP(icode, &ptr, iANDXOR, A_GPR(tmp + 2), A_GPR(tmp + 2), A_GPR(gpr - 1), A_C_00000000);		A_SWITCH(icode, &ptr, tmp + 0, tmp + 2, gpr + z);		A_SWITCH_NEG(icode, &ptr, tmp + 1, gpr + z);		A_SWITCH(icode, &ptr, tmp + 1, playback + SND_EMU10K1_PLAYBACK_CHANNELS + z, tmp + 1);		if ((z==1) && (emu->card_capabilities->spdif_bug)) {			/* Due to a SPDIF output bug on some Audigy cards, this code delays the Right channel by 1 sample */			snd_printk("Installing spdif_bug patch: %s\n", emu->card_capabilities->name);			A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(gpr - 3), A_C_00000000, A_C_00000000);			A_OP(icode, &ptr, iACC3, A_GPR(gpr - 3), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000);		} else {			A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000);		}	}	snd_emu10k1_init_stereo_onoff_control(controls + nctl++, SNDRV_CTL_NAME_IEC958("Optical Raw ",PLAYBACK,SWITCH), gpr, 0);	gpr += 2;		A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS);	A_PUT_OUTPUT(A_EXTOUT_CENTER, playback+4 + SND_EMU10K1_PLAYBACK_CHANNELS);	A_PUT_OUTPUT(A_EXTOUT_LFE, playback+5 + SND_EMU10K1_PLAYBACK_CHANNELS);	/* ADC buffer */#ifdef EMU10K1_CAPTURE_DIGITAL_OUT	A_PUT_STEREO_OUTPUT(A_EXTOUT_ADC_CAP_L, A_EXTOUT_ADC_CAP_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);#else	A_PUT_OUTPUT(A_EXTOUT_ADC_CAP_L, capture);	A_PUT_OUTPUT(A_EXTOUT_ADC_CAP_R, capture+1);#endif	/* EFX capture - capture the 16 EXTINs */	for (z = 0; z < 16; z++) {		A_OP(icode, &ptr, iACC3, A_FXBUS2(z), A_C_00000000, A_C_00000000, A_EXTIN(z));	}		/*	 * ok, set up done..	 */	if (gpr > tmp) {		snd_BUG();		err = -EIO;		goto __err;	}	/* clear remaining instruction memory */	while (ptr < 0x400)		A_OP(icode, &ptr, 0x0f, 0xc0, 0xc0, 0xcf, 0xc0);	seg = snd_enter_user();	icode->gpr_add_control_count = nctl;	icode->gpr_add_controls = (emu10k1_fx8010_control_gpr_t __user *)controls;	err = snd_emu10k1_icode_poke(emu, icode);	snd_leave_user(seg); __err:	kfree(controls);	if (icode != NULL) {		kfree((void __force *)icode->gpr_map);		kfree(icode);	}	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/99b359ba10a582148c6725f428a33ba5356dd993/emufx.c/buggy/sound/pci/emu10k1/emufx.c