This source file includes following definitions.
- CS_OUT
- probe_cs4232_mpu
- attach_cs4232_mpu
- probe_cs4232
- attach_cs4232
- unload_cs4232
- unload_cs4232_mpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 #include <linux/config.h>
35
36
37 #include "sound_config.h"
38
39 #if defined(CONFIG_CS4232)
40
41 #define KEY_PORT 0x279
42 #define CSN_NUM 0x99
43
44 static int *osp;
45
46 static void
47 CS_OUT (unsigned char a)
48 {
49 outb (a, KEY_PORT);
50 }
51 #define CS_OUT2(a, b) {CS_OUT(a);CS_OUT(b);}
52 #define CS_OUT3(a, b, c) {CS_OUT(a);CS_OUT(b);CS_OUT(c);}
53
54 static int mpu_base = 0, mpu_irq = 0;
55 static int mpu_detected = 0;
56
57 int
58 probe_cs4232_mpu (struct address_info *hw_config)
59 {
60
61
62
63
64 mpu_base = hw_config->io_base;
65 mpu_irq = hw_config->irq;
66
67 return 0;
68 }
69
70 long
71 attach_cs4232_mpu (long mem_start, struct address_info *hw_config)
72 {
73 return mem_start;
74 }
75
76 static unsigned char crystal_key[] =
77 {
78 0x96, 0x35, 0x9a, 0xcd, 0xe6, 0xf3, 0x79, 0xbc,
79 0x5e, 0xaf, 0x57, 0x2b, 0x15, 0x8a, 0xc5, 0xe2,
80 0xf1, 0xf8, 0x7c, 0x3e, 0x9f, 0x4f, 0x27, 0x13,
81 0x09, 0x84, 0x42, 0xa1, 0xd0, 0x68, 0x34, 0x1a
82 };
83
84 int
85 probe_cs4232 (struct address_info *hw_config)
86 {
87 int i, n;
88 int base = hw_config->io_base, irq = hw_config->irq;
89 int dma1 = hw_config->dma, dma2 = hw_config->dma2;
90
91 osp = hw_config->osp;
92
93
94
95
96
97 if (check_region (base, 4))
98 {
99 printk ("cs4232.c: I/O port 0x%03x not free\n", base);
100 return 0;
101 }
102
103 if (ad1848_detect (hw_config->io_base, NULL, hw_config->osp))
104 return 1;
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 for (n = 0; n < 4; n++)
120 {
121
122
123
124 for (i = 0; i < 32; i++)
125 CS_OUT (crystal_key[i]);
126
127
128
129
130
131 CS_OUT2 (0x06, CSN_NUM);
132
133
134
135
136
137
138 CS_OUT2 (0x15, 0x00);
139 CS_OUT3 (0x47, (base >> 8) & 0xff, base & 0xff);
140
141 if (check_region (0x388, 4))
142 CS_OUT3 (0x48, 0x00, 0x00)
143 else
144 CS_OUT3 (0x48, 0x03, 0x88);
145
146 CS_OUT3 (0x42, 0x00, 0x00);
147 CS_OUT2 (0x22, irq);
148 CS_OUT2 (0x2a, dma1);
149
150 if (dma2 != -1)
151 CS_OUT2 (0x25, dma2)
152 else
153 CS_OUT2 (0x25, 4);
154
155 CS_OUT2 (0x33, 0x01);
156
157
158
159
160
161 #if (defined(CONFIG_MPU401) || defined(CONFIG_MPU_EMU)) && defined(CONFIG_MIDI)
162 if (mpu_base != 0 && mpu_irq != 0)
163 {
164 CS_OUT2 (0x15, 0x03);
165 CS_OUT3 (0x47, (mpu_base >> 8) & 0xff, mpu_base & 0xff);
166 CS_OUT2 (0x22, mpu_irq);
167 CS_OUT2 (0x33, 0x01);
168 }
169 #endif
170
171
172
173
174 CS_OUT (0x79);
175
176
177
178
179
180 if (ad1848_detect (hw_config->io_base, NULL, hw_config->osp))
181 return 1;
182 }
183
184 return 0;
185 }
186
187 long
188 attach_cs4232 (long mem_start, struct address_info *hw_config)
189 {
190 int base = hw_config->io_base, irq = hw_config->irq;
191 int dma1 = hw_config->dma, dma2 = hw_config->dma2;
192
193 if (dma2 == -1)
194 dma2 = dma1;
195
196 ad1848_init ("CS4232", base,
197 irq,
198 dma1,
199 dma2,
200 0,
201 hw_config->osp);
202
203 #if (defined(CONFIG_MPU401) || defined(CONFIG_MPU_EMU)) && defined(CONFIG_MIDI)
204 if (mpu_base != 0 && mpu_irq != 0)
205 {
206 static struct address_info hw_config2 =
207 {0};
208
209 hw_config2.io_base = mpu_base;
210 hw_config2.irq = mpu_irq;
211 hw_config2.dma = -1;
212 hw_config2.dma2 = -1;
213 hw_config2.always_detect = 0;
214 hw_config2.name = NULL;
215 hw_config2.driver_use_1 = 0;
216 hw_config2.driver_use_2 = 0;
217 hw_config2.card_subtype = 0;
218 hw_config2.osp = hw_config->osp;
219
220 if (probe_mpu401 (&hw_config2))
221 {
222 mpu_detected = 1;
223 mem_start = attach_mpu401 (mem_start, &hw_config2);
224 }
225 else
226 {
227 mpu_base = mpu_irq = 0;
228 }
229 }
230 #endif
231 return mem_start;
232 }
233
234 void
235 unload_cs4232 (struct address_info *hw_config)
236 {
237 int base = hw_config->io_base, irq = hw_config->irq;
238 int dma1 = hw_config->dma, dma2 = hw_config->dma2;
239
240 if (dma2 == -1)
241 dma2 = dma1;
242
243 ad1848_unload (base,
244 irq,
245 dma1,
246 dma2,
247 0);
248
249 #if (defined(CONFIG_MPU401) || defined(CONFIG_MPU_EMU)) && defined(CONFIG_MIDI)
250 if (mpu_base != 0 && mpu_irq != 0 && mpu_detected)
251 {
252 static struct address_info hw_config2 =
253 {0};
254
255 hw_config2.io_base = mpu_base;
256 hw_config2.irq = mpu_irq;
257 hw_config2.dma = -1;
258 hw_config2.dma2 = -1;
259 hw_config2.always_detect = 0;
260 hw_config2.name = NULL;
261 hw_config2.driver_use_1 = 0;
262 hw_config2.driver_use_2 = 0;
263 hw_config2.card_subtype = 0;
264 hw_config2.osp = hw_config->osp;
265
266 unload_mpu401 (&hw_config2);
267 }
268 #endif
269 }
270
271 void
272 unload_cs4232_mpu (struct address_info *hw_config)
273 {
274
275 }
276
277
278 #endif