vx_hwdep.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Driver for Digigram VX soundcards
  3. *
  4. * DSP firmware management
  5. *
  6. * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #include <linux/device.h>
  23. #include <linux/firmware.h>
  24. #include <linux/slab.h>
  25. #include <linux/vmalloc.h>
  26. #include <linux/module.h>
  27. #include <sound/core.h>
  28. #include <sound/hwdep.h>
  29. #include <sound/vx_core.h>
  30. /*(DEBLOBBED)*/
  31. int snd_vx_setup_firmware(struct vx_core *chip)
  32. {
  33. static char *fw_files[VX_TYPE_NUMS][4] = {
  34. [VX_TYPE_BOARD] = {
  35. NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
  36. },
  37. [VX_TYPE_V2] = {
  38. NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
  39. },
  40. [VX_TYPE_MIC] = {
  41. NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
  42. },
  43. [VX_TYPE_VXPOCKET] = {
  44. "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/"
  45. },
  46. [VX_TYPE_VXP440] = {
  47. "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/"
  48. },
  49. };
  50. int i, err;
  51. for (i = 0; i < 4; i++) {
  52. char path[32];
  53. const struct firmware *fw;
  54. if (! fw_files[chip->type][i])
  55. continue;
  56. sprintf(path, "vx/%s", fw_files[chip->type][i]);
  57. if (reject_firmware(&fw, path, chip->dev)) {
  58. snd_printk(KERN_ERR "vx: can't load firmware %s\n", path);
  59. return -ENOENT;
  60. }
  61. err = chip->ops->load_dsp(chip, i, fw);
  62. if (err < 0) {
  63. release_firmware(fw);
  64. return err;
  65. }
  66. if (i == 1)
  67. chip->chip_status |= VX_STAT_XILINX_LOADED;
  68. #ifdef CONFIG_PM
  69. chip->firmware[i] = fw;
  70. #else
  71. release_firmware(fw);
  72. #endif
  73. }
  74. /* ok, we reached to the last one */
  75. /* create the devices if not built yet */
  76. if ((err = snd_vx_pcm_new(chip)) < 0)
  77. return err;
  78. if ((err = snd_vx_mixer_new(chip)) < 0)
  79. return err;
  80. if (chip->ops->add_controls)
  81. if ((err = chip->ops->add_controls(chip)) < 0)
  82. return err;
  83. chip->chip_status |= VX_STAT_DEVICE_INIT;
  84. chip->chip_status |= VX_STAT_CHIP_INIT;
  85. return snd_card_register(chip->card);
  86. }
  87. /* exported */
  88. void snd_vx_free_firmware(struct vx_core *chip)
  89. {
  90. #ifdef CONFIG_PM
  91. int i;
  92. for (i = 0; i < 4; i++)
  93. release_firmware(chip->firmware[i]);
  94. #endif
  95. }
  96. EXPORT_SYMBOL(snd_vx_setup_firmware);
  97. EXPORT_SYMBOL(snd_vx_free_firmware);