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
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);
}
}
#ifdef CONFIG_PM
- if (chip->suspend_mem)
- vfree(chip->suspend_mem);
+ vfree(chip->suspend_mem);
#endif
if (chip->irq >= 0) {
if (chip->iobase)
pci_release_regions(chip->pci);
+ pci_disable_device(chip->pci);
kfree(chip);
return 0;
}
/* 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;
}
if (chip->suspend_mem == NULL)
return 0;
+ pci_enable_device(chip->pci);
pci_set_master(chip->pci);
/* first lets just bring everything back. .*/
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 */
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) {
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);
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);
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);