20 #include <linux/kernel.h>
21 #include <linux/module.h>
25 #include <asm/processor.h>
77 #define DSP_PORT_RESET 0x6
78 #define DSP_PORT_READ 0xa
79 #define DSP_PORT_COMMAND 0xc
80 #define DSP_PORT_STATUS 0xc
81 #define DSP_PORT_DATA_AVAIL 0xe
83 #define DSP_SIGNATURE 0xaa
85 #define DSP_COMMAND_GET_VERSION 0xe1
135 err = dsp_get_byte(port, major);
139 err = dsp_get_byte(port, minor);
150 #define WSS_CONFIG_DMA_0 (1 << 0)
151 #define WSS_CONFIG_DMA_1 (2 << 0)
152 #define WSS_CONFIG_DMA_3 (3 << 0)
153 #define WSS_CONFIG_DUPLEX (1 << 2)
154 #define WSS_CONFIG_IRQ_7 (1 << 3)
155 #define WSS_CONFIG_IRQ_9 (2 << 3)
156 #define WSS_CONFIG_IRQ_10 (3 << 3)
157 #define WSS_CONFIG_IRQ_11 (4 << 3)
159 #define WSS_PORT_CONFIG 0
160 #define WSS_PORT_SIGNATURE 3
162 #define WSS_SIGNATURE 4
172 static void wss_set_config(
void __iomem *wss_port,
u8 wss_config)
181 #define GALAXY_PORT_CONFIG 1024
182 #define CONFIG_PORT_SET 4
184 #define DSP_COMMAND_GALAXY_8 8
185 #define GALAXY_COMMAND_GET_TYPE 5
187 #define DSP_COMMAND_GALAXY_9 9
188 #define GALAXY_COMMAND_WSSMODE 0
189 #define GALAXY_COMMAND_SB8MODE 1
191 #define GALAXY_MODE_WSS GALAXY_COMMAND_WSSMODE
192 #define GALAXY_MODE_SB8 GALAXY_COMMAND_SB8MODE
214 dev_err(dev,
"please specify port\n");
229 dev_err(dev,
"invalid port %#lx\n", port[n]);
233 switch (wss_port[n]) {
235 dev_err(dev,
"please specify wss_port\n");
250 dev_err(dev,
"invalid WSS port %#lx\n", wss_port[n]);
256 dev_err(dev,
"please specify irq\n");
273 dev_err(dev,
"invalid IRQ %d\n", irq[n]);
279 dev_err(dev,
"please specify dma1\n");
291 dev_err(dev,
"invalid playback DMA %d\n", dma1[n]);
308 dev_err(dev,
"invalid capture DMA %d\n", dma2[n]);
313 switch (mpu_port[n]) {
315 dev_warn(dev,
"mpu_port not specified; not using MPU-401\n");
325 dev_err(dev,
"invalid MPU port %#lx\n", mpu_port[n]);
329 switch (mpu_irq[n]) {
331 dev_warn(dev,
"mpu_irq not specified: using polling mode\n");
356 dev_err(dev,
"invalid MPU IRQ %d\n", mpu_irq[n]);
360 if (mpu_irq[n] == irq[n]) {
361 dev_err(dev,
"cannot share IRQ between WSS and MPU-401\n");
366 switch (fm_port[n]) {
368 dev_warn(dev,
"fm_port not specified: not using OPL3\n");
374 dev_err(dev,
"illegal FM port %#lx\n", fm_port[n]);
388 err = dsp_reset(galaxy->
port);
392 err = dsp_get_version(galaxy->
port, &major, &minor);
407 err = dsp_get_byte(galaxy->
port, type);
422 err = dsp_command(galaxy->
port, mode);
430 err = dsp_reset(galaxy->
port);
438 static void galaxy_set_config(
struct snd_galaxy *galaxy,
u32 config)
461 galaxy_set_config(galaxy, config);
472 wss_set_config(galaxy->
wss_port, wss_config);
486 wss_set_config(galaxy->
wss_port, 0);
491 galaxy_set_config(galaxy, galaxy->
config);
501 static int __devinit snd_galaxy_probe(
struct device *dev,
unsigned int n)
521 dev_err(dev,
"could not grab ports %#lx-%#lx\n", port[n],
528 err = galaxy_init(galaxy, &type);
530 dev_err(dev,
"did not find a Sound Galaxy at %#lx\n", port[n]);
533 dev_info(dev,
"Sound Galaxy (type %d) found at %#lx\n", type, port[n]);
538 dev_err(dev,
"could not grab ports %#lx-%#lx\n",
546 galaxy_config(galaxy, config[n]);
550 dev_err(dev,
"could not grab ports %#lx-%#lx\n", wss_port[n],
557 err = galaxy_wss_config(galaxy, wss_config[n]);
559 dev_err(dev,
"could not configure WSS\n");
566 card->
shortname, port[n], wss_port[n], irq[n], dma1[n],
586 if (mpu_port[n] >= 0) {
588 mpu_port[n], 0, mpu_irq[n],
NULL);
593 if (fm_port[n] >= 0) {
599 dev_err(dev,
"no OPL device at %#lx\n", fm_port[n]);
623 static int __devexit snd_galaxy_remove(
struct device *dev,
unsigned int n)
630 static struct isa_driver snd_galaxy_driver = {
631 .match = snd_galaxy_match,
632 .probe = snd_galaxy_probe,
640 static int __init alsa_card_galaxy_init(
void)
645 static void __exit alsa_card_galaxy_exit(
void)