vxpocket.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * Driver for Digigram VXpocket V2/440 soundcards
  3. *
  4. * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #include <sound/driver.h>
  21. #include <linux/init.h>
  22. #include <linux/moduleparam.h>
  23. #include <sound/core.h>
  24. #include <pcmcia/version.h>
  25. #include "vxpocket.h"
  26. #include <sound/initval.h>
  27. /*
  28. */
  29. #ifdef COMPILE_VXP440
  30. #define CARD_NAME "VXPocket440"
  31. #else
  32. #define CARD_NAME "VXPocket"
  33. #endif
  34. MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
  35. MODULE_DESCRIPTION("Digigram " CARD_NAME);
  36. MODULE_LICENSE("GPL");
  37. MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}");
  38. static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
  39. static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
  40. static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
  41. static int ibl[SNDRV_CARDS];
  42. module_param_array(index, int, NULL, 0444);
  43. MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
  44. module_param_array(id, charp, NULL, 0444);
  45. MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
  46. module_param_array(enable, bool, NULL, 0444);
  47. MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
  48. module_param_array(ibl, int, NULL, 0444);
  49. MODULE_PARM_DESC(ibl, "Capture IBL size for " CARD_NAME " soundcard.");
  50. /*
  51. */
  52. #ifdef COMPILE_VXP440
  53. /* 1 DSP, 1 sync UER, 1 sync World Clock (NIY) */
  54. /* SMPTE (NIY) */
  55. /* 2 stereo analog input (line/micro) */
  56. /* 2 stereo analog output */
  57. /* Only output levels can be modified */
  58. /* UER, but only for the first two inputs and outputs. */
  59. #define NUM_CODECS 2
  60. #define CARD_TYPE VX_TYPE_VXP440
  61. #define DEV_INFO "snd-vxp440"
  62. #else
  63. /* 1 DSP, 1 sync UER */
  64. /* 1 programmable clock (NIY) */
  65. /* 1 stereo analog input (line/micro) */
  66. /* 1 stereo analog output */
  67. /* Only output levels can be modified */
  68. #define NUM_CODECS 1
  69. #define CARD_TYPE VX_TYPE_VXPOCKET
  70. #define DEV_INFO "snd-vxpocket"
  71. #endif
  72. static dev_info_t dev_info = DEV_INFO;
  73. static struct snd_vx_hardware vxp_hw = {
  74. .name = CARD_NAME,
  75. .type = CARD_TYPE,
  76. /* hardware specs */
  77. .num_codecs = NUM_CODECS,
  78. .num_ins = NUM_CODECS,
  79. .num_outs = NUM_CODECS,
  80. .output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
  81. };
  82. static struct snd_vxp_entry hw_entry = {
  83. .dev_info = &dev_info,
  84. /* module parameters */
  85. .index_table = index,
  86. .id_table = id,
  87. .enable_table = enable,
  88. .ibl = ibl,
  89. /* h/w config */
  90. .hardware = &vxp_hw,
  91. .ops = &snd_vxpocket_ops,
  92. };
  93. /*
  94. */
  95. static dev_link_t *vxp_attach(void)
  96. {
  97. return snd_vxpocket_attach(&hw_entry);
  98. }
  99. static void vxp_detach(dev_link_t *link)
  100. {
  101. snd_vxpocket_detach(&hw_entry, link);
  102. }
  103. /*
  104. * Module entry points
  105. */
  106. static struct pcmcia_device_id vxp_ids[] = {
  107. PCMCIA_DEVICE_MANF_CARD(0x01f1, 0x0100),
  108. PCMCIA_DEVICE_NULL
  109. };
  110. MODULE_DEVICE_TABLE(pcmcia, vxp_ids);
  111. static struct pcmcia_driver vxp_cs_driver = {
  112. .owner = THIS_MODULE,
  113. .drv = {
  114. .name = DEV_INFO,
  115. },
  116. .attach = vxp_attach,
  117. .detach = vxp_detach,
  118. .id_table = vxp_ids,
  119. };
  120. static int __init init_vxpocket(void)
  121. {
  122. return pcmcia_register_driver(&vxp_cs_driver);
  123. }
  124. static void __exit exit_vxpocket(void)
  125. {
  126. pcmcia_unregister_driver(&vxp_cs_driver);
  127. BUG_ON(hw_entry.dev_list != NULL);
  128. }
  129. module_init(init_vxpocket);
  130. module_exit(exit_vxpocket);