blob: 5f4c1326415912018ce590b5f0c6ba9e5f339c98 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
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
39MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
40MODULE_DESCRIPTION("Digigram " CARD_NAME);
41MODULE_LICENSE("GPL");
42MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}");
43
44static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
45static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
46static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
47static int ibl[SNDRV_CARDS];
48
49module_param_array(index, int, NULL, 0444);
50MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
51module_param_array(id, charp, NULL, 0444);
52MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
53module_param_array(enable, bool, NULL, 0444);
54MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
55module_param_array(ibl, int, NULL, 0444);
56MODULE_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
89static dev_info_t dev_info = DEV_INFO;
90
91static 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
102static 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 */
118static dev_link_t *vxp_attach(void)
119{
120 return snd_vxpocket_attach(&hw_entry);
121}
122
123static void vxp_detach(dev_link_t *link)
124{
125 snd_vxpocket_detach(&hw_entry, link);
126}
127
128/*
129 * Module entry points
130 */
131
Dominik Brodowskie9a07af2005-06-27 16:28:33 -0700132static struct pcmcia_device_id vxp_ids[] = {
133 PCMCIA_DEVICE_MANF_CARD(0x01f1, 0x0100),
134 PCMCIA_DEVICE_NULL
135};
136MODULE_DEVICE_TABLE(pcmcia, vxp_ids);
137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138static struct pcmcia_driver vxp_cs_driver = {
139 .owner = THIS_MODULE,
140 .drv = {
141 .name = DEV_INFO,
142 },
143 .attach = vxp_attach,
Dominik Brodowskie9a07af2005-06-27 16:28:33 -0700144 .detach = vxp_detach,
145 .id_table = vxp_ids,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146};
147
148static int __init init_vxpocket(void)
149{
150 return pcmcia_register_driver(&vxp_cs_driver);
151}
152
153static void __exit exit_vxpocket(void)
154{
155 pcmcia_unregister_driver(&vxp_cs_driver);
156 BUG_ON(hw_entry.dev_list != NULL);
157}
158
159module_init(init_vxpocket);
160module_exit(exit_vxpocket);