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) }, 5544923632SSergiu Giurgiu { OXYGEN_PCI_SUBID(0x1043, 0x8522) }, 56f42bb222SClemens Ladisch { OXYGEN_PCI_SUBID(0x1043, 0x85f4) }, 5730459d7bSClemens Ladisch { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, 581b8ff22fSClemens Ladisch { } 591b8ff22fSClemens Ladisch }; 601b8ff22fSClemens Ladisch MODULE_DEVICE_TABLE(pci, xonar_ids); 611b8ff22fSClemens Ladisch 62f120a6fbSBill Pemberton static int get_xonar_model(struct oxygen *chip, 6330459d7bSClemens Ladisch const struct pci_device_id *id) 641b8ff22fSClemens Ladisch { 6565c3ac88SClemens Ladisch if (get_xonar_pcm179x_model(chip, id) >= 0) 6630459d7bSClemens Ladisch return 0; 6765c3ac88SClemens Ladisch if (get_xonar_cs43xx_model(chip, id) >= 0) 6865c3ac88SClemens Ladisch return 0; 69d1db38c0SClemens Ladisch if (get_xonar_wm87x6_model(chip, id) >= 0) 70d1db38c0SClemens Ladisch return 0; 7165c3ac88SClemens Ladisch return -EINVAL; 7230459d7bSClemens Ladisch } 7330459d7bSClemens Ladisch 74f120a6fbSBill Pemberton static int xonar_probe(struct pci_dev *pci, 7530459d7bSClemens Ladisch const struct pci_device_id *pci_id) 7630459d7bSClemens Ladisch { 771b8ff22fSClemens Ladisch static int dev; 781b8ff22fSClemens Ladisch int err; 791b8ff22fSClemens Ladisch 801b8ff22fSClemens Ladisch if (dev >= SNDRV_CARDS) 811b8ff22fSClemens Ladisch return -ENODEV; 821b8ff22fSClemens Ladisch if (!enable[dev]) { 831b8ff22fSClemens Ladisch ++dev; 841b8ff22fSClemens Ladisch return -ENOENT; 851b8ff22fSClemens Ladisch } 86bb718588SClemens Ladisch err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, 8730459d7bSClemens Ladisch xonar_ids, get_xonar_model); 881b8ff22fSClemens Ladisch if (err >= 0) 891b8ff22fSClemens Ladisch ++dev; 901b8ff22fSClemens Ladisch return err; 911b8ff22fSClemens Ladisch } 921b8ff22fSClemens Ladisch 931b8ff22fSClemens Ladisch static struct pci_driver xonar_driver = { 943733e424STakashi Iwai .name = KBUILD_MODNAME, 951b8ff22fSClemens Ladisch .id_table = xonar_ids, 961b8ff22fSClemens Ladisch .probe = xonar_probe, 97f120a6fbSBill Pemberton .remove = oxygen_pci_remove, 98c7561cd8STakashi Iwai #ifdef CONFIG_PM_SLEEP 9968cb2b55STakashi Iwai .driver = { 10068cb2b55STakashi Iwai .pm = &oxygen_pci_pm, 10168cb2b55STakashi Iwai }, 1024a4bc53bSClemens Ladisch #endif 1034c25b932SClemens Ladisch .shutdown = oxygen_pci_shutdown, 1041b8ff22fSClemens Ladisch }; 1051b8ff22fSClemens Ladisch 106e9f66d9bSTakashi Iwai module_pci_driver(xonar_driver); 107