0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/pci.h>
0009 #include <linux/delay.h>
0010 #include <linux/module.h>
0011 #include <sound/core.h>
0012 #include <sound/initval.h>
0013 #include <sound/pcm.h>
0014 #include "xonar.h"
0015
0016 MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
0017 MODULE_DESCRIPTION("Asus Virtuoso driver");
0018 MODULE_LICENSE("GPL v2");
0019
0020 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
0021 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
0022 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
0023
0024 module_param_array(index, int, NULL, 0444);
0025 MODULE_PARM_DESC(index, "card index");
0026 module_param_array(id, charp, NULL, 0444);
0027 MODULE_PARM_DESC(id, "ID string");
0028 module_param_array(enable, bool, NULL, 0444);
0029 MODULE_PARM_DESC(enable, "enable card");
0030
0031 static const struct pci_device_id xonar_ids[] = {
0032 { OXYGEN_PCI_SUBID(0x1043, 0x8269) },
0033 { OXYGEN_PCI_SUBID(0x1043, 0x8275) },
0034 { OXYGEN_PCI_SUBID(0x1043, 0x82b7) },
0035 { OXYGEN_PCI_SUBID(0x1043, 0x8314) },
0036 { OXYGEN_PCI_SUBID(0x1043, 0x8327) },
0037 { OXYGEN_PCI_SUBID(0x1043, 0x834f) },
0038 { OXYGEN_PCI_SUBID(0x1043, 0x835c) },
0039 { OXYGEN_PCI_SUBID(0x1043, 0x835d) },
0040 { OXYGEN_PCI_SUBID(0x1043, 0x835e) },
0041 { OXYGEN_PCI_SUBID(0x1043, 0x838e) },
0042 { OXYGEN_PCI_SUBID(0x1043, 0x8428) },
0043 { OXYGEN_PCI_SUBID(0x1043, 0x8522) },
0044 { OXYGEN_PCI_SUBID(0x1043, 0x85f4) },
0045 { OXYGEN_PCI_SUBID_BROKEN_EEPROM },
0046 { }
0047 };
0048 MODULE_DEVICE_TABLE(pci, xonar_ids);
0049
0050 static int get_xonar_model(struct oxygen *chip,
0051 const struct pci_device_id *id)
0052 {
0053 if (get_xonar_pcm179x_model(chip, id) >= 0)
0054 return 0;
0055 if (get_xonar_cs43xx_model(chip, id) >= 0)
0056 return 0;
0057 if (get_xonar_wm87x6_model(chip, id) >= 0)
0058 return 0;
0059 return -EINVAL;
0060 }
0061
0062 static int xonar_probe(struct pci_dev *pci,
0063 const struct pci_device_id *pci_id)
0064 {
0065 static int dev;
0066 int err;
0067
0068 if (dev >= SNDRV_CARDS)
0069 return -ENODEV;
0070 if (!enable[dev]) {
0071 ++dev;
0072 return -ENOENT;
0073 }
0074 err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE,
0075 xonar_ids, get_xonar_model);
0076 if (err >= 0)
0077 ++dev;
0078 return err;
0079 }
0080
0081 static struct pci_driver xonar_driver = {
0082 .name = KBUILD_MODNAME,
0083 .id_table = xonar_ids,
0084 .probe = xonar_probe,
0085 #ifdef CONFIG_PM_SLEEP
0086 .driver = {
0087 .pm = &oxygen_pci_pm,
0088 },
0089 #endif
0090 .shutdown = oxygen_pci_shutdown,
0091 };
0092
0093 module_pci_driver(xonar_driver);