11b8ff22fSClemens Ladisch /* 21b8ff22fSClemens Ladisch * C-Media CMI8788 driver for Asus Xonar cards 31b8ff22fSClemens Ladisch * 41b8ff22fSClemens Ladisch * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 51b8ff22fSClemens Ladisch * 61b8ff22fSClemens Ladisch * 71b8ff22fSClemens Ladisch * This driver is free software; you can redistribute it and/or modify 81b8ff22fSClemens Ladisch * it under the terms of the GNU General Public License, version 2. 91b8ff22fSClemens Ladisch * 101b8ff22fSClemens Ladisch * This driver is distributed in the hope that it will be useful, 111b8ff22fSClemens Ladisch * but WITHOUT ANY WARRANTY; without even the implied warranty of 121b8ff22fSClemens Ladisch * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 131b8ff22fSClemens Ladisch * GNU General Public License for more details. 141b8ff22fSClemens Ladisch * 151b8ff22fSClemens Ladisch * You should have received a copy of the GNU General Public License 161b8ff22fSClemens Ladisch * along with this driver; if not, write to the Free Software 171b8ff22fSClemens Ladisch * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 181b8ff22fSClemens Ladisch */ 191b8ff22fSClemens Ladisch 201b8ff22fSClemens Ladisch #include <linux/pci.h> 211b8ff22fSClemens Ladisch #include <linux/delay.h> 22da155d5bSPaul Gortmaker #include <linux/module.h> 231b8ff22fSClemens Ladisch #include <sound/core.h> 241b8ff22fSClemens Ladisch #include <sound/initval.h> 251b8ff22fSClemens Ladisch #include <sound/pcm.h> 2665c3ac88SClemens Ladisch #include "xonar.h" 271b8ff22fSClemens Ladisch 281b8ff22fSClemens Ladisch MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); 2945bc307fSClemens Ladisch MODULE_DESCRIPTION("Asus Virtuoso driver"); 30d023dc0aSClemens Ladisch MODULE_LICENSE("GPL v2"); 3145bc307fSClemens Ladisch MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}"); 321b8ff22fSClemens Ladisch 331b8ff22fSClemens Ladisch static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 341b8ff22fSClemens Ladisch static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 35a67ff6a5SRusty Russell static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 361b8ff22fSClemens Ladisch 371b8ff22fSClemens Ladisch module_param_array(index, int, NULL, 0444); 381b8ff22fSClemens Ladisch MODULE_PARM_DESC(index, "card index"); 391b8ff22fSClemens Ladisch module_param_array(id, charp, NULL, 0444); 401b8ff22fSClemens Ladisch MODULE_PARM_DESC(id, "ID string"); 411b8ff22fSClemens Ladisch module_param_array(enable, bool, NULL, 0444); 421b8ff22fSClemens Ladisch MODULE_PARM_DESC(enable, "enable card"); 431b8ff22fSClemens Ladisch 44cebe41d4SAlexey Dobriyan static DEFINE_PCI_DEVICE_TABLE(xonar_ids) = { 4565c3ac88SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x8269) }, 4665c3ac88SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x8275) }, 4765c3ac88SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x82b7) }, 4865c3ac88SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x8314) }, 4965c3ac88SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x8327) }, 5065c3ac88SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x834f) }, 5165c3ac88SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x835c) }, 5265c3ac88SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x835d) }, 532b830baeSClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x835e) }, 54d1db38c0SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x838e) }, 5530459d7bSClemens Ladisch { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, 561b8ff22fSClemens Ladisch { } 571b8ff22fSClemens Ladisch }; 581b8ff22fSClemens Ladisch MODULE_DEVICE_TABLE(pci, xonar_ids); 591b8ff22fSClemens Ladisch 6030459d7bSClemens Ladisch static int __devinit get_xonar_model(struct oxygen *chip, 6130459d7bSClemens Ladisch const struct pci_device_id *id) 621b8ff22fSClemens Ladisch { 6365c3ac88SClemens Ladisch if (get_xonar_pcm179x_model(chip, id) >= 0) 6430459d7bSClemens Ladisch return 0; 6565c3ac88SClemens Ladisch if (get_xonar_cs43xx_model(chip, id) >= 0) 6665c3ac88SClemens Ladisch return 0; 67d1db38c0SClemens Ladisch if (get_xonar_wm87x6_model(chip, id) >= 0) 68d1db38c0SClemens Ladisch return 0; 6965c3ac88SClemens Ladisch return -EINVAL; 7030459d7bSClemens Ladisch } 7130459d7bSClemens Ladisch 7230459d7bSClemens Ladisch static int __devinit xonar_probe(struct pci_dev *pci, 7330459d7bSClemens Ladisch const struct pci_device_id *pci_id) 7430459d7bSClemens Ladisch { 751b8ff22fSClemens Ladisch static int dev; 761b8ff22fSClemens Ladisch int err; 771b8ff22fSClemens Ladisch 781b8ff22fSClemens Ladisch if (dev >= SNDRV_CARDS) 791b8ff22fSClemens Ladisch return -ENODEV; 801b8ff22fSClemens Ladisch if (!enable[dev]) { 811b8ff22fSClemens Ladisch ++dev; 821b8ff22fSClemens Ladisch return -ENOENT; 831b8ff22fSClemens Ladisch } 84bb718588SClemens Ladisch err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, 8530459d7bSClemens Ladisch xonar_ids, get_xonar_model); 861b8ff22fSClemens Ladisch if (err >= 0) 871b8ff22fSClemens Ladisch ++dev; 881b8ff22fSClemens Ladisch return err; 891b8ff22fSClemens Ladisch } 901b8ff22fSClemens Ladisch 911b8ff22fSClemens Ladisch static struct pci_driver xonar_driver = { 923733e424STakashi Iwai .name = KBUILD_MODNAME, 931b8ff22fSClemens Ladisch .id_table = xonar_ids, 941b8ff22fSClemens Ladisch .probe = xonar_probe, 951b8ff22fSClemens Ladisch .remove = __devexit_p(oxygen_pci_remove), 964a4bc53bSClemens Ladisch #ifdef CONFIG_PM 9768cb2b55STakashi Iwai .driver = { 9868cb2b55STakashi Iwai .pm = &oxygen_pci_pm, 9968cb2b55STakashi Iwai }, 1004a4bc53bSClemens Ladisch #endif 1014c25b932SClemens Ladisch .shutdown = oxygen_pci_shutdown, 1021b8ff22fSClemens Ladisch }; 1031b8ff22fSClemens Ladisch 104e9f66d9bSTakashi Iwai module_pci_driver(xonar_driver); 105