aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/pcxhr/pcxhr_hwdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/pcxhr/pcxhr_hwdep.c')
-rw-r--r--sound/pci/pcxhr/pcxhr_hwdep.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c
index bf207e317f71..d995175c1c48 100644
--- a/sound/pci/pcxhr/pcxhr_hwdep.c
+++ b/sound/pci/pcxhr/pcxhr_hwdep.c
@@ -35,13 +35,6 @@
35#include "pcxhr_mix22.h" 35#include "pcxhr_mix22.h"
36 36
37 37
38#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
39#if !defined(CONFIG_USE_PCXHRLOADER) && !defined(CONFIG_SND_PCXHR) /* built-in kernel */
40#define SND_PCXHR_FW_LOADER /* use the standard firmware loader */
41#endif
42#endif
43
44
45static int pcxhr_sub_init(struct pcxhr_mgr *mgr); 38static int pcxhr_sub_init(struct pcxhr_mgr *mgr);
46/* 39/*
47 * get basic information and init pcxhr card 40 * get basic information and init pcxhr card
@@ -362,8 +355,6 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index,
362/* 355/*
363 * fw loader entry 356 * fw loader entry
364 */ 357 */
365#ifdef SND_PCXHR_FW_LOADER
366
367int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) 358int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
368{ 359{
369 static char *fw_files[][5] = { 360 static char *fw_files[][5] = {
@@ -424,80 +415,3 @@ MODULE_FIRMWARE("pcxhr/xlxc924.dat");
424MODULE_FIRMWARE("pcxhr/dspe924.e56"); 415MODULE_FIRMWARE("pcxhr/dspe924.e56");
425MODULE_FIRMWARE("pcxhr/dspb924.b56"); 416MODULE_FIRMWARE("pcxhr/dspb924.b56");
426MODULE_FIRMWARE("pcxhr/dspd222.d56"); 417MODULE_FIRMWARE("pcxhr/dspd222.d56");
427
428
429#else /* old style firmware loading */
430
431/* pcxhr hwdep interface id string */
432#define PCXHR_HWDEP_ID "pcxhr loader"
433
434
435static int pcxhr_hwdep_dsp_status(struct snd_hwdep *hw,
436 struct snd_hwdep_dsp_status *info)
437{
438 struct pcxhr_mgr *mgr = hw->private_data;
439 sprintf(info->id, "pcxhr%d", mgr->fw_file_set);
440 info->num_dsps = PCXHR_FIRMWARE_FILES_MAX_INDEX;
441
442 if (hw->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX))
443 info->chip_ready = 1;
444
445 info->version = PCXHR_DRIVER_VERSION;
446 return 0;
447}
448
449static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw,
450 struct snd_hwdep_dsp_image *dsp)
451{
452 struct pcxhr_mgr *mgr = hw->private_data;
453 int err;
454 struct firmware fw;
455
456 fw.size = dsp->length;
457 fw.data = vmalloc(fw.size);
458 if (! fw.data) {
459 snd_printk(KERN_ERR "pcxhr: cannot allocate dsp image "
460 "(%lu bytes)\n", (unsigned long)fw.size);
461 return -ENOMEM;
462 }
463 if (copy_from_user((void *)fw.data, dsp->image, dsp->length)) {
464 vfree(fw.data);
465 return -EFAULT;
466 }
467 err = pcxhr_dsp_load(mgr, dsp->index, &fw);
468 vfree(fw.data);
469 if (err < 0)
470 return err;
471 mgr->dsp_loaded |= 1 << dsp->index;
472 return 0;
473}
474
475int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
476{
477 int err;
478 struct snd_hwdep *hw;
479
480 /* only create hwdep interface for first cardX
481 * (see "index" module parameter)
482 */
483 err = snd_hwdep_new(mgr->chip[0]->card, PCXHR_HWDEP_ID, 0, &hw);
484 if (err < 0)
485 return err;
486
487 hw->iface = SNDRV_HWDEP_IFACE_PCXHR;
488 hw->private_data = mgr;
489 hw->ops.dsp_status = pcxhr_hwdep_dsp_status;
490 hw->ops.dsp_load = pcxhr_hwdep_dsp_load;
491 hw->exclusive = 1;
492 /* stereo cards don't need fw_file_0 -> dsp_loaded = 1 */
493 hw->dsp_loaded = mgr->is_hr_stereo ? 1 : 0;
494 mgr->dsp_loaded = 0;
495 sprintf(hw->name, PCXHR_HWDEP_ID);
496
497 err = snd_card_register(mgr->chip[0]->card);
498 if (err < 0)
499 return err;
500 return 0;
501}
502
503#endif /* SND_PCXHR_FW_LOADER */