virtuoso.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * C-Media CMI8788 driver for Asus Xonar cards
  3. *
  4. * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
  5. *
  6. *
  7. * This driver is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License, version 2.
  9. *
  10. * This driver is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this driver; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <linux/pci.h>
  20. #include <linux/delay.h>
  21. #include <linux/module.h>
  22. #include <sound/core.h>
  23. #include <sound/initval.h>
  24. #include <sound/pcm.h>
  25. #include "xonar.h"
  26. MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
  27. MODULE_DESCRIPTION("Asus Virtuoso driver");
  28. MODULE_LICENSE("GPL v2");
  29. MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}");
  30. static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
  31. static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
  32. static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
  33. module_param_array(index, int, NULL, 0444);
  34. MODULE_PARM_DESC(index, "card index");
  35. module_param_array(id, charp, NULL, 0444);
  36. MODULE_PARM_DESC(id, "ID string");
  37. module_param_array(enable, bool, NULL, 0444);
  38. MODULE_PARM_DESC(enable, "enable card");
  39. static const struct pci_device_id xonar_ids[] = {
  40. { OXYGEN_PCI_SUBID(0x1043, 0x8269) },
  41. { OXYGEN_PCI_SUBID(0x1043, 0x8275) },
  42. { OXYGEN_PCI_SUBID(0x1043, 0x82b7) },
  43. { OXYGEN_PCI_SUBID(0x1043, 0x8314) },
  44. { OXYGEN_PCI_SUBID(0x1043, 0x8327) },
  45. { OXYGEN_PCI_SUBID(0x1043, 0x834f) },
  46. { OXYGEN_PCI_SUBID(0x1043, 0x835c) },
  47. { OXYGEN_PCI_SUBID(0x1043, 0x835d) },
  48. { OXYGEN_PCI_SUBID(0x1043, 0x835e) },
  49. { OXYGEN_PCI_SUBID(0x1043, 0x838e) },
  50. { OXYGEN_PCI_SUBID(0x1043, 0x8428) },
  51. { OXYGEN_PCI_SUBID(0x1043, 0x8522) },
  52. { OXYGEN_PCI_SUBID(0x1043, 0x85f4) },
  53. { OXYGEN_PCI_SUBID_BROKEN_EEPROM },
  54. { }
  55. };
  56. MODULE_DEVICE_TABLE(pci, xonar_ids);
  57. static int get_xonar_model(struct oxygen *chip,
  58. const struct pci_device_id *id)
  59. {
  60. if (get_xonar_pcm179x_model(chip, id) >= 0)
  61. return 0;
  62. if (get_xonar_cs43xx_model(chip, id) >= 0)
  63. return 0;
  64. if (get_xonar_wm87x6_model(chip, id) >= 0)
  65. return 0;
  66. return -EINVAL;
  67. }
  68. static int xonar_probe(struct pci_dev *pci,
  69. const struct pci_device_id *pci_id)
  70. {
  71. static int dev;
  72. int err;
  73. if (dev >= SNDRV_CARDS)
  74. return -ENODEV;
  75. if (!enable[dev]) {
  76. ++dev;
  77. return -ENOENT;
  78. }
  79. err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE,
  80. xonar_ids, get_xonar_model);
  81. if (err >= 0)
  82. ++dev;
  83. return err;
  84. }
  85. static struct pci_driver xonar_driver = {
  86. .name = KBUILD_MODNAME,
  87. .id_table = xonar_ids,
  88. .probe = xonar_probe,
  89. .remove = oxygen_pci_remove,
  90. #ifdef CONFIG_PM_SLEEP
  91. .driver = {
  92. .pm = &oxygen_pci_pm,
  93. },
  94. #endif
  95. .shutdown = oxygen_pci_shutdown,
  96. };
  97. module_pci_driver(xonar_driver);