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