diff options
Diffstat (limited to 'sound/pci/nm256/nm256.c')
-rw-r--r-- | sound/pci/nm256/nm256.c | 100 |
1 files changed, 47 insertions, 53 deletions
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index d0da9a53de03..cccdc576b8a3 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -52,41 +52,44 @@ MODULE_SUPPORTED_DEVICE("{{NeoMagic,NM256AV}," | |||
52 | * some compile conditions. | 52 | * some compile conditions. |
53 | */ | 53 | */ |
54 | 54 | ||
55 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 55 | static int index = SNDRV_DEFAULT_IDX1; /* Index */ |
56 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 56 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
57 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | 57 | static int playback_bufsize = 16; |
58 | static int playback_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 16}; | 58 | static int capture_bufsize = 16; |
59 | static int capture_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 16}; | 59 | static int force_ac97; /* disabled as default */ |
60 | static int force_ac97[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* disabled as default */ | 60 | static int buffer_top; /* not specified */ |
61 | static int buffer_top[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* not specified */ | 61 | static int use_cache; /* disabled */ |
62 | static int use_cache[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* disabled */ | 62 | static int vaio_hack; /* disabled */ |
63 | static int vaio_hack[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* disabled */ | 63 | static int reset_workaround; |
64 | static int reset_workaround[SNDRV_CARDS]; | 64 | static int reset_workaround_2; |
65 | static int reset_workaround_2[SNDRV_CARDS]; | 65 | |
66 | 66 | module_param(index, int, 0444); | |
67 | module_param_array(index, int, NULL, 0444); | ||
68 | MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); | 67 | MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); |
69 | module_param_array(id, charp, NULL, 0444); | 68 | module_param(id, charp, 0444); |
70 | MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); | 69 | MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); |
71 | module_param_array(enable, bool, NULL, 0444); | 70 | module_param(playback_bufsize, int, 0444); |
72 | MODULE_PARM_DESC(enable, "Enable this soundcard."); | ||
73 | module_param_array(playback_bufsize, int, NULL, 0444); | ||
74 | MODULE_PARM_DESC(playback_bufsize, "DAC frame size in kB for " CARD_NAME " soundcard."); | 71 | MODULE_PARM_DESC(playback_bufsize, "DAC frame size in kB for " CARD_NAME " soundcard."); |
75 | module_param_array(capture_bufsize, int, NULL, 0444); | 72 | module_param(capture_bufsize, int, 0444); |
76 | MODULE_PARM_DESC(capture_bufsize, "ADC frame size in kB for " CARD_NAME " soundcard."); | 73 | MODULE_PARM_DESC(capture_bufsize, "ADC frame size in kB for " CARD_NAME " soundcard."); |
77 | module_param_array(force_ac97, bool, NULL, 0444); | 74 | module_param(force_ac97, bool, 0444); |
78 | MODULE_PARM_DESC(force_ac97, "Force to use AC97 codec for " CARD_NAME " soundcard."); | 75 | MODULE_PARM_DESC(force_ac97, "Force to use AC97 codec for " CARD_NAME " soundcard."); |
79 | module_param_array(buffer_top, int, NULL, 0444); | 76 | module_param(buffer_top, int, 0444); |
80 | MODULE_PARM_DESC(buffer_top, "Set the top address of audio buffer for " CARD_NAME " soundcard."); | 77 | MODULE_PARM_DESC(buffer_top, "Set the top address of audio buffer for " CARD_NAME " soundcard."); |
81 | module_param_array(use_cache, bool, NULL, 0444); | 78 | module_param(use_cache, bool, 0444); |
82 | MODULE_PARM_DESC(use_cache, "Enable the cache for coefficient table access."); | 79 | MODULE_PARM_DESC(use_cache, "Enable the cache for coefficient table access."); |
83 | module_param_array(vaio_hack, bool, NULL, 0444); | 80 | module_param(vaio_hack, bool, 0444); |
84 | MODULE_PARM_DESC(vaio_hack, "Enable workaround for Sony VAIO notebooks."); | 81 | MODULE_PARM_DESC(vaio_hack, "Enable workaround for Sony VAIO notebooks."); |
85 | module_param_array(reset_workaround, bool, NULL, 0444); | 82 | module_param(reset_workaround, bool, 0444); |
86 | MODULE_PARM_DESC(reset_workaround, "Enable AC97 RESET workaround for some laptops."); | 83 | MODULE_PARM_DESC(reset_workaround, "Enable AC97 RESET workaround for some laptops."); |
87 | module_param_array(reset_workaround_2, bool, NULL, 0444); | 84 | module_param(reset_workaround_2, bool, 0444); |
88 | MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops."); | 85 | MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops."); |
89 | 86 | ||
87 | /* just for backward compatibility */ | ||
88 | static int enable; | ||
89 | module_param(enable, bool, 0444); | ||
90 | |||
91 | |||
92 | |||
90 | /* | 93 | /* |
91 | * hw definitions | 94 | * hw definitions |
92 | */ | 95 | */ |
@@ -1561,7 +1564,6 @@ static struct nm256_quirk nm256_quirks[] __devinitdata = { | |||
1561 | static int __devinit snd_nm256_probe(struct pci_dev *pci, | 1564 | static int __devinit snd_nm256_probe(struct pci_dev *pci, |
1562 | const struct pci_device_id *pci_id) | 1565 | const struct pci_device_id *pci_id) |
1563 | { | 1566 | { |
1564 | static int dev; | ||
1565 | snd_card_t *card; | 1567 | snd_card_t *card; |
1566 | nm256_t *chip; | 1568 | nm256_t *chip; |
1567 | int err; | 1569 | int err; |
@@ -1569,13 +1571,6 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1569 | struct nm256_quirk *q; | 1571 | struct nm256_quirk *q; |
1570 | u16 subsystem_vendor, subsystem_device; | 1572 | u16 subsystem_vendor, subsystem_device; |
1571 | 1573 | ||
1572 | if (dev >= SNDRV_CARDS) | ||
1573 | return -ENODEV; | ||
1574 | if (!enable[dev]) { | ||
1575 | dev++; | ||
1576 | return -ENOENT; | ||
1577 | } | ||
1578 | |||
1579 | pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor); | 1574 | pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor); |
1580 | pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsystem_device); | 1575 | pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsystem_device); |
1581 | 1576 | ||
@@ -1586,16 +1581,16 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1586 | printk(KERN_INFO "nm256: The device is blacklisted. Loading stopped\n"); | 1581 | printk(KERN_INFO "nm256: The device is blacklisted. Loading stopped\n"); |
1587 | return -ENODEV; | 1582 | return -ENODEV; |
1588 | case NM_RESET_WORKAROUND_2: | 1583 | case NM_RESET_WORKAROUND_2: |
1589 | reset_workaround_2[dev] = 1; | 1584 | reset_workaround_2 = 1; |
1590 | /* Fall-through */ | 1585 | /* Fall-through */ |
1591 | case NM_RESET_WORKAROUND: | 1586 | case NM_RESET_WORKAROUND: |
1592 | reset_workaround[dev] = 1; | 1587 | reset_workaround = 1; |
1593 | break; | 1588 | break; |
1594 | } | 1589 | } |
1595 | } | 1590 | } |
1596 | } | 1591 | } |
1597 | 1592 | ||
1598 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1593 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1599 | if (card == NULL) | 1594 | if (card == NULL) |
1600 | return -ENOMEM; | 1595 | return -ENOMEM; |
1601 | 1596 | ||
@@ -1615,36 +1610,36 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1615 | return -EINVAL; | 1610 | return -EINVAL; |
1616 | } | 1611 | } |
1617 | 1612 | ||
1618 | if (vaio_hack[dev]) | 1613 | if (vaio_hack) |
1619 | xbuffer_top = 0x25a800; /* this avoids conflicts with XFree86 server */ | 1614 | xbuffer_top = 0x25a800; /* this avoids conflicts with XFree86 server */ |
1620 | else | 1615 | else |
1621 | xbuffer_top = buffer_top[dev]; | 1616 | xbuffer_top = buffer_top; |
1622 | 1617 | ||
1623 | if (playback_bufsize[dev] < 4) | 1618 | if (playback_bufsize < 4) |
1624 | playback_bufsize[dev] = 4; | 1619 | playback_bufsize = 4; |
1625 | if (playback_bufsize[dev] > 128) | 1620 | if (playback_bufsize > 128) |
1626 | playback_bufsize[dev] = 128; | 1621 | playback_bufsize = 128; |
1627 | if (capture_bufsize[dev] < 4) | 1622 | if (capture_bufsize < 4) |
1628 | capture_bufsize[dev] = 4; | 1623 | capture_bufsize = 4; |
1629 | if (capture_bufsize[dev] > 128) | 1624 | if (capture_bufsize > 128) |
1630 | capture_bufsize[dev] = 128; | 1625 | capture_bufsize = 128; |
1631 | if ((err = snd_nm256_create(card, pci, | 1626 | if ((err = snd_nm256_create(card, pci, |
1632 | playback_bufsize[dev] * 1024, /* in bytes */ | 1627 | playback_bufsize * 1024, /* in bytes */ |
1633 | capture_bufsize[dev] * 1024, /* in bytes */ | 1628 | capture_bufsize * 1024, /* in bytes */ |
1634 | force_ac97[dev], | 1629 | force_ac97, |
1635 | xbuffer_top, | 1630 | xbuffer_top, |
1636 | use_cache[dev], | 1631 | use_cache, |
1637 | &chip)) < 0) { | 1632 | &chip)) < 0) { |
1638 | snd_card_free(card); | 1633 | snd_card_free(card); |
1639 | return err; | 1634 | return err; |
1640 | } | 1635 | } |
1641 | 1636 | ||
1642 | if (reset_workaround[dev]) { | 1637 | if (reset_workaround) { |
1643 | snd_printdd(KERN_INFO "nm256: reset_workaround activated\n"); | 1638 | snd_printdd(KERN_INFO "nm256: reset_workaround activated\n"); |
1644 | chip->reset_workaround = 1; | 1639 | chip->reset_workaround = 1; |
1645 | } | 1640 | } |
1646 | 1641 | ||
1647 | if (reset_workaround_2[dev]) { | 1642 | if (reset_workaround_2) { |
1648 | snd_printdd(KERN_INFO "nm256: reset_workaround_2 activated\n"); | 1643 | snd_printdd(KERN_INFO "nm256: reset_workaround_2 activated\n"); |
1649 | chip->reset_workaround_2 = 1; | 1644 | chip->reset_workaround_2 = 1; |
1650 | } | 1645 | } |
@@ -1666,7 +1661,6 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1666 | } | 1661 | } |
1667 | 1662 | ||
1668 | pci_set_drvdata(pci, card); | 1663 | pci_set_drvdata(pci, card); |
1669 | dev++; | ||
1670 | return 0; | 1664 | return 0; |
1671 | } | 1665 | } |
1672 | 1666 | ||