2 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
3 * and (c) 1999 Steve Ratcliffe <steve@parabola.demon.co.uk>
4 * Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de>
6 * Emu8000 synth plug-in routine
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "emu8000_local.h"
24 #include <linux/init.h>
25 #include <linux/module.h>
26 #include <sound/initval.h>
28 MODULE_AUTHOR("Takashi Iwai, Steve Ratcliffe");
29 MODULE_DESCRIPTION("Emu8000 synth plug-in routine");
30 MODULE_LICENSE("GPL");
32 /*----------------------------------------------------------------*/
35 * create a new hardware dependent device for Emu8000
37 static int snd_emu8000_probe(struct device
*_dev
)
39 struct snd_seq_device
*dev
= to_seq_dev(_dev
);
40 struct snd_emu8000
*hw
;
43 hw
= *(struct snd_emu8000
**)SNDRV_SEQ_DEVICE_ARGPTR(dev
);
48 return -EBUSY
; /* already exists..? */
50 if (snd_emux_new(&emu
) < 0)
54 snd_emu8000_ops_setup(hw
);
57 emu
->max_voices
= EMU8000_DRAM_VOICES
;
58 emu
->num_ports
= hw
->seq_ports
;
61 snd_printk(KERN_ERR
"memhdr is already initialized!?\n");
62 snd_util_memhdr_free(hw
->memhdr
);
64 hw
->memhdr
= snd_util_memhdr_new(hw
->mem_size
);
65 if (hw
->memhdr
== NULL
) {
71 emu
->memhdr
= hw
->memhdr
;
72 emu
->midi_ports
= hw
->seq_ports
< 2 ? hw
->seq_ports
: 2; /* number of virmidi ports */
74 emu
->linear_panning
= 1;
75 emu
->hwdep_idx
= 2; /* FIXED */
77 if (snd_emux_register(emu
, dev
->card
, hw
->index
, "Emu8000") < 0) {
79 snd_util_memhdr_free(hw
->memhdr
);
86 snd_emu8000_pcm_new(dev
->card
, hw
, 1);
88 dev
->driver_data
= hw
;
97 static int snd_emu8000_remove(struct device
*_dev
)
99 struct snd_seq_device
*dev
= to_seq_dev(_dev
);
100 struct snd_emu8000
*hw
;
102 if (dev
->driver_data
== NULL
)
103 return 0; /* no synth was allocated actually */
105 hw
= dev
->driver_data
;
107 snd_device_free(dev
->card
, hw
->pcm
);
108 snd_emux_free(hw
->emu
);
109 snd_util_memhdr_free(hw
->memhdr
);
119 static struct snd_seq_driver emu8000_driver
= {
121 .name
= KBUILD_MODNAME
,
122 .probe
= snd_emu8000_probe
,
123 .remove
= snd_emu8000_remove
,
125 .id
= SNDRV_SEQ_DEV_ID_EMU8000
,
126 .argsize
= sizeof(struct snd_emu8000
*),
129 module_snd_seq_driver(emu8000_driver
);