From 8dea78da5cee153b8af9c07a2745f6c55057fe12 Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Thu, 17 Jan 2013 16:15:55 -0500 Subject: Patched in Tegra support. --- sound/pci/mixart/mixart.c | 31 ++++++++++------ sound/pci/mixart/mixart_hwdep.c | 79 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 98 insertions(+), 12 deletions(-) (limited to 'sound/pci/mixart') diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 01f7f37a841..dbee59906ae 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard."); @@ -1004,7 +1004,7 @@ static int snd_mixart_chip_dev_free(struct snd_device *device) /* */ -static int snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int idx) +static int __devinit snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int idx) { int err; struct snd_mixart *chip; @@ -1180,7 +1180,7 @@ static void snd_mixart_proc_read(struct snd_info_entry *entry, } /* endif elf loaded */ } -static void snd_mixart_proc_init(struct snd_mixart *chip) +static void __devinit snd_mixart_proc_init(struct snd_mixart *chip) { struct snd_info_entry *entry; @@ -1209,8 +1209,8 @@ static void snd_mixart_proc_init(struct snd_mixart *chip) /* * probe function - creates the card manager */ -static int snd_mixart_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) +static int __devinit snd_mixart_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) { static int dev; struct mixart_mgr *mgr; @@ -1374,17 +1374,28 @@ static int snd_mixart_probe(struct pci_dev *pci, return 0; } -static void snd_mixart_remove(struct pci_dev *pci) +static void __devexit snd_mixart_remove(struct pci_dev *pci) { snd_mixart_free(pci_get_drvdata(pci)); pci_set_drvdata(pci, NULL); } -static struct pci_driver mixart_driver = { +static struct pci_driver driver = { .name = KBUILD_MODNAME, .id_table = snd_mixart_ids, .probe = snd_mixart_probe, - .remove = snd_mixart_remove, + .remove = __devexit_p(snd_mixart_remove), }; -module_pci_driver(mixart_driver); +static int __init alsa_card_mixart_init(void) +{ + return pci_register_driver(&driver); +} + +static void __exit alsa_card_mixart_exit(void) +{ + pci_unregister_driver(&driver); +} + +module_init(alsa_card_mixart_init) +module_exit(alsa_card_mixart_exit) diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index ece1f831c16..bf2696aa5d4 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include "mixart.h" @@ -538,7 +537,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw if ((err = snd_card_register(chip->card)) < 0) return err; - } + }; snd_printdd("miXart firmware downloaded and successfully set up\n"); @@ -546,6 +545,14 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw } +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) +#if !defined(CONFIG_USE_MIXARTLOADER) && !defined(CONFIG_SND_MIXART) /* built-in kernel */ +#define SND_MIXART_FW_LOADER /* use the standard firmware loader */ +#endif +#endif + +#ifdef SND_MIXART_FW_LOADER + int snd_mixart_setup_firmware(struct mixart_mgr *mgr) { static char *fw_files[3] = { @@ -575,3 +582,71 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr) MODULE_FIRMWARE("mixart/miXart8.xlx"); MODULE_FIRMWARE("mixart/miXart8.elf"); MODULE_FIRMWARE("mixart/miXart8AES.xlx"); + +#else /* old style firmware loading */ + +/* miXart hwdep interface id string */ +#define SND_MIXART_HWDEP_ID "miXart Loader" + +static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, + struct snd_hwdep_dsp_status *info) +{ + struct mixart_mgr *mgr = hw->private_data; + + strcpy(info->id, "miXart"); + info->num_dsps = MIXART_HARDW_FILES_MAX_INDEX; + + if (mgr->dsp_loaded & (1 << MIXART_MOTHERBOARD_ELF_INDEX)) + info->chip_ready = 1; + + info->version = MIXART_DRIVER_VERSION; + return 0; +} + +static int mixart_hwdep_dsp_load(struct snd_hwdep *hw, + struct snd_hwdep_dsp_image *dsp) +{ + struct mixart_mgr* mgr = hw->private_data; + struct firmware fw; + int err; + + fw.size = dsp->length; + fw.data = vmalloc(dsp->length); + if (! fw.data) { + snd_printk(KERN_ERR "miXart: cannot allocate image size %d\n", + (int)dsp->length); + return -ENOMEM; + } + if (copy_from_user((void *) fw.data, dsp->image, dsp->length)) { + vfree(fw.data); + return -EFAULT; + } + err = mixart_dsp_load(mgr, dsp->index, &fw); + vfree(fw.data); + if (err < 0) + return err; + mgr->dsp_loaded |= 1 << dsp->index; + return err; +} + +int snd_mixart_setup_firmware(struct mixart_mgr *mgr) +{ + int err; + struct snd_hwdep *hw; + + /* only create hwdep interface for first cardX (see "index" module parameter)*/ + if ((err = snd_hwdep_new(mgr->chip[0]->card, SND_MIXART_HWDEP_ID, 0, &hw)) < 0) + return err; + + hw->iface = SNDRV_HWDEP_IFACE_MIXART; + hw->private_data = mgr; + hw->ops.dsp_status = mixart_hwdep_dsp_status; + hw->ops.dsp_load = mixart_hwdep_dsp_load; + hw->exclusive = 1; + sprintf(hw->name, SND_MIXART_HWDEP_ID); + mgr->dsp_loaded = 0; + + return snd_card_register(mgr->chip[0]->card); +} + +#endif /* SND_MIXART_FW_LOADER */ -- cgit v1.2.2