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