X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=sound%2Fpci%2Fmaestro3.c;h=87fae627b80168c0cc938d94826042096ec55c5e;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=8cf0e185df73c1ad2bf686ab40e68f4ec77d9c8d;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 8cf0e185d..87fae627b 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -62,17 +62,16 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */ static int external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; -static int boot_devs; -module_param_array(index, int, boot_devs, 0444); +module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); -module_param_array(id, charp, boot_devs, 0444); +module_param_array(id, charp, NULL, 0444); MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); -module_param_array(enable, bool, boot_devs, 0444); +module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable this soundcard."); -module_param_array(external_amp, bool, boot_devs, 0444); +module_param_array(external_amp, bool, NULL, 0444); MODULE_PARM_DESC(external_amp, "Enable external amp for " CARD_NAME " soundcard."); -module_param_array(amp_gpio, int, boot_devs, 0444); +module_param_array(amp_gpio, int, NULL, 0444); MODULE_PARM_DESC(amp_gpio, "GPIO pin number for external amp. (default = -1)"); #define MAX_PLAYBACKS 2 @@ -1836,34 +1835,24 @@ static unsigned short snd_m3_ac97_read(ac97_t *ac97, unsigned short reg) { m3_t *chip = ac97->private_data; - unsigned short ret = 0; - unsigned long flags; - spin_lock_irqsave(&chip->reg_lock, flags); if (snd_m3_ac97_wait(chip)) - goto __error; - snd_m3_outb(chip, 0x80 | (reg & 0x7f), 0x30); + return 0xffff; + snd_m3_outb(chip, 0x80 | (reg & 0x7f), CODEC_COMMAND); if (snd_m3_ac97_wait(chip)) - goto __error; - ret = snd_m3_inw(chip, 0x32); -__error: - spin_unlock_irqrestore(&chip->reg_lock, flags); - return ret; + return 0xffff; + return snd_m3_inw(chip, CODEC_DATA); } static void snd_m3_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) { m3_t *chip = ac97->private_data; - unsigned long flags; - spin_lock_irqsave(&chip->reg_lock, flags); if (snd_m3_ac97_wait(chip)) - goto __error; - snd_m3_outw(chip, val, 0x32); - snd_m3_outb(chip, reg & 0x7f, 0x30); -__error: - spin_unlock_irqrestore(&chip->reg_lock, flags); + return; + snd_m3_outw(chip, val, CODEC_DATA); + snd_m3_outb(chip, reg & 0x7f, CODEC_COMMAND); } @@ -2375,8 +2364,7 @@ static int snd_m3_free(m3_t *chip) } #ifdef CONFIG_PM - if (chip->suspend_mem) - vfree(chip->suspend_mem); + vfree(chip->suspend_mem); #endif if (chip->irq >= 0) { @@ -2387,6 +2375,7 @@ static int snd_m3_free(m3_t *chip) if (chip->iobase) pci_release_regions(chip->pci); + pci_disable_device(chip->pci); kfree(chip); return 0; } @@ -2423,7 +2412,8 @@ static int m3_suspend(snd_card_t *card, unsigned int state) /* power down apci registers */ snd_m3_outw(chip, 0xffff, 0x54); snd_m3_outw(chip, 0xffff, 0x56); - snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + + pci_disable_device(chip->pci); return 0; } @@ -2435,6 +2425,7 @@ static int m3_resume(snd_card_t *card, unsigned int state) if (chip->suspend_mem == NULL) return 0; + pci_enable_device(chip->pci); pci_set_master(chip->pci); /* first lets just bring everything back. .*/ @@ -2465,7 +2456,6 @@ static int m3_resume(snd_card_t *card, unsigned int state) snd_m3_enable_ints(chip); snd_m3_amp_enable(chip, 1); - snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; } #endif /* CONFIG_PM */ @@ -2503,12 +2493,15 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { snd_printk("architecture does not support 28bit PCI busmaster DMA\n"); + pci_disable_device(pci); return -ENXIO; } chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); - if (chip == NULL) + if (chip == NULL) { + pci_disable_device(pci); return -ENOMEM; + } spin_lock_init(&chip->reg_lock); switch (pci->device) { @@ -2550,6 +2543,7 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, chip->substreams = kmalloc(sizeof(m3_dma_t) * chip->num_substreams, GFP_KERNEL); if (chip->substreams == NULL) { kfree(chip); + pci_disable_device(pci); return -ENOMEM; } memset(chip->substreams, 0, sizeof(m3_dma_t) * chip->num_substreams); @@ -2570,26 +2564,7 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, snd_m3_assp_init(chip); snd_m3_amp_enable(chip, 1); - - if ((err = snd_m3_mixer(chip)) < 0) { - snd_m3_free(chip); - return err; - } - for (i = 0; i < chip->num_substreams; i++) { - m3_dma_t *s = &chip->substreams[i]; - s->chip = chip; - if ((err = snd_m3_assp_client_init(chip, s, i)) < 0) { - snd_m3_free(chip); - return err; - } - } - - if ((err = snd_m3_pcm(chip, 0)) < 0) { - snd_m3_free(chip); - return err; - } - if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ, card->driver, (void *)chip)) { snd_printk("unable to grab IRQ %d\n", pci->irq); @@ -2611,6 +2586,19 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, return err; } + if ((err = snd_m3_mixer(chip)) < 0) + return err; + + for (i = 0; i < chip->num_substreams; i++) { + m3_dma_t *s = &chip->substreams[i]; + s->chip = chip; + if ((err = snd_m3_assp_client_init(chip, s, i)) < 0) + return err; + } + + if ((err = snd_m3_pcm(chip, 0)) < 0) + return err; + snd_m3_enable_ints(chip); snd_m3_assp_continue(chip);