2019-06-01 11:08:19 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2007-12-23 21:52:08 +03:00
|
|
|
/*
|
|
|
|
* C-Media CMI8788 driver for Asus Xonar cards
|
|
|
|
*
|
|
|
|
* Copyright (c) Clemens Ladisch <clemens@ladisch.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/delay.h>
|
2011-07-15 20:38:28 +04:00
|
|
|
#include <linux/module.h>
|
2007-12-23 21:52:08 +03:00
|
|
|
#include <sound/core.h>
|
|
|
|
#include <sound/initval.h>
|
|
|
|
#include <sound/pcm.h>
|
2009-09-28 13:11:27 +04:00
|
|
|
#include "xonar.h"
|
2007-12-23 21:52:08 +03:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
|
2010-10-04 15:17:26 +04:00
|
|
|
MODULE_DESCRIPTION("Asus Virtuoso driver");
|
2008-05-13 11:18:27 +04:00
|
|
|
MODULE_LICENSE("GPL v2");
|
2007-12-23 21:52:08 +03:00
|
|
|
|
|
|
|
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
|
|
|
|
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
|
2011-12-15 07:19:36 +04:00
|
|
|
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
|
2007-12-23 21:52:08 +03:00
|
|
|
|
|
|
|
module_param_array(index, int, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(index, "card index");
|
|
|
|
module_param_array(id, charp, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(id, "ID string");
|
|
|
|
module_param_array(enable, bool, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(enable, "enable card");
|
|
|
|
|
2014-08-08 17:56:03 +04:00
|
|
|
static const struct pci_device_id xonar_ids[] = {
|
2009-09-28 13:11:27 +04:00
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x8269) },
|
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x8275) },
|
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x82b7) },
|
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x8314) },
|
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x8327) },
|
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x834f) },
|
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x835c) },
|
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x835d) },
|
2010-10-04 15:22:51 +04:00
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x835e) },
|
2010-01-18 17:44:04 +03:00
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x838e) },
|
2014-09-10 22:58:25 +04:00
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x8428) },
|
2012-09-09 13:14:15 +04:00
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x8522) },
|
2014-08-04 17:17:55 +04:00
|
|
|
{ OXYGEN_PCI_SUBID(0x1043, 0x85f4) },
|
2009-02-19 10:42:44 +03:00
|
|
|
{ OXYGEN_PCI_SUBID_BROKEN_EEPROM },
|
2007-12-23 21:52:08 +03:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pci, xonar_ids);
|
|
|
|
|
2012-12-06 21:35:20 +04:00
|
|
|
static int get_xonar_model(struct oxygen *chip,
|
|
|
|
const struct pci_device_id *id)
|
2007-12-23 21:52:08 +03:00
|
|
|
{
|
2009-09-28 13:11:27 +04:00
|
|
|
if (get_xonar_pcm179x_model(chip, id) >= 0)
|
|
|
|
return 0;
|
|
|
|
if (get_xonar_cs43xx_model(chip, id) >= 0)
|
|
|
|
return 0;
|
2010-01-18 17:44:04 +03:00
|
|
|
if (get_xonar_wm87x6_model(chip, id) >= 0)
|
|
|
|
return 0;
|
2009-09-28 13:11:27 +04:00
|
|
|
return -EINVAL;
|
2009-02-19 10:42:44 +03:00
|
|
|
}
|
|
|
|
|
2012-12-06 21:35:20 +04:00
|
|
|
static int xonar_probe(struct pci_dev *pci,
|
|
|
|
const struct pci_device_id *pci_id)
|
2009-02-19 10:42:44 +03:00
|
|
|
{
|
2007-12-23 21:52:08 +03:00
|
|
|
static int dev;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (dev >= SNDRV_CARDS)
|
|
|
|
return -ENODEV;
|
|
|
|
if (!enable[dev]) {
|
|
|
|
++dev;
|
|
|
|
return -ENOENT;
|
|
|
|
}
|
2009-02-19 10:37:13 +03:00
|
|
|
err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE,
|
2009-02-19 10:42:44 +03:00
|
|
|
xonar_ids, get_xonar_model);
|
2007-12-23 21:52:08 +03:00
|
|
|
if (err >= 0)
|
|
|
|
++dev;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct pci_driver xonar_driver = {
|
2011-06-10 18:20:20 +04:00
|
|
|
.name = KBUILD_MODNAME,
|
2007-12-23 21:52:08 +03:00
|
|
|
.id_table = xonar_ids,
|
|
|
|
.probe = xonar_probe,
|
2012-12-06 21:35:20 +04:00
|
|
|
.remove = oxygen_pci_remove,
|
2012-08-14 20:12:04 +04:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2012-07-02 17:20:37 +04:00
|
|
|
.driver = {
|
|
|
|
.pm = &oxygen_pci_pm,
|
|
|
|
},
|
2008-05-13 11:24:39 +04:00
|
|
|
#endif
|
2010-09-07 15:37:10 +04:00
|
|
|
.shutdown = oxygen_pci_shutdown,
|
2007-12-23 21:52:08 +03:00
|
|
|
};
|
|
|
|
|
2012-04-24 14:25:00 +04:00
|
|
|
module_pci_driver(xonar_driver);
|