snd_printk("unable to grab IRQ %d\n", pci->irq); 
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 
static int __devinit snd_ensoniq_create(snd_card_t * card,				     struct pci_dev *pci,				     ensoniq_t ** rensoniq){	ensoniq_t *ensoniq;	unsigned short cmdw;	unsigned char cmdb;#ifdef CHIP1371	int idx;#endif	int err;	static snd_device_ops_t ops = {		.dev_free =	snd_ensoniq_dev_free,	};	*rensoniq = NULL;	if ((err = pci_enable_device(pci)) < 0)		return err;	ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL);	if (ensoniq == NULL) {		pci_disable_device(pci);		return -ENOMEM;	}	spin_lock_init(&ensoniq->reg_lock);	init_MUTEX(&ensoniq->src_mutex);	ensoniq->card = card;	ensoniq->pci = pci;	ensoniq->irq = -1;	if ((err = pci_request_regions(pci, "Ensoniq AudioPCI")) < 0) {		kfree(ensoniq);		pci_disable_device(pci);		return err;	}	ensoniq->port = pci_resource_start(pci, 0);	if (request_irq(pci->irq, snd_audiopci_interrupt, SA_INTERRUPT|SA_SHIRQ, "Ensoniq AudioPCI", (void *)ensoniq)) {		snd_printk("unable to grab IRQ %d\n", pci->irq);		snd_ensoniq_free(ensoniq);		return -EBUSY;	}	ensoniq->irq = pci->irq;#ifdef CHIP1370	if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),				16, &ensoniq->dma_bug) < 0) {		snd_printk("unable to allocate space for phantom area - dma_bug\n");		snd_ensoniq_free(ensoniq);		return -EBUSY;	}#endif	pci_set_master(pci);	pci_read_config_byte(pci, PCI_REVISION_ID, &cmdb);	ensoniq->rev = cmdb;	pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &cmdw);	ensoniq->subsystem_vendor_id = cmdw;	pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &cmdw);	ensoniq->subsystem_device_id = cmdw;#ifdef CHIP1370#if 0	ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000));#else	/* get microphone working */	ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000));#endif	ensoniq->sctrl = 0;	/* initialize the chips */	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));	outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));	outl(ES_MEM_PAGEO(ES_PAGE_ADC), ES_REG(ensoniq, MEM_PAGE));	outl(ensoniq->dma_bug.addr, ES_REG(ensoniq, PHANTOM_FRAME));	outl(0, ES_REG(ensoniq, PHANTOM_COUNT));#else	ensoniq->ctrl = 0;	ensoniq->sctrl = 0;	ensoniq->cssr = 0;	for (idx = 0; es1371_amplifier_hack[idx].svid != (unsigned short)PCI_ANY_ID; idx++)		if (ensoniq->subsystem_vendor_id == es1371_amplifier_hack[idx].svid &&		    ensoniq->subsystem_device_id == es1371_amplifier_hack[idx].sdid) {			ensoniq->ctrl |= ES_1371_GPIO_OUT(1);	/* turn amplifier on */			break;		}	/* initialize the chips */	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));	outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL));	outl(0, ES_REG(ensoniq, 1371_LEGACY));	for (idx = 0; es1371_ac97_reset_hack[idx].vid != (unsigned short)PCI_ANY_ID; idx++)		if (pci->vendor == es1371_ac97_reset_hack[idx].vid &&		    pci->device == es1371_ac97_reset_hack[idx].did &&		    ensoniq->rev == es1371_ac97_reset_hack[idx].rev) {			ensoniq->cssr |= ES_1371_ST_AC97_RST;			outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));			/* need to delay around 20ms(bleech) to give			some CODECs enough time to wakeup */			msleep(20);			break;		}	/* AC'97 warm reset to start the bitclk */	outl(ensoniq->ctrl | ES_1371_SYNC_RES, ES_REG(ensoniq, CONTROL));	inl(ES_REG(ensoniq, CONTROL));	udelay(20);	outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL));	/* Init the sample rate converter */	snd_es1371_wait_src_ready(ensoniq);		outl(ES_1371_SRC_DISABLE, ES_REG(ensoniq, 1371_SMPRATE));	for (idx = 0; idx < 0x80; idx++)		snd_es1371_src_write(ensoniq, idx, 0);	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_TRUNC_N, 16 << 4);	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_INT_REGS, 16 << 10);	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_TRUNC_N, 16 << 4);	snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_INT_REGS, 16 << 10);	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, 1 << 12);	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, 1 << 12);	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_DAC1, 1 << 12);	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_DAC1 + 1, 1 << 12);	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_DAC2, 1 << 12);	snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_DAC2 + 1, 1 << 12);	snd_es1371_adc_rate(ensoniq, 22050);	snd_es1371_dac1_rate(ensoniq, 22050);	snd_es1371_dac2_rate(ensoniq, 22050);	/* WARNING:	 * enabling the sample rate converter without properly programming	 * its parameters causes the chip to lock up (the SRC busy bit will	 * be stuck high, and I've found no way to rectify this other than	 * power cycle) - Thomas Sailer	 */	snd_es1371_wait_src_ready(ensoniq);	outl(0, ES_REG(ensoniq, 1371_SMPRATE));	/* try reset codec directly */	outl(ES_1371_CODEC_WRITE(0, 0), ES_REG(ensoniq, 1371_CODEC));#endif	outb(ensoniq->uartc = 0x00, ES_REG(ensoniq, UART_CONTROL));	outb(0x00, ES_REG(ensoniq, UART_RES));	outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));	synchronize_irq(ensoniq->irq);	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ensoniq, &ops)) < 0) {		snd_ensoniq_free(ensoniq);		return err;	}	snd_ensoniq_proc_init(ensoniq);	snd_card_set_dev(card, &pci->dev);	*rensoniq = ensoniq;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/99b359ba10a582148c6725f428a33ba5356dd993/ens1370.c/clean/sound/pci/ens1370.c