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 21 22 #include <sound/driver.h> 23 #include <linux/init.h> 24 #include <linux/moduleparam.h> 25 #include <sound/core.h> 26 #include <pcmcia/version.h> 27 #include "vxpocket.h" 28 #include <sound/initval.h> 29 30 /* 31 */ 32 33 #ifdef COMPILE_VXP440 34 #define CARD_NAME "VXPocket440" 35 #else 36 #define CARD_NAME "VXPocket" 37 #endif 38 39 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); 40 MODULE_DESCRIPTION("Digigram " CARD_NAME); 41 MODULE_LICENSE("GPL"); 42 MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}"); 43 44 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 45 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 46 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 47 static int ibl[SNDRV_CARDS]; 48 49 module_param_array(index, int, NULL, 0444); 50 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); 51 module_param_array(id, charp, NULL, 0444); 52 MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); 53 module_param_array(enable, bool, NULL, 0444); 54 MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); 55 module_param_array(ibl, int, NULL, 0444); 56 MODULE_PARM_DESC(ibl, "Capture IBL size for " CARD_NAME " soundcard."); 57 58 59 /* 60 */ 61 62 #ifdef COMPILE_VXP440 63 64 /* 1 DSP, 1 sync UER, 1 sync World Clock (NIY) */ 65 /* SMPTE (NIY) */ 66 /* 2 stereo analog input (line/micro) */ 67 /* 2 stereo analog output */ 68 /* Only output levels can be modified */ 69 /* UER, but only for the first two inputs and outputs. */ 70 71 #define NUM_CODECS 2 72 #define CARD_TYPE VX_TYPE_VXP440 73 #define DEV_INFO "snd-vxp440" 74 75 #else 76 77 /* 1 DSP, 1 sync UER */ 78 /* 1 programmable clock (NIY) */ 79 /* 1 stereo analog input (line/micro) */ 80 /* 1 stereo analog output */ 81 /* Only output levels can be modified */ 82 83 #define NUM_CODECS 1 84 #define CARD_TYPE VX_TYPE_VXPOCKET 85 #define DEV_INFO "snd-vxpocket" 86 87 #endif 88 89 static dev_info_t dev_info = DEV_INFO; 90 91 static struct snd_vx_hardware vxp_hw = { 92 .name = CARD_NAME, 93 .type = CARD_TYPE, 94 95 /* hardware specs */ 96 .num_codecs = NUM_CODECS, 97 .num_ins = NUM_CODECS, 98 .num_outs = NUM_CODECS, 99 .output_level_max = VX_ANALOG_OUT_LEVEL_MAX, 100 }; 101 102 static struct snd_vxp_entry hw_entry = { 103 .dev_info = &dev_info, 104 105 /* module parameters */ 106 .index_table = index, 107 .id_table = id, 108 .enable_table = enable, 109 .ibl = ibl, 110 111 /* h/w config */ 112 .hardware = &vxp_hw, 113 .ops = &snd_vxpocket_ops, 114 }; 115 116 /* 117 */ 118 static dev_link_t *vxp_attach(void) 119 { 120 return snd_vxpocket_attach(&hw_entry); 121 } 122 123 static void vxp_detach(dev_link_t *link) 124 { 125 snd_vxpocket_detach(&hw_entry, link); 126 } 127 128 /* 129 * Module entry points 130 */ 131 132 static struct pcmcia_device_id vxp_ids[] = { 133 PCMCIA_DEVICE_MANF_CARD(0x01f1, 0x0100), 134 PCMCIA_DEVICE_NULL 135 }; 136 MODULE_DEVICE_TABLE(pcmcia, vxp_ids); 137 138 static struct pcmcia_driver vxp_cs_driver = { 139 .owner = THIS_MODULE, 140 .drv = { 141 .name = DEV_INFO, 142 }, 143 .attach = vxp_attach, 144 .detach = vxp_detach, 145 .id_table = vxp_ids, 146 }; 147 148 static int __init init_vxpocket(void) 149 { 150 return pcmcia_register_driver(&vxp_cs_driver); 151 } 152 153 static void __exit exit_vxpocket(void) 154 { 155 pcmcia_unregister_driver(&vxp_cs_driver); 156 BUG_ON(hw_entry.dev_list != NULL); 157 } 158 159 module_init(init_vxpocket); 160 module_exit(exit_vxpocket); 161