2 **********************************************************************
3 * main.c - Creative EMU10K1 audio driver
4 * Copyright 1999, 2000 Creative Labs, Inc.
6 **********************************************************************
8 * Date Author Summary of changes
9 * ---- ------ ------------------
10 * October 20, 1999 Bertrand Lee base code release
11 * November 2, 1999 Alan Cox cleaned up stuff
13 **********************************************************************
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public
26 * License along with this program; if not, write to the Free
27 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
30 **********************************************************************
33 * /dev/dsp: Standard /dev/dsp device, OSS-compatible
34 * /dev/dsp1: Routes to rear speakers only
35 * /dev/mixer: Standard /dev/mixer device, OSS-compatible
36 * /dev/midi: Raw MIDI UART device, mostly OSS-compatible
37 * /dev/sequencer: Sequencer Interface (requires sound.o)
40 * 0.1 beta Initial release
41 * 0.2 Lowered initial mixer vol. Improved on stuttering wave playback. Added MIDI UART support.
42 * 0.3 Fixed mixer routing bug, added APS, joystick support.
43 * 0.4 Added rear-channel, SPDIF support.
44 * 0.5 Source cleanup, SMP fixes, multiopen support, 64 bit arch fixes,
45 * moved bh's to tasklets, moved to the new PCI driver initialization style.
46 * 0.6 Make use of pci_alloc_consistent, improve compatibility layer for 2.2 kernels,
47 * code reorganization and cleanup.
48 * 0.7 Support for the Emu-APS. Bug fixes for voice cache setup, mmaped sound + poll().
49 * Support for setting external TRAM size.
50 * 0.8 Make use of the kernel ac97 interface. Support for a dsp patch manager.
51 * 0.9 Re-enables rear speakers volume controls
52 * 0.10 Initializes rear speaker volume.
53 * Dynamic patch storage allocation.
54 * New private ioctls to change control gpr values.
55 * Enable volume control interrupts.
56 * By default enable dsp routes to digital out.
57 * 0.11 Fixed fx / 4 problem.
58 * 0.12 Implemented mmaped for recording.
59 * Fixed bug: not unreserving mmaped buffer pages.
60 * IRQ handler cleanup.
61 * 0.13 Fixed problem with dsp1
62 * Simplified dsp patch writing (inside the driver)
63 * Fixed several bugs found by the Stanford tools
64 * 0.14 New control gpr to oss mixer mapping feature (Chris Purnell)
65 * Added AC3 Passthrough Support (Juha Yrjola)
66 * Added Support for 5.1 cards (digital out and the third analog out)
67 * 0.15 Added Sequencer Support (Daniel Mack)
68 * Support for multichannel pcm playback (Eduard Hasenleithner)
69 * 0.16 Mixer improvements, added old treble/bass support (Daniel Bertrand)
70 * Small code format cleanup.
71 * Deadlock bug fix for emu10k1_volxxx_irqhandler().
72 * 0.17 Fix for mixer SOUND_MIXER_INFO ioctl.
73 * Fix for HIGHMEM machines (emu10k1 can only do 31 bit bus master)
74 * midi poll initial implementation.
75 * Small mixer fixes/cleanups.
76 * Improved support for 5.1 cards.
77 * 0.18 Fix for possible leak in pci_alloc_consistent()
78 * Cleaned up poll() functions (audio and midi). Don't start input.
79 * Restrict DMA pages used to 512Mib range.
80 * New AC97_BOOST mixer ioctl.
81 * 0.19a Added Support for Audigy Cards
82 * Real fix for kernel with highmem support (cast dma_handle to u32).
83 * Fix recording buffering parameters calculation.
84 * Use unsigned long for variables in bit ops.
85 * 0.20a Fixed recording startup
86 * Fixed timer rate setting (it's a 16-bit register)
87 *********************************************************************/
95 #include "linuxsupport.h"
101 /* These are only included once per module */
102 #include <linux/version.h>
103 #include <linux/module.h>
104 #include <linux/slab.h>
105 #include <linux/init.h>
106 #include <linux/delay.h>
107 #include <linux/proc_fs.h>
109 #include "hwaccess.h"
120 #ifdef EMU10K1_SEQUENCER
121 #define MIDI_SYNTH_NAME "EMU10K1 MIDI"
122 #define MIDI_SYNTH_CAPS SYNTH_CAP_INPUT
124 #include "sound_config.h"
125 #include "midi_synth.h"
127 /* this should be in dev_table.h */
128 #define SNDCARD_EMU10K1 46
131 /* the emu10k1 should supprt 31 bit bus master */
132 #define EMU10K1_DMA_MASK 0x7fffffff /* DMA buffer mask for pci_alloc_consist */
135 #ifndef PCI_VENDOR_ID_CREATIVE
136 #define PCI_VENDOR_ID_CREATIVE 0x1102
139 #ifndef PCI_DEVICE_ID_CREATIVE_EMU10K1
140 #define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002
142 #ifndef PCI_DEVICE_ID_CREATIVE_AUDIGY
143 #define PCI_DEVICE_ID_CREATIVE_AUDIGY 0x0004
146 #define EMU_APS_SUBID 0x40011102
153 static char *card_names
[] __devinitdata
= {
158 static struct pci_device_id emu10k1_pci_tbl
[] = {
159 {PCI_VENDOR_ID_CREATIVE
, PCI_DEVICE_ID_CREATIVE_EMU10K1
,
160 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, EMU10K1
},
161 {PCI_VENDOR_ID_CREATIVE
, PCI_DEVICE_ID_CREATIVE_AUDIGY
,
162 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, AUDIGY
},
166 MODULE_DEVICE_TABLE(pci
, emu10k1_pci_tbl
);
168 /* Global var instantiation */
170 LIST_HEAD(emu10k1_devs
);
172 extern struct file_operations emu10k1_audio_fops
;
173 extern struct file_operations emu10k1_mixer_fops
;
174 extern struct file_operations emu10k1_midi_fops
;
176 #ifdef EMU10K1_SEQUENCER
177 static struct midi_operations emu10k1_midi_operations
;
180 extern void emu10k1_interrupt(int, void *, struct pt_regs
*s
);
182 static int __devinit
emu10k1_audio_init(struct emu10k1_card
*card
)
184 card
->audio_dev
= register_sound_dsp(&emu10k1_audio_fops
, -1);
185 if (card
->audio_dev
< 0) {
186 printk(KERN_ERR
"emu10k1: cannot register first audio device!\n");
190 card
->audio_dev1
= register_sound_dsp(&emu10k1_audio_fops
, -1);
191 if (card
->audio_dev1
< 0) {
192 printk(KERN_ERR
"emu10k1: cannot register second audio device!\n");
196 /* Assign default playback voice parameters */
198 card
->mchannel_fx
= 0;
200 card
->mchannel_fx
= 8;
203 if (card
->is_audigy
) {
205 card
->waveout
.send_dcba
[SEND_MONO
] = 0xffffffff;
206 card
->waveout
.send_hgfe
[SEND_MONO
] = 0x0000ffff;
210 card
->waveout
.send_dcba
[SEND_LEFT
] = 0x00ff00ff;
211 card
->waveout
.send_hgfe
[SEND_LEFT
] = 0x00007f7f;
213 card
->waveout
.send_dcba
[SEND_RIGHT
] = 0xff00ff00;
214 card
->waveout
.send_hgfe
[SEND_RIGHT
] = 0x00007f7f;
216 card
->waveout
.send_routing
[ROUTE_PCM
] = 0x03020100; // Regular pcm
217 card
->waveout
.send_routing2
[ROUTE_PCM
] = 0x07060504;
219 card
->waveout
.send_routing
[ROUTE_PT
] = 0x3f3f3d3c; // Passthrough
220 card
->waveout
.send_routing2
[ROUTE_PT
] = 0x3f3f3f3f;
222 card
->waveout
.send_routing
[ROUTE_PCM1
] = 0x03020100; // Spare
223 card
->waveout
.send_routing2
[ROUTE_PCM1
] = 0x07060404;
227 card
->waveout
.send_dcba
[SEND_MONO
] = 0x0000ffff;
231 card
->waveout
.send_dcba
[SEND_LEFT
] = 0x000000ff;
233 card
->waveout
.send_dcba
[SEND_RIGHT
] = 0x0000ff00;
235 card
->waveout
.send_routing
[ROUTE_PCM
] = 0x3210; // pcm
236 card
->waveout
.send_routing
[ROUTE_PT
] = 0x3210; // passthrough
237 card
->waveout
.send_routing
[ROUTE_PCM1
] = 0x7654; // /dev/dsp1
240 /* Assign default recording parameters */
243 card
->wavein
.recsrc
= WAVERECORD_FX
;
245 card
->wavein
.recsrc
= WAVERECORD_AC97
;
247 card
->wavein
.fxwc
= 0x0003;
252 unregister_sound_dsp(card
->audio_dev
);
257 static void __devinit
emu10k1_audio_cleanup(struct emu10k1_card
*card
)
259 unregister_sound_dsp(card
->audio_dev1
);
260 unregister_sound_dsp(card
->audio_dev
);
263 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
264 int emu10k1_info_proc (char *page
, char **start
, off_t off
,
265 int count
, int *eof
, void *data
)
267 struct emu10k1_card
*card
= data
;
273 len
+= sprintf (page
+ len
, "Driver Version : %s\n", DRIVER_VERSION
);
274 len
+= sprintf (page
+ len
, "Card type : %s\n", card
->is_aps
? "Aps" : (card
->is_audigy
? "Audigy" : "Emu10k1"));
275 len
+= sprintf (page
+ len
, "Revision : %d\n", card
->chiprev
);
276 len
+= sprintf (page
+ len
, "Model : %#06x\n", card
->model
);
277 len
+= sprintf (page
+ len
, "IO : %#06lx-%#06lx\n", card
->iobase
, card
->iobase
+ card
->length
- 1);
278 len
+= sprintf (page
+ len
, "IRQ : %d\n\n", card
->irq
);
280 len
+= sprintf (page
+ len
, "Registered /dev Entries:\n");
281 len
+= sprintf (page
+ len
, "/dev/dsp%d\n", card
->audio_dev
/ 16);
282 len
+= sprintf (page
+ len
, "/dev/dsp%d\n", card
->audio_dev1
/ 16);
283 len
+= sprintf (page
+ len
, "/dev/mixer%d\n", card
->ac97
.dev_mixer
/ 16);
284 len
+= sprintf (page
+ len
, "/dev/midi%d\n", card
->midi_dev
/ 16);
286 #ifdef EMU10K1_SEQUENCER
287 len
+= sprintf (page
+ len
, "/dev/sequencer\n");
293 static int __devinit
emu10k1_proc_init(struct emu10k1_card
*card
)
297 if (!proc_mkdir ("driver/emu10k1", 0)) {
298 printk(KERN_ERR
"emu10k1: unable to create proc directory driver/emu10k1\n");
302 sprintf(s
, "driver/emu10k1/%s", card
->pci_dev
->slot_name
);
303 if (!proc_mkdir (s
, 0)) {
304 printk(KERN_ERR
"emu10k1: unable to create proc directory %s\n", s
);
305 goto err_emu10k1_proc
;
308 sprintf(s
, "driver/emu10k1/%s/info", card
->pci_dev
->slot_name
);
309 if (!create_proc_read_entry (s
, 0, 0, emu10k1_info_proc
, card
)) {
310 printk(KERN_ERR
"emu10k1: unable to create proc entry %s\n", s
);
317 sprintf(s
, "driver/emu10k1/%s", card
->pci_dev
->slot_name
);
318 remove_proc_entry(s
, NULL
);
321 remove_proc_entry("driver/emu10k1", NULL
);
327 static void __devinit
emu10k1_proc_cleanup(struct emu10k1_card
*card
)
331 sprintf(s
, "driver/emu10k1/%s/info", card
->pci_dev
->slot_name
);
332 remove_proc_entry(s
, NULL
);
334 sprintf(s
, "driver/emu10k1/%s", card
->pci_dev
->slot_name
);
335 remove_proc_entry(s
, NULL
);
337 remove_proc_entry("driver/emu10k1", NULL
);
342 static int __devinit
emu10k1_mixer_init(struct emu10k1_card
*card
)
344 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
347 struct ac97_codec
*codec
= &card
->ac97
;
348 card
->ac97
.dev_mixer
= register_sound_mixer(&emu10k1_mixer_fops
, -1);
349 if (card
->ac97
.dev_mixer
< 0) {
350 printk(KERN_ERR
"emu10k1: cannot register mixer device\n");
354 card
->ac97
.private_data
= card
;
358 card
->ac97
.codec_read
= emu10k1_ac97_read
;
359 card
->ac97
.codec_write
= emu10k1_ac97_write
;
361 if (ac97_probe_codec (&card
->ac97
) == 0) {
362 printk(KERN_ERR
"emu10k1: unable to probe AC97 codec\n");
365 /* 5.1: Enable the additional AC97 Slots and unmute extra channels on AC97 codec */
366 if (codec
->codec_read(codec
, AC97_EXTENDED_ID
) & 0x0080){
367 printk(KERN_INFO
"emu10k1: SBLive! 5.1 card detected\n");
368 sblive_writeptr(card
, AC97SLOT
, 0, AC97SLOT_CNTR
| AC97SLOT_LFE
);
369 codec
->codec_write(codec
, AC97_SURROUND_MASTER
, 0x0);
373 //card->ac97.bit_resolution=5;
375 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
376 sprintf(s
, "driver/emu10k1/%s/ac97", card
->pci_dev
->slot_name
);
377 if (!create_proc_read_entry (s
, 0, 0, ac97_read_proc
, &card
->ac97
)) {
378 printk(KERN_ERR
"emu10k1: unable to create proc entry %s\n", s
);
383 /* these will store the original values and never be modified */
384 card
->ac97_supported_mixers
= card
->ac97
.supported_mixers
;
385 card
->ac97_stereo_mixers
= card
->ac97
.stereo_mixers
;
391 unregister_sound_mixer (card
->ac97
.dev_mixer
);
395 static void __devinit
emu10k1_mixer_cleanup(struct emu10k1_card
*card
)
397 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
401 sprintf(s
, "driver/emu10k1/%s/ac97", card
->pci_dev
->slot_name
);
402 remove_proc_entry(s
, NULL
);
406 unregister_sound_mixer (card
->ac97
.dev_mixer
);
409 static int __devinit
emu10k1_midi_init(struct emu10k1_card
*card
)
413 card
->midi_dev
= register_sound_midi(&emu10k1_midi_fops
, -1);
414 if (card
->midi_dev
< 0) {
415 printk(KERN_ERR
"emu10k1: cannot register midi device!\n");
420 card
->mpuout
= kmalloc(sizeof(struct emu10k1_mpuout
), GFP_KERNEL
);
421 if (card
->mpuout
== NULL
) {
422 printk(KERN_WARNING
"emu10k1: Unable to allocate emu10k1_mpuout: out of memory\n");
427 memset(card
->mpuout
, 0, sizeof(struct emu10k1_mpuout
));
429 card
->mpuout
->intr
= 1;
430 card
->mpuout
->status
= FLAGS_AVAILABLE
;
431 card
->mpuout
->state
= CARDMIDIOUT_STATE_DEFAULT
;
433 tasklet_init(&card
->mpuout
->tasklet
, emu10k1_mpuout_bh
, (unsigned long) card
);
435 spin_lock_init(&card
->mpuout
->lock
);
437 card
->mpuin
= kmalloc(sizeof(struct emu10k1_mpuin
), GFP_KERNEL
);
438 if (card
->mpuin
== NULL
) {
439 printk(KERN_WARNING
"emu10k1: Unable to allocate emu10k1_mpuin: out of memory\n");
444 memset(card
->mpuin
, 0, sizeof(struct emu10k1_mpuin
));
446 card
->mpuin
->status
= FLAGS_AVAILABLE
;
448 tasklet_init(&card
->mpuin
->tasklet
, emu10k1_mpuin_bh
, (unsigned long) card
->mpuin
);
450 spin_lock_init(&card
->mpuin
->lock
);
452 /* Reset the MPU port */
453 if (emu10k1_mpu_reset(card
) < 0) {
459 #ifdef EMU10K1_SEQUENCER
460 card
->seq_dev
= sound_alloc_mididev();
461 if (card
->seq_dev
== -1)
462 printk(KERN_WARNING
"emu10k1: unable to register sequencer device!");
464 std_midi_synth
.midi_dev
= card
->seq_dev
;
465 midi_devs
[card
->seq_dev
] =
466 (struct midi_operations
*)
467 kmalloc(sizeof(struct midi_operations
), GFP_KERNEL
);
469 if (midi_devs
[card
->seq_dev
] == NULL
) {
470 printk(KERN_ERR
"emu10k1: unable to allocate memory!");
471 sound_unload_mididev(card
->seq_dev
);
475 memcpy((char *)midi_devs
[card
->seq_dev
],
476 (char *)&emu10k1_midi_operations
,
477 sizeof(struct midi_operations
));
478 midi_devs
[card
->seq_dev
]->devc
= card
;
482 card
->seq_mididev
= 0;
491 unregister_sound_midi(card
->midi_dev
);
495 static void __devinit
emu10k1_midi_cleanup(struct emu10k1_card
*card
)
497 tasklet_kill(&card
->mpuout
->tasklet
);
500 tasklet_kill(&card
->mpuin
->tasklet
);
503 #ifdef EMU10K1_SEQUENCER
504 if (card
->seq_dev
> -1) {
505 kfree(midi_devs
[card
->seq_dev
]);
506 midi_devs
[card
->seq_dev
] = NULL
;
507 sound_unload_mididev(card
->seq_dev
);
512 unregister_sound_midi(card
->midi_dev
);
517 static void __devinit
voice_init(struct emu10k1_card
*card
)
521 for (i
= 0; i
< NUM_G
; i
++)
522 card
->voicetable
[i
] = VOICE_USAGE_FREE
;
527 static void __devinit
timer_init(struct emu10k1_card
*card
)
529 INIT_LIST_HEAD(&card
->timers
);
530 card
->timer_delay
= TIMER_STOPPED
;
531 card
->timer_lock
= SPIN_LOCK_UNLOCKED
;
537 static void __devinit
addxmgr_init(struct emu10k1_card
*card
)
541 for (count
= 0; count
< MAXPAGES
; count
++)
542 card
->emupagetable
[count
] = 0;
544 /* Mark first page as used */
545 /* This page is reserved by the driver */
546 card
->emupagetable
[0] = 0x8001;
547 card
->emupagetable
[1] = MAXPAGES
- 1;
550 static void __devinit
fx_cleanup(struct patch_manager
*mgr
)
553 for(i
= 0; i
< mgr
->current_pages
; i
++)
554 free_page((unsigned long) mgr
->patch
[i
]);
557 static int __devinit
fx_init(struct emu10k1_card
*card
)
559 struct patch_manager
*mgr
= &card
->mgr
;
560 struct dsp_patch
*patch
;
562 struct dsp_rpatch
*rpatch
;
569 u32 base
, zero
, half
, two
;
570 u32 analog_front_l
, analog_front_r
, analog_rear_l
, analog_rear_r
;
571 u32 analog_surround_l
, analog_surround_r
, analog_center
, analog_lfe
;
572 u32 spdif_front_l
, spdif_front_r
, spdif_rear_l
, spdif_rear_r
;
573 u32 spdif_surround_l
, spdif_surround_r
, spdif_center
, spdif_lfe
;
574 u32 spdif_cd_l
, spdif_cd_r
, spdif_in_l
, spdif_in_r
;
575 u32 adc_rec_l
, adc_rec_r
, ac97_in_l
, ac97_in_r
;
577 struct emu_efx_info_t emu_efx_info
[2]=
578 {{ 20, 10, 0x400, 0x100, 0x20 },
579 { 24, 12, 0x600, 0x400, 0x60 },
583 for (i
= 0; i
< SOUND_MIXER_NRDEVICES
; i
++) {
584 mgr
->ctrl_gpr
[i
][0] = -1;
585 mgr
->ctrl_gpr
[i
][1] = -1;
590 mgr
->current_pages
= (2 + PATCHES_PER_PAGE
- 1) / PATCHES_PER_PAGE
;
592 /* !! The number below must equal the number of patches, currently 11 !! */
593 mgr
->current_pages
= (11 + PATCHES_PER_PAGE
- 1) / PATCHES_PER_PAGE
;
595 for (i
= 0; i
< mgr
->current_pages
; i
++) {
596 mgr
->patch
[i
] = (void *)__get_free_page(GFP_KERNEL
);
597 if (mgr
->patch
[i
] == NULL
) {
598 mgr
->current_pages
= i
;
602 memset(mgr
->patch
[i
], 0, PAGE_SIZE
);
606 if (card
->is_audigy
) {
607 for (i
= 0; i
< 1024; i
++)
608 OP(0xf, 0x0c0, 0x0c0, 0x0cf, 0x0c0);
610 for (i
= 0; i
< 512 ; i
++)
611 sblive_writeptr(card
, A_GPR_BASE
+i
,0,0);
615 OP(0, 0x402, 0x0c0, 0x406, 0x000);
616 OP(0, 0x403, 0x0c0, 0x407, 0x001);
618 //CD-Digital input Volume
619 OP(0, 0x404, 0x0c0, 0x40d, 0x42);
620 OP(0, 0x405, 0x0c0, 0x40f, 0x43);
623 OP(6, 0x400, 0x0c0, 0x402, 0x404);
624 OP(6, 0x401, 0x0c0, 0x403, 0x405);
626 // Front Output + Master Volume
627 OP(0, 0x68, 0x0c0, 0x408, 0x400);
628 OP(0, 0x69, 0x0c0, 0x409, 0x401);
630 // Add-in analog inputs for other speakers
631 OP(6, 0x400, 0x40, 0x400, 0xc0);
632 OP(6, 0x401, 0x41, 0x401, 0xc0);
634 // Digital Front + Master Volume
635 OP(0, 0x60, 0x0c0, 0x408, 0x400);
636 OP(0, 0x61, 0x0c0, 0x409, 0x401);
638 // Rear Output + Rear Volume
639 OP(0, 0x06e, 0x0c0, 0x419, 0x400);
640 OP(0, 0x06f, 0x0c0, 0x41a, 0x401);
642 // Digital Rear Output + Rear Volume
643 OP(0, 0x066, 0x0c0, 0x419, 0x400);
644 OP(0, 0x067, 0x0c0, 0x41a, 0x401);
646 // Audigy Drive, Headphone out
647 OP(6, 0x64, 0x0c0, 0x0c0, 0x400);
648 OP(6, 0x65, 0x0c0, 0x0c0, 0x401);
651 OP(6, 0x76, 0x0c0, 0x0c0, 0x40);
652 OP(6, 0x77, 0x0c0, 0x0c0, 0x41);
654 // Center = sub = Left/2 + Right/2
655 OP(0xe, 0x400, 0x401, 0xcd, 0x400);
657 // center/sub Volume (master)
658 OP(0, 0x06a, 0x0c0, 0x408, 0x400);
659 OP(0, 0x06b, 0x0c0, 0x409, 0x400);
661 // Digital center/sub Volume (master)
662 OP(0, 0x062, 0x0c0, 0x408, 0x400);
663 OP(0, 0x063, 0x0c0, 0x409, 0x400);
665 ROUTING_PATCH_START(rpatch
, "Routing");
666 ROUTING_PATCH_END(rpatch
);
668 /* delimiter patch */
669 patch
= PATCH(mgr
, patch_n
);
670 patch
->code_size
= 0;
673 sblive_writeptr(card
, 0x53, 0, 0);
675 for (i
= 0; i
< 512 ; i
++)
676 OP(6, 0x40, 0x40, 0x40, 0x40);
678 for (i
= 0; i
< 256; i
++)
679 sblive_writeptr_tag(card
, 0,
681 TANKMEMADDRREGBASE
+ i
, 0,
687 //first free GPR = 0x11b
690 /* FX volume correction and Volume control*/
691 INPUT_PATCH_START(patch
, "Pcm L vol", 0x0, 0);
692 GET_OUTPUT_GPR(patch
, 0x100, 0x0);
693 GET_CONTROL_GPR(patch
, 0x106, "Vol", 0, 0x7fffffff);
694 GET_DYNAMIC_GPR(patch
, 0x112);
696 OP(4, 0x112, 0x40, PCM_IN_L
, 0x44); //*4
697 OP(0, 0x100, 0x040, 0x112, 0x106); //*vol
698 INPUT_PATCH_END(patch
);
701 INPUT_PATCH_START(patch
, "Pcm R vol", 0x1, 0);
702 GET_OUTPUT_GPR(patch
, 0x101, 0x1);
703 GET_CONTROL_GPR(patch
, 0x107, "Vol", 0, 0x7fffffff);
704 GET_DYNAMIC_GPR(patch
, 0x112);
706 OP(4, 0x112, 0x40, PCM_IN_R
, 0x44);
707 OP(0, 0x101, 0x040, 0x112, 0x107);
709 INPUT_PATCH_END(patch
);
712 // CD-Digital In Volume control
713 INPUT_PATCH_START(patch
, "CD-Digital Vol L", 0x12, 0);
714 GET_OUTPUT_GPR(patch
, 0x10c, 0x12);
715 GET_CONTROL_GPR(patch
, 0x10d, "Vol", 0, 0x7fffffff);
717 OP(0, 0x10c, 0x040, SPDIF_CD_L
, 0x10d);
718 INPUT_PATCH_END(patch
);
720 INPUT_PATCH_START(patch
, "CD-Digital Vol R", 0x13, 0);
721 GET_OUTPUT_GPR(patch
, 0x10e, 0x13);
722 GET_CONTROL_GPR(patch
, 0x10f, "Vol", 0, 0x7fffffff);
724 OP(0, 0x10e, 0x040, SPDIF_CD_R
, 0x10f);
725 INPUT_PATCH_END(patch
);
727 //Volume Correction for Multi-channel Inputs
728 INPUT_PATCH_START(patch
, "Multi-Channel Gain", 0x08, 0);
729 patch
->input
=patch
->output
=0x3F00;
731 GET_OUTPUT_GPR(patch
, 0x113, MULTI_FRONT_L
);
732 GET_OUTPUT_GPR(patch
, 0x114, MULTI_FRONT_R
);
733 GET_OUTPUT_GPR(patch
, 0x115, MULTI_REAR_L
);
734 GET_OUTPUT_GPR(patch
, 0x116, MULTI_REAR_R
);
735 GET_OUTPUT_GPR(patch
, 0x117, MULTI_CENTER
);
736 GET_OUTPUT_GPR(patch
, 0x118, MULTI_LFE
);
738 OP(4, 0x113, 0x40, MULTI_FRONT_L
, 0x44);
739 OP(4, 0x114, 0x40, MULTI_FRONT_R
, 0x44);
740 OP(4, 0x115, 0x40, MULTI_REAR_L
, 0x44);
741 OP(4, 0x116, 0x40, MULTI_REAR_R
, 0x44);
742 OP(4, 0x117, 0x40, MULTI_CENTER
, 0x44);
743 OP(4, 0x118, 0x40, MULTI_LFE
, 0x44);
745 INPUT_PATCH_END(patch
);
748 //Routing patch start
749 ROUTING_PATCH_START(rpatch
, "Routing");
750 GET_INPUT_GPR(rpatch
, 0x100, 0x0);
751 GET_INPUT_GPR(rpatch
, 0x101, 0x1);
752 GET_INPUT_GPR(rpatch
, 0x10c, 0x12);
753 GET_INPUT_GPR(rpatch
, 0x10e, 0x13);
754 GET_INPUT_GPR(rpatch
, 0x113, MULTI_FRONT_L
);
755 GET_INPUT_GPR(rpatch
, 0x114, MULTI_FRONT_R
);
756 GET_INPUT_GPR(rpatch
, 0x115, MULTI_REAR_L
);
757 GET_INPUT_GPR(rpatch
, 0x116, MULTI_REAR_R
);
758 GET_INPUT_GPR(rpatch
, 0x117, MULTI_CENTER
);
759 GET_INPUT_GPR(rpatch
, 0x118, MULTI_LFE
);
761 GET_DYNAMIC_GPR(rpatch
, 0x102);
762 GET_DYNAMIC_GPR(rpatch
, 0x103);
764 GET_OUTPUT_GPR(rpatch
, 0x104, 0x8);
765 GET_OUTPUT_GPR(rpatch
, 0x105, 0x9);
766 GET_OUTPUT_GPR(rpatch
, 0x10a, 0x2);
767 GET_OUTPUT_GPR(rpatch
, 0x10b, 0x3);
771 OP(6, 0x102, AC97_IN_L
, 0x40, 0x40);
772 OP(6, 0x103, AC97_IN_R
, 0x40, 0x40);
775 /* Digital In + PCM + MULTI_FRONT-> AC97 out (front speakers)*/
776 OP(6, AC97_FRONT_L
, 0x100, 0x10c, 0x113);
778 CONNECT(MULTI_FRONT_L
, AC97_FRONT_L
);
779 CONNECT(PCM_IN_L
, AC97_FRONT_L
);
780 CONNECT(SPDIF_CD_L
, AC97_FRONT_L
);
782 OP(6, AC97_FRONT_R
, 0x101, 0x10e, 0x114);
784 CONNECT(MULTI_FRONT_R
, AC97_FRONT_R
);
785 CONNECT(PCM_IN_R
, AC97_FRONT_R
);
786 CONNECT(SPDIF_CD_R
, AC97_FRONT_R
);
788 /* Digital In + PCM + AC97 In + PCM1 + MULTI_REAR --> Rear Channel */
789 OP(6, 0x104, PCM1_IN_L
, 0x100, 0x115);
790 OP(6, 0x104, 0x104, 0x10c, 0x102);
792 CONNECT(MULTI_REAR_L
, ANALOG_REAR_L
);
793 CONNECT(AC97_IN_L
, ANALOG_REAR_L
);
794 CONNECT(PCM_IN_L
, ANALOG_REAR_L
);
795 CONNECT(SPDIF_CD_L
, ANALOG_REAR_L
);
796 CONNECT(PCM1_IN_L
, ANALOG_REAR_L
);
798 OP(6, 0x105, PCM1_IN_R
, 0x101, 0x116);
799 OP(6, 0x105, 0x105, 0x10e, 0x103);
801 CONNECT(MULTI_REAR_R
, ANALOG_REAR_R
);
802 CONNECT(AC97_IN_R
, ANALOG_REAR_R
);
803 CONNECT(PCM_IN_R
, ANALOG_REAR_R
);
804 CONNECT(SPDIF_CD_R
, ANALOG_REAR_R
);
805 CONNECT(PCM1_IN_R
, ANALOG_REAR_R
);
807 /* Digital In + PCM + AC97 In + MULTI_FRONT --> Digital out */
808 OP(6, 0x10b, 0x100, 0x102, 0x10c);
809 OP(6, 0x10b, 0x10b, 0x113, 0x40);
811 CONNECT(MULTI_FRONT_L
, DIGITAL_OUT_L
);
812 CONNECT(PCM_IN_L
, DIGITAL_OUT_L
);
813 CONNECT(AC97_IN_L
, DIGITAL_OUT_L
);
814 CONNECT(SPDIF_CD_L
, DIGITAL_OUT_L
);
816 OP(6, 0x10a, 0x101, 0x103, 0x10e);
817 OP(6, 0x10b, 0x10b, 0x114, 0x40);
819 CONNECT(MULTI_FRONT_R
, DIGITAL_OUT_R
);
820 CONNECT(PCM_IN_R
, DIGITAL_OUT_R
);
821 CONNECT(AC97_IN_R
, DIGITAL_OUT_R
);
822 CONNECT(SPDIF_CD_R
, DIGITAL_OUT_R
);
824 /* AC97 In --> ADC Recording Buffer */
825 OP(6, ADC_REC_L
, 0x102, 0x40, 0x40);
827 CONNECT(AC97_IN_L
, ADC_REC_L
);
829 OP(6, ADC_REC_R
, 0x103, 0x40, 0x40);
831 CONNECT(AC97_IN_R
, ADC_REC_R
);
833 /* fx12:Analog-Center */
834 OP(6, ANALOG_CENTER
, 0x117, 0x40, 0x40);
835 CONNECT(MULTI_CENTER
, ANALOG_CENTER
);
837 /* fx11:Analog-LFE */
838 OP(6, ANALOG_LFE
, 0x118, 0x40, 0x40);
839 CONNECT(MULTI_LFE
, ANALOG_LFE
);
841 /* fx12:Digital-Center */
842 OP(6, DIGITAL_CENTER
, 0x117, 0x40, 0x40);
843 CONNECT(MULTI_CENTER
, DIGITAL_CENTER
);
845 /* fx11:Analog-LFE */
846 OP(6, DIGITAL_LFE
, 0x118, 0x40, 0x40);
847 CONNECT(MULTI_LFE
, DIGITAL_LFE
);
849 ROUTING_PATCH_END(rpatch
);
852 // Rear volume control
853 OUTPUT_PATCH_START(patch
, "Vol Rear L", 0x8, 0);
854 GET_INPUT_GPR(patch
, 0x104, 0x8);
855 GET_CONTROL_GPR(patch
, 0x119, "Vol", 0, 0x7fffffff);
857 OP(0, ANALOG_REAR_L
, 0x040, 0x104, 0x119);
858 OUTPUT_PATCH_END(patch
);
860 OUTPUT_PATCH_START(patch
, "Vol Rear R", 0x9, 0);
861 GET_INPUT_GPR(patch
, 0x105, 0x9);
862 GET_CONTROL_GPR(patch
, 0x11a, "Vol", 0, 0x7fffffff);
864 OP(0, ANALOG_REAR_R
, 0x040, 0x105, 0x11a);
865 OUTPUT_PATCH_END(patch
);
868 //Master volume control on front-digital
869 OUTPUT_PATCH_START(patch
, "Vol Master L", 0x2, 1);
870 GET_INPUT_GPR(patch
, 0x10a, 0x2);
871 GET_CONTROL_GPR(patch
, 0x108, "Vol", 0, 0x7fffffff);
873 OP(0, DIGITAL_OUT_L
, 0x040, 0x10a, 0x108);
874 OUTPUT_PATCH_END(patch
);
877 OUTPUT_PATCH_START(patch
, "Vol Master R", 0x3, 1);
878 GET_INPUT_GPR(patch
, 0x10b, 0x3);
879 GET_CONTROL_GPR(patch
, 0x109, "Vol", 0, 0x7fffffff);
881 OP(0, DIGITAL_OUT_R
, 0x040, 0x10b, 0x109);
882 OUTPUT_PATCH_END(patch
);
884 /* delimiter patch */
885 patch
= PATCH(mgr
, patch_n
);
886 patch
->code_size
= 0;
889 sblive_writeptr(card
, DBG
, 0, 0);
894 if (card
->is_audigy
) {
895 for (i
= 0; i
< 1024; i
++)
896 OP(0xf, 0x0c0, 0x0c0, 0x0cf, 0x0c0);
898 for (i
= 0; i
< 512 ; i
++)
899 sblive_writeptr(card
, A_GPR_BASE
+i
,0,0);
905 analog_front_l
= A_ANALOG_FRONT_L
;
906 analog_front_r
= A_ANALOG_FRONT_R
;
907 analog_rear_l
= A_ANALOG_REAR_L
;
908 analog_rear_r
= A_ANALOG_REAR_R
;
909 analog_surround_l
= A_ANALOG_SURROUND_L
;
910 analog_surround_r
= A_ANALOG_SURROUND_R
;
911 analog_center
= A_ANALOG_CENTER
;
912 analog_lfe
= A_ANALOG_LFE
;
913 spdif_front_l
= A_SPDIF_FRONT_L
;
914 spdif_front_r
= A_SPDIF_FRONT_R
;
915 spdif_rear_l
= A_SPDIF_REAR_L
;
916 spdif_rear_r
= A_SPDIF_REAR_R
;
917 spdif_surround_l
= A_SPDIF_SURROUND_L
;
918 spdif_surround_r
= A_SPDIF_SURROUND_R
;
919 spdif_center
= A_SPDIF_CENTER
;
920 spdif_lfe
= A_SPDIF_LFE
;
921 spdif_cd_l
= A_SPDIF_CD_L
;
922 spdif_cd_r
= A_SPDIF_CD_R
;
923 spdif_in_l
= A_SPDIF_IN_L
;
924 spdif_in_r
= A_SPDIF_IN_R
;
925 adc_rec_l
= A_ADC_REC_L
;
926 adc_rec_r
= A_ADC_REC_R
;
927 ac97_in_l
= A_AC97_IN_L
;
928 ac97_in_r
= A_AC97_IN_R
;
931 for (i
= 0; i
< 512 ; i
++)
932 OP(6, 0x40, 0x40, 0x40, 0x40);
934 for (i
= 0; i
< 256; i
++)
935 sblive_writeptr_tag(card
, 0,
937 TANKMEMADDRREGBASE
+ i
, 0,
943 analog_front_l
= L_ANALOG_FRONT_L
;
944 analog_front_r
= L_ANALOG_FRONT_R
;
945 analog_rear_l
= L_ANALOG_REAR_L
;
946 analog_rear_r
= L_ANALOG_REAR_R
;
947 analog_surround_l
= GPR_BASE
+ RES_JUNK
;
948 analog_surround_r
= GPR_BASE
+ RES_JUNK
;
949 analog_center
= L_ANALOG_CENTER
;
950 analog_lfe
= L_ANALOG_LFE
;
951 spdif_front_l
= L_SPDIF_FRONT_L
;
952 spdif_front_r
= L_SPDIF_FRONT_R
;
953 spdif_rear_l
= GPR_BASE
+ RES_JUNK
;
954 spdif_rear_r
= GPR_BASE
+ RES_JUNK
;
955 spdif_surround_l
= L_SPDIF_SURROUND_L
;
956 spdif_surround_r
= L_SPDIF_SURROUND_R
;
957 spdif_center
= L_SPDIF_CENTER
;
958 spdif_lfe
= L_SPDIF_LFE
;
959 spdif_cd_l
= L_SPDIF_CD_L
;
960 spdif_cd_r
= L_SPDIF_CD_R
;
961 spdif_in_l
= L_SPDIF_IN_L
;
962 spdif_in_r
= L_SPDIF_IN_R
;
963 adc_rec_l
= L_ADC_REC_L
;
964 adc_rec_r
= L_ADC_REC_R
;
965 ac97_in_l
= L_AC97_IN_L
;
966 ac97_in_r
= L_AC97_IN_R
;
971 /* Scale AHI streams */
972 OP(0, RES_AHI_FRONT_L
+base
, zero
, AHI_FRONT_L
, VOL_AHI_FRONT_L
+base
);
973 OP(0, RES_AHI_FRONT_R
+base
, zero
, AHI_FRONT_R
, VOL_AHI_FRONT_R
+base
);
974 OP(0, RES_AHI_REAR_L
+base
, zero
, AHI_REAR_L
, VOL_AHI_REAR_L
+base
);
975 OP(0, RES_AHI_REAR_R
+base
, zero
, AHI_REAR_R
, VOL_AHI_REAR_R
+base
);
976 OP(0, RES_AHI_SURROUND_L
+base
, zero
, AHI_SURROUND_L
, VOL_AHI_SURROUND_L
+base
);
977 OP(0, RES_AHI_SURROUND_R
+base
, zero
, AHI_SURROUND_R
, VOL_AHI_SURROUND_R
+base
);
978 OP(0, RES_AHI_CENTER
+base
, zero
, AHI_CENTER
, VOL_AHI_CENTER
+base
);
979 OP(0, RES_AHI_LFE
+base
, zero
, AHI_LFE
, VOL_AHI_LFE
+base
);
981 /* +6 dB volume correction, to make the streams use the full
982 * dynamic range (Why, oh why?) */
983 OP(4, RES_AHI_FRONT_L
+base
, zero
, RES_AHI_FRONT_L
+base
, two
);
984 OP(4, RES_AHI_FRONT_R
+base
, zero
, RES_AHI_FRONT_R
+base
, two
);
985 OP(4, RES_AHI_REAR_L
+base
, zero
, RES_AHI_REAR_L
+base
, two
);
986 OP(4, RES_AHI_REAR_R
+base
, zero
, RES_AHI_REAR_R
+base
, two
);
987 OP(4, RES_AHI_SURROUND_L
+base
, zero
, RES_AHI_SURROUND_L
+base
, two
);
988 OP(4, RES_AHI_SURROUND_R
+base
, zero
, RES_AHI_SURROUND_R
+base
, two
);
989 OP(4, RES_AHI_CENTER
+base
, zero
, RES_AHI_CENTER
+base
, two
);
990 OP(4, RES_AHI_LFE
+base
, zero
, RES_AHI_LFE
+base
, two
);
992 /* Scale digital CD in */
993 OP(0, RES_SPDIF_CD_L
+base
, zero
, spdif_cd_l
, VOL_SPDIF_CD_L
+base
);
994 OP(0, RES_SPDIF_CD_R
+base
, zero
, spdif_cd_r
, VOL_SPDIF_CD_R
+base
);
996 /* Scale S/PDIF in */
997 OP(0, RES_SPDIF_IN_L
+base
, zero
, spdif_in_l
, VOL_SPDIF_IN_L
+base
);
998 OP(0, RES_SPDIF_IN_R
+base
, zero
, spdif_in_r
, VOL_SPDIF_IN_R
+base
);
1000 /* Scale AHI_FRONT to rear */
1001 OP(0, RES_FRONT_REAR_L
+base
, zero
, RES_AHI_FRONT_L
+base
, VOL_FRONT_REAR_L
+base
);
1002 OP(0, RES_FRONT_REAR_R
+base
, zero
, RES_AHI_FRONT_R
+base
, VOL_FRONT_REAR_R
+base
);
1004 /* Scale AHI_SURROUND to rear */
1005 OP(0, RES_SURROUND_REAR_L
+base
, zero
, RES_AHI_SURROUND_L
+base
, VOL_SURROUND_REAR_L
+base
);
1006 OP(0, RES_SURROUND_REAR_R
+base
, zero
, RES_AHI_SURROUND_R
+base
, VOL_SURROUND_REAR_R
+base
);
1008 /* Scale AHI_FRONT to center/LFE */
1009 OP(0xe, RES_FRONT_MONO
+base
, RES_AHI_FRONT_L
+base
, half
, RES_AHI_FRONT_R
+base
); // Left/2 + Right/2
1010 OP(0, RES_FRONT_CENTER
+base
, zero
, RES_FRONT_MONO
+base
, VOL_FRONT_CENTER
+base
);
1011 OP(0, RES_FRONT_LFE
+base
, zero
, RES_FRONT_MONO
+base
, VOL_FRONT_LFE
+base
);
1013 /* Sum RES_AHI_FRONT + RES_SPDIF_CD + RES_SPDIF_IN */
1014 OP(6, SUM_FRONT_L
+base
, RES_AHI_FRONT_L
+base
, RES_SPDIF_CD_L
+base
, RES_SPDIF_CD_L
+base
);
1015 OP(6, SUM_FRONT_R
+base
, RES_AHI_FRONT_R
+base
, RES_SPDIF_CD_R
+base
, RES_SPDIF_CD_R
+base
);
1017 /* Sum RES_AHI_REAR + RES_FRONT_REAR + RES_SURROUND_REAR */
1018 OP(6, SUM_REAR_L
+base
, RES_AHI_REAR_L
+base
, RES_FRONT_REAR_L
+base
, RES_SURROUND_REAR_L
+base
);
1019 OP(6, SUM_REAR_R
+base
, RES_AHI_REAR_R
+base
, RES_FRONT_REAR_R
+base
, RES_SURROUND_REAR_R
+base
);
1021 /* "Sum" RES_AHI_SURROUND */
1022 OP(6, SUM_SURROUND_L
+base
, RES_AHI_SURROUND_L
+base
, zero
, zero
);
1023 OP(6, SUM_SURROUND_R
+base
, RES_AHI_SURROUND_R
+base
, zero
, zero
);
1025 /* Sum RES_AHI_CENTER/RES_AHI_LFE + AHI_FRONT mix-in */
1026 OP(6, SUM_CENTER
+base
, RES_AHI_CENTER
+base
, RES_FRONT_CENTER
+base
, zero
);
1027 OP(6, SUM_LFE
+base
, RES_AHI_LFE
+base
, RES_FRONT_LFE
+base
, zero
);
1031 OP(0, analog_front_l
, zero
, SUM_FRONT_L
+base
, VOL_ANALOG_FRONT_L
+base
);
1032 OP(0, analog_front_r
, zero
, SUM_FRONT_R
+base
, VOL_ANALOG_FRONT_R
+base
);
1033 OP(0, analog_rear_l
, zero
, SUM_REAR_L
+base
, VOL_ANALOG_REAR_L
+base
);
1034 OP(0, analog_rear_r
, zero
, SUM_REAR_R
+base
, VOL_ANALOG_REAR_R
+base
);
1035 OP(0, analog_surround_l
, zero
, SUM_SURROUND_L
+base
, VOL_ANALOG_SURROUND_L
+base
);
1036 OP(0, analog_surround_r
, zero
, SUM_SURROUND_R
+base
, VOL_ANALOG_SURROUND_R
+base
);
1037 OP(0, analog_center
, zero
, SUM_CENTER
+base
, VOL_ANALOG_CENTER
+base
);
1038 OP(0, analog_lfe
, zero
, SUM_LFE
+base
, VOL_ANALOG_LFE
+base
);
1040 /* Digital SPDIF output */
1041 OP(0, spdif_front_l
, zero
, SUM_FRONT_L
+base
, VOL_SPDIF_FRONT_L
+base
);
1042 OP(0, spdif_front_r
, zero
, SUM_FRONT_R
+base
, VOL_SPDIF_FRONT_R
+base
);
1043 OP(0, spdif_rear_l
, zero
, SUM_REAR_L
+base
, VOL_SPDIF_REAR_L
+base
);
1044 OP(0, spdif_rear_r
, zero
, SUM_REAR_R
+base
, VOL_SPDIF_REAR_R
+base
);
1045 OP(0, spdif_surround_l
, zero
, SUM_SURROUND_L
+base
, VOL_SPDIF_SURROUND_L
+base
);
1046 OP(0, spdif_surround_r
, zero
, SUM_SURROUND_R
+base
, VOL_SPDIF_SURROUND_R
+base
);
1047 OP(0, spdif_center
, zero
, SUM_CENTER
+base
, VOL_SPDIF_CENTER
+base
);
1048 OP(0, spdif_lfe
, zero
, SUM_LFE
+base
, VOL_SPDIF_LFE
+base
);
1051 /* Connect AC97 to ADC */
1052 OP(6, adc_rec_l
, ac97_in_l
, zero
, zero
);
1053 OP(6, adc_rec_r
, ac97_in_r
, zero
, zero
);
1056 /* delimiter patch */
1057 patch
= PATCH(mgr
, patch_n
);
1058 patch
->code_size
= 0;
1060 if (card
->is_audigy
) {
1061 sblive_writeptr(card
, 0x53, 0, 0);
1064 sblive_writeptr(card
, DBG
, 0, 0);
1067 /* Set the AHI stream volume controls to full volume */
1068 emu10k1_set_volume_gpr(card
, VOL_AHI_FRONT_L
, 100, VOL_5BIT
);
1069 emu10k1_set_volume_gpr(card
, VOL_AHI_FRONT_R
, 100, VOL_5BIT
);
1070 emu10k1_set_volume_gpr(card
, VOL_AHI_REAR_L
, 100, VOL_5BIT
);
1071 emu10k1_set_volume_gpr(card
, VOL_AHI_REAR_R
, 100, VOL_5BIT
);
1072 emu10k1_set_volume_gpr(card
, VOL_AHI_SURROUND_L
, 100, VOL_5BIT
);
1073 emu10k1_set_volume_gpr(card
, VOL_AHI_SURROUND_R
, 100, VOL_5BIT
);
1074 emu10k1_set_volume_gpr(card
, VOL_AHI_CENTER
, 100, VOL_5BIT
);
1075 emu10k1_set_volume_gpr(card
, VOL_AHI_LFE
, 100, VOL_5BIT
);
1077 /* Enable surround-to-rear routing */
1078 emu10k1_set_volume_gpr(card
, VOL_SURROUND_REAR_L
, 100, VOL_5BIT
);
1079 emu10k1_set_volume_gpr(card
, VOL_SURROUND_REAR_R
, 100, VOL_5BIT
);
1081 /* Enable front-to-center/LFE routing */
1082 emu10k1_set_volume_gpr(card
, VOL_FRONT_CENTER
, 100, VOL_5BIT
);
1083 emu10k1_set_volume_gpr(card
, VOL_FRONT_LFE
, 100, VOL_5BIT
);
1085 /* Set the digital input volume controls to full volume */
1086 emu10k1_set_volume_gpr(card
, VOL_SPDIF_CD_L
, 100, VOL_5BIT
);
1087 emu10k1_set_volume_gpr(card
, VOL_SPDIF_CD_R
, 100, VOL_5BIT
);
1088 emu10k1_set_volume_gpr(card
, VOL_SPDIF_IN_L
, 100, VOL_5BIT
);
1089 emu10k1_set_volume_gpr(card
, VOL_SPDIF_IN_R
, 100, VOL_5BIT
);
1091 /* Set the analog output volume controls to full volume */
1092 emu10k1_set_volume_gpr(card
, VOL_ANALOG_FRONT_L
, 100, VOL_5BIT
);
1093 emu10k1_set_volume_gpr(card
, VOL_ANALOG_FRONT_R
, 100, VOL_5BIT
);
1094 emu10k1_set_volume_gpr(card
, VOL_ANALOG_REAR_L
, 100, VOL_5BIT
);
1095 emu10k1_set_volume_gpr(card
, VOL_ANALOG_REAR_R
, 100, VOL_5BIT
);
1096 emu10k1_set_volume_gpr(card
, VOL_ANALOG_SURROUND_L
, 100, VOL_5BIT
);
1097 emu10k1_set_volume_gpr(card
, VOL_ANALOG_SURROUND_R
, 100, VOL_5BIT
);
1098 emu10k1_set_volume_gpr(card
, VOL_ANALOG_CENTER
, 100, VOL_5BIT
);
1099 emu10k1_set_volume_gpr(card
, VOL_ANALOG_LFE
, 100, VOL_5BIT
);
1101 /* Set the digital output volume controls to full volume */
1102 emu10k1_set_volume_gpr(card
, VOL_SPDIF_FRONT_L
, 100, VOL_5BIT
);
1103 emu10k1_set_volume_gpr(card
, VOL_SPDIF_FRONT_R
, 100, VOL_5BIT
);
1104 emu10k1_set_volume_gpr(card
, VOL_SPDIF_REAR_L
, 100, VOL_5BIT
);
1105 emu10k1_set_volume_gpr(card
, VOL_SPDIF_REAR_R
, 100, VOL_5BIT
);
1106 emu10k1_set_volume_gpr(card
, VOL_SPDIF_SURROUND_L
, 100, VOL_5BIT
);
1107 emu10k1_set_volume_gpr(card
, VOL_SPDIF_SURROUND_R
, 100, VOL_5BIT
);
1108 emu10k1_set_volume_gpr(card
, VOL_SPDIF_CENTER
, 100, VOL_5BIT
);
1109 emu10k1_set_volume_gpr(card
, VOL_SPDIF_LFE
, 100, VOL_5BIT
);
1113 mgr
->lock
= SPIN_LOCK_UNLOCKED
;
1115 // Set up Volume controls, try to keep this the same for both Audigy and Live
1118 mgr
->ctrl_gpr
[SOUND_MIXER_VOLUME
][0] = 8;
1119 mgr
->ctrl_gpr
[SOUND_MIXER_VOLUME
][1] = 9;
1121 left
= card
->ac97
.mixer_state
[SOUND_MIXER_VOLUME
] & 0xff;
1122 right
= (card
->ac97
.mixer_state
[SOUND_MIXER_VOLUME
] >> 8) & 0xff;
1124 emu10k1_set_volume_gpr(card
, 8, left
, 1 << card
->ac97
.bit_resolution
);
1125 emu10k1_set_volume_gpr(card
, 9, right
, 1 << card
->ac97
.bit_resolution
);
1128 mgr
->ctrl_gpr
[ SOUND_MIXER_OGAIN
][0] = 0x19;
1129 mgr
->ctrl_gpr
[ SOUND_MIXER_OGAIN
][1] = 0x1a;
1133 card
->ac97
.mixer_state
[SOUND_MIXER_OGAIN
] = (right
<< 8) | left
;
1135 card
->ac97
.supported_mixers
|= SOUND_MASK_OGAIN
;
1136 card
->ac97
.stereo_mixers
|= SOUND_MASK_OGAIN
;
1138 emu10k1_set_volume_gpr(card
, 0x19, left
, VOL_5BIT
);
1139 emu10k1_set_volume_gpr(card
, 0x1a, right
, VOL_5BIT
);
1142 mgr
->ctrl_gpr
[SOUND_MIXER_PCM
][0] = 6;
1143 mgr
->ctrl_gpr
[SOUND_MIXER_PCM
][1] = 7;
1145 left
= card
->ac97
.mixer_state
[SOUND_MIXER_PCM
] & 0xff;
1146 right
= (card
->ac97
.mixer_state
[SOUND_MIXER_PCM
] >> 8) & 0xff;
1148 emu10k1_set_volume_gpr(card
, 6, left
, VOL_5BIT
);
1149 emu10k1_set_volume_gpr(card
, 7, right
, VOL_5BIT
);
1152 mgr
->ctrl_gpr
[SOUND_MIXER_DIGITAL1
][0] = 0xd;
1153 mgr
->ctrl_gpr
[SOUND_MIXER_DIGITAL1
][1] = 0xf;
1156 card
->ac97
.mixer_state
[SOUND_MIXER_DIGITAL1
] = (right
<< 8) | left
;
1158 card
->ac97
.supported_mixers
|= SOUND_MASK_DIGITAL1
;
1159 card
->ac97
.stereo_mixers
|= SOUND_MASK_DIGITAL1
;
1161 emu10k1_set_volume_gpr(card
, 0xd, left
, VOL_5BIT
);
1162 emu10k1_set_volume_gpr(card
, 0xf, right
, VOL_5BIT
);
1164 //hard wire the ac97's pcm, pcm volume is done above using dsp code.
1165 if (card
->is_audigy
)
1166 //for Audigy, we mute it and use the philips 6 channel DAC instead
1167 emu10k1_ac97_write(&card
->ac97
, 0x18, 0x8000);
1169 //For the Live we hardwire it to full volume
1170 emu10k1_ac97_write(&card
->ac97
, 0x18, 0x0);
1172 //remove it from the ac97_codec's control
1173 card
->ac97_supported_mixers
&= ~SOUND_MASK_PCM
;
1174 card
->ac97_stereo_mixers
&= ~SOUND_MASK_PCM
;
1176 //set Igain to 0dB by default, maybe consider hardwiring it here.
1177 emu10k1_ac97_write(&card
->ac97
, AC97_RECORD_GAIN
, 0x0000);
1178 card
->ac97
.mixer_state
[SOUND_MIXER_IGAIN
] = 0x101;
1183 static int __devinit
hw_init(struct emu10k1_card
*card
)
1186 u32 pagecount
; /* tmp */
1189 /* Disable audio and lock cache */
1190 emu10k1_writefn0(card
, HCFG
, HCFG_LOCKSOUNDCACHE
| HCFG_LOCKTANKCACHE_MASK
| HCFG_MUTEBUTTONENABLE
);
1192 /* Reset recording buffers */
1193 sblive_writeptr_tag(card
, 0,
1194 MICBS
, ADCBS_BUFSIZE_NONE
,
1196 FXBS
, ADCBS_BUFSIZE_NONE
,
1198 ADCBS
, ADCBS_BUFSIZE_NONE
,
1202 /* Disable channel interrupt */
1203 emu10k1_writefn0(card
, INTE
, 0);
1205 sblive_writeptr_tag(card
, 0,
1212 if (card
->is_audigy
) {
1213 sblive_writeptr_tag(card
,0,
1219 /* Init envelope engine */
1220 for (nCh
= 0; nCh
< NUM_G
; nCh
++) {
1221 sblive_writeptr_tag(card
, nCh
,
1242 TREMFRQ
, 24, /* 1 Hz */
1243 FM2FRQ2
, 24, /* 1 Hz */
1246 /*** These are last so OFF prevents writing ***/
1254 sblive_writeptr(card
, CPF
, nCh
, 0);
1256 Audigy FXRT initialization
1257 reversed eng'd, may not be accurate.
1259 if (card
->is_audigy
) {
1260 sblive_writeptr_tag(card
,nCh
,
1265 A_FXRT1
, 0x3f3f3f3f,
1266 A_FXRT2
, 0x3f3f3f3f,
1274 ** Init to 0x02109204 :
1275 ** Clock accuracy = 0 (1000ppm)
1276 ** Sample Rate = 2 (48kHz)
1277 ** Audio Channel = 1 (Left of 2)
1278 ** Source Number = 0 (Unspecified)
1279 ** Generation Status = 1 (Original for Cat Code 12)
1280 ** Cat Code = 12 (Digital Signal Mixer)
1281 ** Mode = 0 (Mode 0)
1282 ** Emphasis = 0 (None)
1283 ** CP = 1 (Copyright unasserted)
1284 ** AN = 0 (Digital audio)
1288 sblive_writeptr_tag(card
, 0,
1291 SPCS0
, (SPCS_CLKACCY_1000PPM
| 0x002000000 |
1292 SPCS_CHANNELNUM_LEFT
| SPCS_SOURCENUM_UNSPEC
| SPCS_GENERATIONSTATUS
| 0x00001200 | SPCS_EMPHASIS_NONE
| SPCS_COPYRIGHT
),
1295 SPCS1
, (SPCS_CLKACCY_1000PPM
| 0x002000000 |
1296 SPCS_CHANNELNUM_LEFT
| SPCS_SOURCENUM_UNSPEC
| SPCS_GENERATIONSTATUS
| 0x00001200 | SPCS_EMPHASIS_NONE
| SPCS_COPYRIGHT
),
1298 /* SPDIF2 & SPDIF3 */
1299 SPCS2
, (SPCS_CLKACCY_1000PPM
| 0x002000000 |
1300 SPCS_CHANNELNUM_LEFT
| SPCS_SOURCENUM_UNSPEC
| SPCS_GENERATIONSTATUS
| 0x00001200 | SPCS_EMPHASIS_NONE
| SPCS_COPYRIGHT
),
1304 if (card
->is_audigy
&& (card
->chiprev
== 4)) {
1305 /* Hacks for Alice3 to work independent of haP16V driver */
1308 //Setup SRCMulti_I2S SamplingRate
1309 tmp
= sblive_readptr(card
, A_SPDIF_SAMPLERATE
, 0);
1312 sblive_writeptr(card
, A_SPDIF_SAMPLERATE
, 0, tmp
);
1314 /* Setup SRCSel (Enable Spdif,I2S SRCMulti) */
1315 emu10k1_writefn0(card
, 0x20, 0x600000);
1316 emu10k1_writefn0(card
, 0x24, 0x14);
1318 /* Setup SRCMulti Input Audio Enable */
1319 emu10k1_writefn0(card
, 0x20, 0x6E0000);
1320 emu10k1_writefn0(card
, 0x24, 0xFF00FF00);
1323 ret
= fx_init(card
); /* initialize effects engine */
1327 card
->tankmem
.size
= 0;
1329 card
->virtualpagetable
.size
= MAXPAGES
* sizeof(u32
);
1331 card
->virtualpagetable
.addr
= pci_alloc_consistent(card
->pci_dev
, card
->virtualpagetable
.size
, &card
->virtualpagetable
.dma_handle
);
1332 if (card
->virtualpagetable
.addr
== NULL
) {
1338 card
->silentpage
.size
= EMUPAGESIZE
;
1340 card
->silentpage
.addr
= pci_alloc_consistent(card
->pci_dev
, card
->silentpage
.size
, &card
->silentpage
.dma_handle
);
1341 if (card
->silentpage
.addr
== NULL
) {
1347 for (pagecount
= 0; pagecount
< MAXPAGES
; pagecount
++)
1348 ((u32
*) card
->virtualpagetable
.addr
)[pagecount
] = cpu_to_le32(((u32
) card
->silentpage
.dma_handle
* 2) |
1351 /* Init page table & tank memory base register */
1352 sblive_writeptr_tag(card
, 0,
1353 PTB
, (u32
) card
->virtualpagetable
.dma_handle
,
1358 for (nCh
= 0; nCh
< NUM_G
; nCh
++) {
1359 sblive_writeptr_tag(card
, nCh
,
1360 MAPA
, MAP_PTI_MASK
| ((u32
) card
->silentpage
.dma_handle
* 2),
1361 MAPB
, MAP_PTI_MASK
| ((u32
) card
->silentpage
.dma_handle
* 2),
1365 /* Hokay, now enable the AUD bit */
1366 /* Enable Audio = 1 */
1367 /* Mute Disable Audio = 0 */
1368 /* Lock Tank Memory = 1 */
1369 /* Lock Sound Memory = 0 */
1371 if (card
->is_audigy
) {
1372 if (card
->chiprev
== 4)
1373 emu10k1_writefn0(card
, HCFG
, HCFG_AUDIOENABLE
| HCFG_AC3ENABLE_CDSPDIF
| HCFG_AC3ENABLE_GPSPDIF
| HCFG_AUTOMUTE
| HCFG_JOYENABLE
);
1375 emu10k1_writefn0(card
, HCFG
, HCFG_AUDIOENABLE
| HCFG_AUTOMUTE
| HCFG_JOYENABLE
);
1377 if (card
->model
== 0x20 || card
->model
== 0xc400 ||
1378 (card
->model
== 0x21 && card
->chiprev
< 6))
1379 emu10k1_writefn0(card
, HCFG
, HCFG_AUDIOENABLE
| HCFG_LOCKTANKCACHE_MASK
| HCFG_AUTOMUTE
);
1381 emu10k1_writefn0(card
, HCFG
, HCFG_AUDIOENABLE
| HCFG_LOCKTANKCACHE_MASK
| HCFG_AUTOMUTE
| HCFG_JOYENABLE
);
1383 /* Enable Vol_Ctrl irqs */
1384 emu10k1_irq_enable(card
, INTE_VOLINCRENABLE
| INTE_VOLDECRENABLE
| INTE_MUTEENABLE
| INTE_FXDSPENABLE
);
1386 if (card
->is_audigy
&& (card
->chiprev
== 4)) {
1387 /* Unmute Analog now. Set GPO6 to 1 for Apollo.
1388 * This has to be done after init ALice3 I2SOut beyond 48KHz.
1389 * So, sequence is important. */
1390 u32 tmp
= emu10k1_readfn0(card
, A_IOCFG
);
1392 emu10k1_writefn0(card
, A_IOCFG
, tmp
);
1395 /* FIXME: TOSLink detection */
1396 card
->has_toslink
= 0;
1399 /* Initialize digital passthrough variables */
1400 card
->pt
.pos_gpr
= card
->pt
.intr_gpr
= card
->pt
.enable_gpr
= -1;
1401 card
->pt
.selected
= 0;
1402 card
->pt
.state
= PT_STATE_INACTIVE
;
1403 card
->pt
.spcs_to_use
= 0x01;
1404 card
->pt
.patch_name
= "AC3pass";
1405 card
->pt
.intr_gpr_name
= "count";
1406 card
->pt
.enable_gpr_name
= "enable";
1407 card
->pt
.pos_gpr_name
= "ptr";
1408 spin_lock_init(&card
->pt
.lock
);
1409 init_waitqueue_head(&card
->pt
.wait
);
1412 /* tmp = sblive_readfn0(card, HCFG);
1413 if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) {
1414 sblive_writefn0(card, HCFG, tmp | 0x800);
1418 if (tmp != (sblive_readfn0(card, HCFG) & ~0x800)) {
1419 card->has_toslink = 1;
1420 sblive_writefn0(card, HCFG, tmp);
1427 pci_free_consistent(card
->pci_dev
, card
->virtualpagetable
.size
, card
->virtualpagetable
.addr
, card
->virtualpagetable
.dma_handle
);
1429 fx_cleanup(&card
->mgr
);
1434 /* static */ int __devinit
emu10k1_init(struct emu10k1_card
*card
)
1437 if (hw_init(card
) < 0)
1446 DPD(2, " hw control register -> %#x\n", emu10k1_readfn0(card
, HCFG
));
1451 /* static */ void __devinit
emu10k1_cleanup(struct emu10k1_card
*card
)
1455 emu10k1_writefn0(card
, INTE
, 0);
1457 /** Shutdown the chip **/
1458 for (ch
= 0; ch
< NUM_G
; ch
++)
1459 sblive_writeptr(card
, DCYSUSV
, ch
, 0);
1461 for (ch
= 0; ch
< NUM_G
; ch
++) {
1462 sblive_writeptr_tag(card
, ch
,
1468 sblive_writeptr(card
, CPF
, ch
, 0);
1471 /* Disable audio and lock cache */
1472 emu10k1_writefn0(card
, HCFG
, HCFG_LOCKSOUNDCACHE
| HCFG_LOCKTANKCACHE_MASK
| HCFG_MUTEBUTTONENABLE
);
1474 sblive_writeptr_tag(card
, 0,
1477 /* Reset recording buffers */
1478 MICBS
, ADCBS_BUFSIZE_NONE
,
1480 FXBS
, ADCBS_BUFSIZE_NONE
,
1483 ADCBS
, ADCBS_BUFSIZE_NONE
,
1489 /* Disable channel interrupt */
1496 if (card
->is_audigy
)
1497 sblive_writeptr(card
, 0, A_DBG
, A_DBG_SINGLE_STEP
);
1500 pci_free_consistent(card
->pci_dev
, card
->virtualpagetable
.size
, card
->virtualpagetable
.addr
, card
->virtualpagetable
.dma_handle
);
1501 pci_free_consistent(card
->pci_dev
, card
->silentpage
.size
, card
->silentpage
.addr
, card
->silentpage
.dma_handle
);
1503 if(card
->tankmem
.size
!= 0)
1504 pci_free_consistent(card
->pci_dev
, card
->tankmem
.size
, card
->tankmem
.addr
, card
->tankmem
.dma_handle
);
1506 /* release patch storage memory */
1507 fx_cleanup(&card
->mgr
);
1512 /* Driver initialization routine */
1513 static int __devinit
emu10k1_probe(struct pci_dev
*pci_dev
, const struct pci_device_id
*pci_id
)
1515 struct emu10k1_card
*card
;
1519 if (pci_set_dma_mask(pci_dev
, EMU10K1_DMA_MASK
)) {
1520 printk(KERN_ERR
"emu10k1: architecture does not support 31bit PCI busmaster DMA\n");
1524 if (pci_enable_device(pci_dev
))
1527 pci_set_master(pci_dev
);
1529 if ((card
= kmalloc(sizeof(struct emu10k1_card
), GFP_KERNEL
)) == NULL
) {
1530 printk(KERN_ERR
"emu10k1: out of memory\n");
1533 memset(card
, 0, sizeof(struct emu10k1_card
));
1535 card
->iobase
= pci_resource_start(pci_dev
, 0);
1536 card
->length
= pci_resource_len(pci_dev
, 0);
1538 if (compat_request_region(card
->iobase
, card
->length
, card_names
[pci_id
->driver_data
]) == NULL
) {
1539 printk(KERN_ERR
"emu10k1: IO space in use\n");
1544 pci_set_drvdata(pci_dev
, card
);
1546 card
->irq
= pci_dev
->irq
;
1547 card
->pci_dev
= pci_dev
;
1549 /* Reserve IRQ Line */
1550 if (request_irq(card
->irq
, emu10k1_interrupt
, SA_SHIRQ
, card_names
[pci_id
->driver_data
], card
)) {
1551 printk(KERN_ERR
"emu10k1: IRQ in use\n");
1556 pci_read_config_byte(pci_dev
, PCI_REVISION_ID
, &card
->chiprev
);
1557 pci_read_config_word(pci_dev
, PCI_SUBSYSTEM_ID
, &card
->model
);
1559 printk(KERN_INFO
"emu10k1: %s rev %d model 0x%04x found, IO at 0x%04lx-0x%04lx, IRQ %d\n",
1560 card_names
[pci_id
->driver_data
], card
->chiprev
, card
->model
, card
->iobase
,
1561 card
->iobase
+ card
->length
- 1, card
->irq
);
1563 if (pci_id
->device
== PCI_DEVICE_ID_CREATIVE_AUDIGY
)
1564 card
->is_audigy
= 1;
1566 pci_read_config_dword(pci_dev
, PCI_SUBSYSTEM_VENDOR_ID
, &subsysvid
);
1567 card
->is_aps
= (subsysvid
== EMU_APS_SUBID
);
1569 spin_lock_init(&card
->lock
);
1570 init_MUTEX(&card
->open_sem
);
1571 card
->open_mode
= 0;
1572 init_waitqueue_head(&card
->open_wait
);
1574 ret
= emu10k1_audio_init(card
);
1576 printk(KERN_ERR
"emu10k1: cannot initialize audio devices\n");
1580 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
1581 ret
= emu10k1_proc_init(card
);
1583 printk(KERN_ERR
"emu10k1: cannot initialize proc directory\n");
1588 ret
= emu10k1_mixer_init(card
);
1590 printk(KERN_ERR
"emu10k1: cannot initialize AC97 codec\n");
1594 ret
= emu10k1_midi_init(card
);
1596 printk(KERN_ERR
"emu10k1: cannot register midi device\n");
1600 ret
= emu10k1_init(card
);
1602 printk(KERN_ERR
"emu10k1: cannot initialize device\n");
1603 goto err_emu10k1_init
;
1607 emu10k1_ecard_init(card
);
1609 list_add(&card
->list
, &emu10k1_devs
);
1614 emu10k1_midi_cleanup(card
);
1617 emu10k1_mixer_cleanup(card
);
1620 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
1622 emu10k1_proc_cleanup(card
);
1626 emu10k1_audio_cleanup(card
);
1629 free_irq(card
->irq
, card
);
1632 release_region(card
->iobase
, card
->length
);
1633 pci_set_drvdata(pci_dev
, NULL
);
1642 static void __devexit
emu10k1_remove(struct pci_dev
*pci_dev
)
1644 struct emu10k1_card
*card
= pci_get_drvdata(pci_dev
);
1646 list_del(&card
->list
);
1648 emu10k1_cleanup(card
);
1649 emu10k1_midi_cleanup(card
);
1650 emu10k1_mixer_cleanup(card
);
1651 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
1652 emu10k1_proc_cleanup(card
);
1654 emu10k1_audio_cleanup(card
);
1655 free_irq(card
->irq
, card
);
1656 release_region(card
->iobase
, card
->length
);
1658 pci_set_drvdata(pci_dev
, NULL
);
1661 MODULE_AUTHOR("Bertrand Lee, Cai Ying. (Email to: emu10k1-devel@lists.sourceforge.net)");
1662 MODULE_DESCRIPTION("Creative EMU10K1 PCI Audio Driver v" DRIVER_VERSION
"\nCopyright (C) 1999 Creative Technology Ltd.");
1663 MODULE_LICENSE("GPL");
1665 static struct pci_driver emu10k1_pci_driver
= {
1667 id_table
: emu10k1_pci_tbl
,
1668 probe
: emu10k1_probe
,
1669 remove
: __devexit_p(emu10k1_remove
),
1672 static int __init
emu10k1_init_module(void)
1674 printk(KERN_INFO
"Creative EMU10K1 PCI Audio Driver, version " DRIVER_VERSION
", " __TIME__
" " __DATE__
"\n");
1676 return pci_module_init(&emu10k1_pci_driver
);
1679 static void __exit
emu10k1_cleanup_module(void)
1681 pci_unregister_driver(&emu10k1_pci_driver
);
1686 module_init(emu10k1_init_module
);
1687 module_exit(emu10k1_cleanup_module
);
1689 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
1691 int __init
init_emu10k1(void)
1693 return emu10k1_init_module();
1698 #ifdef EMU10K1_SEQUENCER
1701 extern int emu10k1_seq_midi_open(int dev
, int mode
,
1702 void (*input
)(int dev
, unsigned char midi_byte
),
1703 void (*output
)(int dev
));
1704 extern void emu10k1_seq_midi_close(int dev
);
1705 extern int emu10k1_seq_midi_out(int dev
, unsigned char midi_byte
);
1706 extern int emu10k1_seq_midi_start_read(int dev
);
1707 extern int emu10k1_seq_midi_end_read(int dev
);
1708 extern void emu10k1_seq_midi_kick(int dev
);
1709 extern int emu10k1_seq_midi_buffer_status(int dev
);
1711 static struct midi_operations emu10k1_midi_operations
=
1713 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
1716 {"EMU10K1 MIDI", 0, 0, SNDCARD_EMU10K1
},
1719 emu10k1_seq_midi_open
,
1720 emu10k1_seq_midi_close
,
1722 emu10k1_seq_midi_out
,
1723 emu10k1_seq_midi_start_read
,
1724 emu10k1_seq_midi_end_read
,
1725 emu10k1_seq_midi_kick
,
1727 emu10k1_seq_midi_buffer_status
,