aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/mixart
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /sound/pci/mixart
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'sound/pci/mixart')
-rw-r--r--sound/pci/mixart/mixart.c31
-rw-r--r--sound/pci/mixart/mixart_hwdep.c79
2 files changed, 98 insertions, 12 deletions
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 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/module.h> 28#include <linux/moduleparam.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31 31
@@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}");
49 49
50static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 50static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
51static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 51static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
52static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 52static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
53 53
54module_param_array(index, int, NULL, 0444); 54module_param_array(index, int, NULL, 0444);
55MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard."); 55MODULE_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)
1004 1004
1005/* 1005/*
1006 */ 1006 */
1007static int snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int idx) 1007static int __devinit snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int idx)
1008{ 1008{
1009 int err; 1009 int err;
1010 struct snd_mixart *chip; 1010 struct snd_mixart *chip;
@@ -1180,7 +1180,7 @@ static void snd_mixart_proc_read(struct snd_info_entry *entry,
1180 } /* endif elf loaded */ 1180 } /* endif elf loaded */
1181} 1181}
1182 1182
1183static void snd_mixart_proc_init(struct snd_mixart *chip) 1183static void __devinit snd_mixart_proc_init(struct snd_mixart *chip)
1184{ 1184{
1185 struct snd_info_entry *entry; 1185 struct snd_info_entry *entry;
1186 1186
@@ -1209,8 +1209,8 @@ static void snd_mixart_proc_init(struct snd_mixart *chip)
1209/* 1209/*
1210 * probe function - creates the card manager 1210 * probe function - creates the card manager
1211 */ 1211 */
1212static int snd_mixart_probe(struct pci_dev *pci, 1212static int __devinit snd_mixart_probe(struct pci_dev *pci,
1213 const struct pci_device_id *pci_id) 1213 const struct pci_device_id *pci_id)
1214{ 1214{
1215 static int dev; 1215 static int dev;
1216 struct mixart_mgr *mgr; 1216 struct mixart_mgr *mgr;
@@ -1374,17 +1374,28 @@ static int snd_mixart_probe(struct pci_dev *pci,
1374 return 0; 1374 return 0;
1375} 1375}
1376 1376
1377static void snd_mixart_remove(struct pci_dev *pci) 1377static void __devexit snd_mixart_remove(struct pci_dev *pci)
1378{ 1378{
1379 snd_mixart_free(pci_get_drvdata(pci)); 1379 snd_mixart_free(pci_get_drvdata(pci));
1380 pci_set_drvdata(pci, NULL); 1380 pci_set_drvdata(pci, NULL);
1381} 1381}
1382 1382
1383static struct pci_driver mixart_driver = { 1383static struct pci_driver driver = {
1384 .name = KBUILD_MODNAME, 1384 .name = KBUILD_MODNAME,
1385 .id_table = snd_mixart_ids, 1385 .id_table = snd_mixart_ids,
1386 .probe = snd_mixart_probe, 1386 .probe = snd_mixart_probe,
1387 .remove = snd_mixart_remove, 1387 .remove = __devexit_p(snd_mixart_remove),
1388}; 1388};
1389 1389
1390module_pci_driver(mixart_driver); 1390static int __init alsa_card_mixart_init(void)
1391{
1392 return pci_register_driver(&driver);
1393}
1394
1395static void __exit alsa_card_mixart_exit(void)
1396{
1397 pci_unregister_driver(&driver);
1398}
1399
1400module_init(alsa_card_mixart_init)
1401module_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 @@
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/module.h>
29#include <asm/io.h> 28#include <asm/io.h>
30#include <sound/core.h> 29#include <sound/core.h>
31#include "mixart.h" 30#include "mixart.h"
@@ -538,7 +537,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
538 537
539 if ((err = snd_card_register(chip->card)) < 0) 538 if ((err = snd_card_register(chip->card)) < 0)
540 return err; 539 return err;
541 } 540 };
542 541
543 snd_printdd("miXart firmware downloaded and successfully set up\n"); 542 snd_printdd("miXart firmware downloaded and successfully set up\n");
544 543
@@ -546,6 +545,14 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
546} 545}
547 546
548 547
548#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
549#if !defined(CONFIG_USE_MIXARTLOADER) && !defined(CONFIG_SND_MIXART) /* built-in kernel */
550#define SND_MIXART_FW_LOADER /* use the standard firmware loader */
551#endif
552#endif
553
554#ifdef SND_MIXART_FW_LOADER
555
549int snd_mixart_setup_firmware(struct mixart_mgr *mgr) 556int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
550{ 557{
551 static char *fw_files[3] = { 558 static char *fw_files[3] = {
@@ -575,3 +582,71 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
575MODULE_FIRMWARE("mixart/miXart8.xlx"); 582MODULE_FIRMWARE("mixart/miXart8.xlx");
576MODULE_FIRMWARE("mixart/miXart8.elf"); 583MODULE_FIRMWARE("mixart/miXart8.elf");
577MODULE_FIRMWARE("mixart/miXart8AES.xlx"); 584MODULE_FIRMWARE("mixart/miXart8AES.xlx");
585
586#else /* old style firmware loading */
587
588/* miXart hwdep interface id string */
589#define SND_MIXART_HWDEP_ID "miXart Loader"
590
591static int mixart_hwdep_dsp_status(struct snd_hwdep *hw,
592 struct snd_hwdep_dsp_status *info)
593{
594 struct mixart_mgr *mgr = hw->private_data;
595
596 strcpy(info->id, "miXart");
597 info->num_dsps = MIXART_HARDW_FILES_MAX_INDEX;
598
599 if (mgr->dsp_loaded & (1 << MIXART_MOTHERBOARD_ELF_INDEX))
600 info->chip_ready = 1;
601
602 info->version = MIXART_DRIVER_VERSION;
603 return 0;
604}
605
606static int mixart_hwdep_dsp_load(struct snd_hwdep *hw,
607 struct snd_hwdep_dsp_image *dsp)
608{
609 struct mixart_mgr* mgr = hw->private_data;
610 struct firmware fw;
611 int err;
612
613 fw.size = dsp->length;
614 fw.data = vmalloc(dsp->length);
615 if (! fw.data) {
616 snd_printk(KERN_ERR "miXart: cannot allocate image size %d\n",
617 (int)dsp->length);
618 return -ENOMEM;
619 }
620 if (copy_from_user((void *) fw.data, dsp->image, dsp->length)) {
621 vfree(fw.data);
622 return -EFAULT;
623 }
624 err = mixart_dsp_load(mgr, dsp->index, &fw);
625 vfree(fw.data);
626 if (err < 0)
627 return err;
628 mgr->dsp_loaded |= 1 << dsp->index;
629 return err;
630}
631
632int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
633{
634 int err;
635 struct snd_hwdep *hw;
636
637 /* only create hwdep interface for first cardX (see "index" module parameter)*/
638 if ((err = snd_hwdep_new(mgr->chip[0]->card, SND_MIXART_HWDEP_ID, 0, &hw)) < 0)
639 return err;
640
641 hw->iface = SNDRV_HWDEP_IFACE_MIXART;
642 hw->private_data = mgr;
643 hw->ops.dsp_status = mixart_hwdep_dsp_status;
644 hw->ops.dsp_load = mixart_hwdep_dsp_load;
645 hw->exclusive = 1;
646 sprintf(hw->name, SND_MIXART_HWDEP_ID);
647 mgr->dsp_loaded = 0;
648
649 return snd_card_register(mgr->chip[0]->card);
650}
651
652#endif /* SND_MIXART_FW_LOADER */