snd_printk("trying software reset\n"); 
snd_printk(KERN_INFO "trying software reset\n"); 
static void snd_es1968_ac97_reset(es1968_t *chip){	unsigned long ioaddr = chip->io_port;	unsigned short save_ringbus_a;	unsigned short save_68;	unsigned short w;	unsigned int vend;	/* save configuration */	save_ringbus_a = inw(ioaddr + 0x36);	//outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38); /* clear second codec id? */	/* set command/status address i/o to 1st codec */	outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a);	outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c);	/* disable ac link */	outw(0x0000, ioaddr + 0x36);	save_68 = inw(ioaddr + 0x68);	pci_read_config_word(chip->pci, 0x58, &w);	/* something magical with gpio and bus arb. */	pci_read_config_dword(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, &vend);	if (w & 1)		save_68 |= 0x10;	outw(0xfffe, ioaddr + 0x64);	/* unmask gpio 0 */	outw(0x0001, ioaddr + 0x68);	/* gpio write */	outw(0x0000, ioaddr + 0x60);	/* write 0 to gpio 0 */	udelay(20);	outw(0x0001, ioaddr + 0x60);	/* write 1 to gpio 1 */	msleep(20);	outw(save_68 | 0x1, ioaddr + 0x68);	/* now restore .. */	outw((inw(ioaddr + 0x38) & 0xfffc) | 0x1, ioaddr + 0x38);	outw((inw(ioaddr + 0x3a) & 0xfffc) | 0x1, ioaddr + 0x3a);	outw((inw(ioaddr + 0x3c) & 0xfffc) | 0x1, ioaddr + 0x3c);	/* now the second codec */	/* disable ac link */	outw(0x0000, ioaddr + 0x36);	outw(0xfff7, ioaddr + 0x64);	/* unmask gpio 3 */	save_68 = inw(ioaddr + 0x68);	outw(0x0009, ioaddr + 0x68);	/* gpio write 0 & 3 ?? */	outw(0x0001, ioaddr + 0x60);	/* write 1 to gpio */	udelay(20);	outw(0x0009, ioaddr + 0x60);	/* write 9 to gpio */	msleep(500);	//outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38);	outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a);	outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c);#if 0				/* the loop here needs to be much better if we want it.. */	snd_printk("trying software reset\n");	/* try and do a software reset */	outb(0x80 | 0x7c, ioaddr + 0x30);	for (w = 0;; w++) {		if ((inw(ioaddr + 0x30) & 1) == 0) {			if (inb(ioaddr + 0x32) != 0)				break;			outb(0x80 | 0x7d, ioaddr + 0x30);			if (((inw(ioaddr + 0x30) & 1) == 0)			    && (inb(ioaddr + 0x32) != 0))				break;			outb(0x80 | 0x7f, ioaddr + 0x30);			if (((inw(ioaddr + 0x30) & 1) == 0)			    && (inb(ioaddr + 0x32) != 0))				break;		}		if (w > 10000) {			outb(inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37);	/* do a software reset */			msleep(500);	/* oh my.. */			outb(inb(ioaddr + 0x37) & ~0x08,				ioaddr + 0x37);			udelay(1);			outw(0x80, ioaddr + 0x30);			for (w = 0; w < 10000; w++) {				if ((inw(ioaddr + 0x30) & 1) == 0)					break;			}		}	}#endif	if (vend == NEC_VERSA_SUBID1 || vend == NEC_VERSA_SUBID2) {		/* turn on external amp? */		outw(0xf9ff, ioaddr + 0x64);		outw(inw(ioaddr + 0x68) | 0x600, ioaddr + 0x68);		outw(0x0209, ioaddr + 0x60);	}	/* restore.. */	outw(save_ringbus_a, ioaddr + 0x36);	/* Turn on the 978 docking chip.	   First frob the "master output enable" bit,	   then set most of the playback volume control registers to max. */	outb(inb(ioaddr+0xc0)|(1<<5), ioaddr+0xc0);	outb(0xff, ioaddr+0xc3);	outb(0xff, ioaddr+0xc4);	outb(0xff, ioaddr+0xc6);	outb(0xff, ioaddr+0xc8);	outb(0x3f, ioaddr+0xcf);	outb(0x3f, ioaddr+0xd0);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/99b359ba10a582148c6725f428a33ba5356dd993/es1968.c/buggy/sound/pci/es1968.c