diff options
Diffstat (limited to 'sound/pci/emu10k1/emumpu401.c')
-rw-r--r-- | sound/pci/emu10k1/emumpu401.c | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/sound/pci/emu10k1/emumpu401.c b/sound/pci/emu10k1/emumpu401.c index eb57458a9665..d96eb455103f 100644 --- a/sound/pci/emu10k1/emumpu401.c +++ b/sound/pci/emu10k1/emumpu401.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #define EMU10K1_MIDI_MODE_INPUT (1<<0) | 28 | #define EMU10K1_MIDI_MODE_INPUT (1<<0) |
29 | #define EMU10K1_MIDI_MODE_OUTPUT (1<<1) | 29 | #define EMU10K1_MIDI_MODE_OUTPUT (1<<1) |
30 | 30 | ||
31 | static inline unsigned char mpu401_read(emu10k1_t *emu, emu10k1_midi_t *mpu, int idx) | 31 | static inline unsigned char mpu401_read(struct snd_emu10k1 *emu, |
32 | struct snd_emu10k1_midi *mpu, int idx) | ||
32 | { | 33 | { |
33 | if (emu->audigy) | 34 | if (emu->audigy) |
34 | return (unsigned char)snd_emu10k1_ptr_read(emu, mpu->port + idx, 0); | 35 | return (unsigned char)snd_emu10k1_ptr_read(emu, mpu->port + idx, 0); |
@@ -36,7 +37,8 @@ static inline unsigned char mpu401_read(emu10k1_t *emu, emu10k1_midi_t *mpu, int | |||
36 | return inb(emu->port + mpu->port + idx); | 37 | return inb(emu->port + mpu->port + idx); |
37 | } | 38 | } |
38 | 39 | ||
39 | static inline void mpu401_write(emu10k1_t *emu, emu10k1_midi_t *mpu, int data, int idx) | 40 | static inline void mpu401_write(struct snd_emu10k1 *emu, |
41 | struct snd_emu10k1_midi *mpu, int data, int idx) | ||
40 | { | 42 | { |
41 | if (emu->audigy) | 43 | if (emu->audigy) |
42 | snd_emu10k1_ptr_write(emu, mpu->port + idx, 0, data); | 44 | snd_emu10k1_ptr_write(emu, mpu->port + idx, 0, data); |
@@ -56,7 +58,7 @@ static inline void mpu401_write(emu10k1_t *emu, emu10k1_midi_t *mpu, int data, i | |||
56 | #define MPU401_ENTER_UART 0x3f | 58 | #define MPU401_ENTER_UART 0x3f |
57 | #define MPU401_ACK 0xfe | 59 | #define MPU401_ACK 0xfe |
58 | 60 | ||
59 | static void mpu401_clear_rx(emu10k1_t *emu, emu10k1_midi_t *mpu) | 61 | static void mpu401_clear_rx(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *mpu) |
60 | { | 62 | { |
61 | int timeout = 100000; | 63 | int timeout = 100000; |
62 | for (; timeout > 0 && mpu401_input_avail(emu, mpu); timeout--) | 64 | for (; timeout > 0 && mpu401_input_avail(emu, mpu); timeout--) |
@@ -71,7 +73,7 @@ static void mpu401_clear_rx(emu10k1_t *emu, emu10k1_midi_t *mpu) | |||
71 | 73 | ||
72 | */ | 74 | */ |
73 | 75 | ||
74 | static void do_emu10k1_midi_interrupt(emu10k1_t *emu, emu10k1_midi_t *midi, unsigned int status) | 76 | static void do_emu10k1_midi_interrupt(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *midi, unsigned int status) |
75 | { | 77 | { |
76 | unsigned char byte; | 78 | unsigned char byte; |
77 | 79 | ||
@@ -104,17 +106,17 @@ static void do_emu10k1_midi_interrupt(emu10k1_t *emu, emu10k1_midi_t *midi, unsi | |||
104 | spin_unlock(&midi->output_lock); | 106 | spin_unlock(&midi->output_lock); |
105 | } | 107 | } |
106 | 108 | ||
107 | static void snd_emu10k1_midi_interrupt(emu10k1_t *emu, unsigned int status) | 109 | static void snd_emu10k1_midi_interrupt(struct snd_emu10k1 *emu, unsigned int status) |
108 | { | 110 | { |
109 | do_emu10k1_midi_interrupt(emu, &emu->midi, status); | 111 | do_emu10k1_midi_interrupt(emu, &emu->midi, status); |
110 | } | 112 | } |
111 | 113 | ||
112 | static void snd_emu10k1_midi_interrupt2(emu10k1_t *emu, unsigned int status) | 114 | static void snd_emu10k1_midi_interrupt2(struct snd_emu10k1 *emu, unsigned int status) |
113 | { | 115 | { |
114 | do_emu10k1_midi_interrupt(emu, &emu->midi2, status); | 116 | do_emu10k1_midi_interrupt(emu, &emu->midi2, status); |
115 | } | 117 | } |
116 | 118 | ||
117 | static void snd_emu10k1_midi_cmd(emu10k1_t * emu, emu10k1_midi_t *midi, unsigned char cmd, int ack) | 119 | static void snd_emu10k1_midi_cmd(struct snd_emu10k1 * emu, struct snd_emu10k1_midi *midi, unsigned char cmd, int ack) |
118 | { | 120 | { |
119 | unsigned long flags; | 121 | unsigned long flags; |
120 | int timeout, ok; | 122 | int timeout, ok; |
@@ -146,10 +148,10 @@ static void snd_emu10k1_midi_cmd(emu10k1_t * emu, emu10k1_midi_t *midi, unsigned | |||
146 | mpu401_read_data(emu, midi)); | 148 | mpu401_read_data(emu, midi)); |
147 | } | 149 | } |
148 | 150 | ||
149 | static int snd_emu10k1_midi_input_open(snd_rawmidi_substream_t * substream) | 151 | static int snd_emu10k1_midi_input_open(struct snd_rawmidi_substream *substream) |
150 | { | 152 | { |
151 | emu10k1_t *emu; | 153 | struct snd_emu10k1 *emu; |
152 | emu10k1_midi_t *midi = (emu10k1_midi_t *)substream->rmidi->private_data; | 154 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; |
153 | unsigned long flags; | 155 | unsigned long flags; |
154 | 156 | ||
155 | emu = midi->emu; | 157 | emu = midi->emu; |
@@ -167,10 +169,10 @@ static int snd_emu10k1_midi_input_open(snd_rawmidi_substream_t * substream) | |||
167 | return 0; | 169 | return 0; |
168 | } | 170 | } |
169 | 171 | ||
170 | static int snd_emu10k1_midi_output_open(snd_rawmidi_substream_t * substream) | 172 | static int snd_emu10k1_midi_output_open(struct snd_rawmidi_substream *substream) |
171 | { | 173 | { |
172 | emu10k1_t *emu; | 174 | struct snd_emu10k1 *emu; |
173 | emu10k1_midi_t *midi = (emu10k1_midi_t *)substream->rmidi->private_data; | 175 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; |
174 | unsigned long flags; | 176 | unsigned long flags; |
175 | 177 | ||
176 | emu = midi->emu; | 178 | emu = midi->emu; |
@@ -188,10 +190,10 @@ static int snd_emu10k1_midi_output_open(snd_rawmidi_substream_t * substream) | |||
188 | return 0; | 190 | return 0; |
189 | } | 191 | } |
190 | 192 | ||
191 | static int snd_emu10k1_midi_input_close(snd_rawmidi_substream_t * substream) | 193 | static int snd_emu10k1_midi_input_close(struct snd_rawmidi_substream *substream) |
192 | { | 194 | { |
193 | emu10k1_t *emu; | 195 | struct snd_emu10k1 *emu; |
194 | emu10k1_midi_t *midi = (emu10k1_midi_t *)substream->rmidi->private_data; | 196 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; |
195 | unsigned long flags; | 197 | unsigned long flags; |
196 | 198 | ||
197 | emu = midi->emu; | 199 | emu = midi->emu; |
@@ -209,10 +211,10 @@ static int snd_emu10k1_midi_input_close(snd_rawmidi_substream_t * substream) | |||
209 | return 0; | 211 | return 0; |
210 | } | 212 | } |
211 | 213 | ||
212 | static int snd_emu10k1_midi_output_close(snd_rawmidi_substream_t * substream) | 214 | static int snd_emu10k1_midi_output_close(struct snd_rawmidi_substream *substream) |
213 | { | 215 | { |
214 | emu10k1_t *emu; | 216 | struct snd_emu10k1 *emu; |
215 | emu10k1_midi_t *midi = (emu10k1_midi_t *)substream->rmidi->private_data; | 217 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; |
216 | unsigned long flags; | 218 | unsigned long flags; |
217 | 219 | ||
218 | emu = midi->emu; | 220 | emu = midi->emu; |
@@ -230,10 +232,10 @@ static int snd_emu10k1_midi_output_close(snd_rawmidi_substream_t * substream) | |||
230 | return 0; | 232 | return 0; |
231 | } | 233 | } |
232 | 234 | ||
233 | static void snd_emu10k1_midi_input_trigger(snd_rawmidi_substream_t * substream, int up) | 235 | static void snd_emu10k1_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) |
234 | { | 236 | { |
235 | emu10k1_t *emu; | 237 | struct snd_emu10k1 *emu; |
236 | emu10k1_midi_t *midi = (emu10k1_midi_t *)substream->rmidi->private_data; | 238 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; |
237 | emu = midi->emu; | 239 | emu = midi->emu; |
238 | snd_assert(emu, return); | 240 | snd_assert(emu, return); |
239 | 241 | ||
@@ -243,10 +245,10 @@ static void snd_emu10k1_midi_input_trigger(snd_rawmidi_substream_t * substream, | |||
243 | snd_emu10k1_intr_disable(emu, midi->rx_enable); | 245 | snd_emu10k1_intr_disable(emu, midi->rx_enable); |
244 | } | 246 | } |
245 | 247 | ||
246 | static void snd_emu10k1_midi_output_trigger(snd_rawmidi_substream_t * substream, int up) | 248 | static void snd_emu10k1_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) |
247 | { | 249 | { |
248 | emu10k1_t *emu; | 250 | struct snd_emu10k1 *emu; |
249 | emu10k1_midi_t *midi = (emu10k1_midi_t *)substream->rmidi->private_data; | 251 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)substream->rmidi->private_data; |
250 | unsigned long flags; | 252 | unsigned long flags; |
251 | 253 | ||
252 | emu = midi->emu; | 254 | emu = midi->emu; |
@@ -283,30 +285,30 @@ static void snd_emu10k1_midi_output_trigger(snd_rawmidi_substream_t * substream, | |||
283 | 285 | ||
284 | */ | 286 | */ |
285 | 287 | ||
286 | static snd_rawmidi_ops_t snd_emu10k1_midi_output = | 288 | static struct snd_rawmidi_ops snd_emu10k1_midi_output = |
287 | { | 289 | { |
288 | .open = snd_emu10k1_midi_output_open, | 290 | .open = snd_emu10k1_midi_output_open, |
289 | .close = snd_emu10k1_midi_output_close, | 291 | .close = snd_emu10k1_midi_output_close, |
290 | .trigger = snd_emu10k1_midi_output_trigger, | 292 | .trigger = snd_emu10k1_midi_output_trigger, |
291 | }; | 293 | }; |
292 | 294 | ||
293 | static snd_rawmidi_ops_t snd_emu10k1_midi_input = | 295 | static struct snd_rawmidi_ops snd_emu10k1_midi_input = |
294 | { | 296 | { |
295 | .open = snd_emu10k1_midi_input_open, | 297 | .open = snd_emu10k1_midi_input_open, |
296 | .close = snd_emu10k1_midi_input_close, | 298 | .close = snd_emu10k1_midi_input_close, |
297 | .trigger = snd_emu10k1_midi_input_trigger, | 299 | .trigger = snd_emu10k1_midi_input_trigger, |
298 | }; | 300 | }; |
299 | 301 | ||
300 | static void snd_emu10k1_midi_free(snd_rawmidi_t *rmidi) | 302 | static void snd_emu10k1_midi_free(struct snd_rawmidi *rmidi) |
301 | { | 303 | { |
302 | emu10k1_midi_t *midi = (emu10k1_midi_t *)rmidi->private_data; | 304 | struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)rmidi->private_data; |
303 | midi->interrupt = NULL; | 305 | midi->interrupt = NULL; |
304 | midi->rmidi = NULL; | 306 | midi->rmidi = NULL; |
305 | } | 307 | } |
306 | 308 | ||
307 | static int __devinit emu10k1_midi_init(emu10k1_t *emu, emu10k1_midi_t *midi, int device, char *name) | 309 | static int __devinit emu10k1_midi_init(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *midi, int device, char *name) |
308 | { | 310 | { |
309 | snd_rawmidi_t *rmidi; | 311 | struct snd_rawmidi *rmidi; |
310 | int err; | 312 | int err; |
311 | 313 | ||
312 | if ((err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi)) < 0) | 314 | if ((err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi)) < 0) |
@@ -327,9 +329,9 @@ static int __devinit emu10k1_midi_init(emu10k1_t *emu, emu10k1_midi_t *midi, int | |||
327 | return 0; | 329 | return 0; |
328 | } | 330 | } |
329 | 331 | ||
330 | int __devinit snd_emu10k1_midi(emu10k1_t *emu) | 332 | int __devinit snd_emu10k1_midi(struct snd_emu10k1 *emu) |
331 | { | 333 | { |
332 | emu10k1_midi_t *midi = &emu->midi; | 334 | struct snd_emu10k1_midi *midi = &emu->midi; |
333 | int err; | 335 | int err; |
334 | 336 | ||
335 | if ((err = emu10k1_midi_init(emu, midi, 0, "EMU10K1 MPU-401 (UART)")) < 0) | 337 | if ((err = emu10k1_midi_init(emu, midi, 0, "EMU10K1 MPU-401 (UART)")) < 0) |
@@ -344,9 +346,9 @@ int __devinit snd_emu10k1_midi(emu10k1_t *emu) | |||
344 | return 0; | 346 | return 0; |
345 | } | 347 | } |
346 | 348 | ||
347 | int __devinit snd_emu10k1_audigy_midi(emu10k1_t *emu) | 349 | int __devinit snd_emu10k1_audigy_midi(struct snd_emu10k1 *emu) |
348 | { | 350 | { |
349 | emu10k1_midi_t *midi; | 351 | struct snd_emu10k1_midi *midi; |
350 | int err; | 352 | int err; |
351 | 353 | ||
352 | midi = &emu->midi; | 354 | midi = &emu->midi; |