27 #include <linux/module.h>
35 #define SNDRV_LEGACY_FIND_FREE_IRQ
36 #define SNDRV_LEGACY_FIND_FREE_DMA
50 "{Creative Labs,SB Vibra16S},"
51 "{Creative Labs,SB Vibra16C},"
52 "{Creative Labs,SB Vibra16CL},"
53 "{Creative Labs,SB Vibra16X}}");
57 "{Creative Labs,SB AWE 64},"
58 "{Creative Labs,SB AWE 64 Gold}}");
62 #define SNDRV_DEBUG_IRQ
65 #if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)))
66 #define SNDRV_SBAWE_EMU8000
78 #ifdef SNDRV_SBAWE_EMU8000
85 #ifdef CONFIG_SND_SB16_CSP
88 #ifdef SNDRV_SBAWE_EMU8000
108 #ifdef SNDRV_SBAWE_EMU8000
120 #ifdef CONFIG_SND_SB16_CSP
124 #ifdef SNDRV_SBAWE_EMU8000
126 MODULE_PARM_DESC(seq_ports,
"Number of sequencer ports for WaveTable synth.");
130 static int isa_registered;
131 static int pnp_registered;
140 #ifdef SNDRV_SBAWE_EMU8000
151 { .
id =
"CTL0024", .devs = { {
"CTL0031" } } },
153 { .id =
"CTL0025", .devs = { {
"CTL0031" } } },
155 { .id =
"CTL0026", .devs = { {
"CTL0031" } } },
157 { .id =
"CTL0027", .devs = { {
"CTL0031" } } },
159 { .id =
"CTL0028", .devs = { {
"CTL0031" } } },
161 { .id =
"CTL0029", .devs = { {
"CTL0031" } } },
163 { .id =
"CTL002a", .devs = { {
"CTL0031" } } },
166 { .id =
"CTL002b", .devs = { {
"CTL0031" } } },
168 { .id =
"CTL002c", .devs = { {
"CTL0031" } } },
170 { .id =
"CTL0051", .devs = { {
"CTL0001" } } },
172 { .id =
"CTL0070", .devs = { {
"CTL0001" } } },
174 { .id =
"CTL0080", .devs = { {
"CTL0041" } } },
177 { .id =
"CTL0086", .devs = { {
"CTL0041" } } },
179 { .id =
"CTL00f0", .devs = { {
"CTL0043" } } },
181 { .id =
"tBA03b0", .devs = { {.id=
"PNPb003" } } },
184 { .id =
"CTL0035", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
186 { .id =
"CTL0039", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
188 { .id =
"CTL0042", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
190 { .id =
"CTL0043", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
193 { .id =
"CTL0044", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
196 { .id =
"CTL0045", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
198 { .id =
"CTL0046", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
200 { .id =
"CTL0047", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
202 { .id =
"CTL0048", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
204 { .id =
"CTL0054", .devs = { {
"CTL0031" }, {
"CTL0021" } } },
206 { .id =
"CTL009a", .devs = { {
"CTL0041" }, {
"CTL0021" } } },
208 { .id =
"CTL009c", .devs = { {
"CTL0041" }, {
"CTL0021" } } },
210 { .id =
"CTL009f", .devs = { {
"CTL0041" }, {
"CTL0021" } } },
212 { .id =
"CTL009d", .devs = { {
"CTL0042" }, {
"CTL0022" } } },
214 { .id =
"CTL009e", .devs = { {
"CTL0044" }, {
"CTL0023" } } },
216 { .id =
"CTL00b2", .devs = { {
"CTL0044" }, {
"CTL0023" } } },
218 { .id =
"CTL00c1", .devs = { {
"CTL0042" }, {
"CTL0022" } } },
220 { .id =
"CTL00c3", .devs = { {
"CTL0045" }, {
"CTL0022" } } },
222 { .id =
"CTL00c5", .devs = { {
"CTL0045" }, {
"CTL0022" } } },
224 { .id =
"CTL00c7", .devs = { {
"CTL0045" }, {
"CTL0022" } } },
226 { .id =
"CTL00e4", .devs = { {
"CTL0045" }, {
"CTL0022" } } },
228 { .id =
"CTL00e9", .devs = { {
"CTL0045" }, {
"CTL0022" } } },
230 { .id =
"CTL00ed", .devs = { {
"CTL0041" }, {
"CTL0070" } } },
232 { .id =
"CTLXXXX" , .devs = { {
"CTL0031" }, {
"CTL0021" } } },
233 { .id =
"CTLXXXX" , .devs = { {
"CTL0041" }, {
"CTL0021" } } },
234 { .id =
"CTLXXXX" , .devs = { {
"CTL0042" }, {
"CTL0022" } } },
235 { .id =
"CTLXXXX" , .devs = { {
"CTL0044" }, {
"CTL0023" } } },
236 { .id =
"CTLXXXX" , .devs = { {
"CTL0045" }, {
"CTL0022" } } },
245 #ifdef SNDRV_SBAWE_EMU8000
246 #define DRIVER_NAME "snd-card-sbawe"
248 #define DRIVER_NAME "snd-card-sb16"
261 if (acard->dev ==
NULL)
264 #ifdef SNDRV_SBAWE_EMU8000
275 port[
dev] = pnp_port_start(pdev, 0);
276 mpu_port[
dev] = pnp_port_start(pdev, 1);
277 fm_port[
dev] = pnp_port_start(pdev, 2);
281 snd_printdd(
"pnp SB16: port=0x%lx, mpu port=0x%lx, fm port=0x%lx\n",
282 port[dev], mpu_port[dev], fm_port[dev]);
283 snd_printdd(
"pnp SB16: dma1=%i, dma2=%i, irq=%i\n",
284 dma8[dev], dma16[dev], irq[dev]);
285 #ifdef SNDRV_SBAWE_EMU8000
293 awe_port[
dev] = pnp_port_start(pdev, 0);
295 (
unsigned long long)pnp_port_start(pdev, 0));
321 #define is_isapnp_selected(dev) isapnp[dev]
323 #define is_isapnp_selected(dev) 0
326 static int snd_sb16_card_new(
int dev,
struct snd_card **cardp)
342 int xirq, xdma8, xdma16;
347 #ifdef CONFIG_SND_SB16_CSP
380 #ifdef SNDRV_SBAWE_EMU8000
381 awe_port[dev] > 0 ?
"SB AWE" :
393 xdma8 >= 0 ?
"&" :
"", xdma16);
404 #ifdef SNDRV_SBAWE_EMU8000
412 acard->
fm_res !=
NULL || fm_port[dev] == port[dev],
415 fm_port[dev], fm_port[dev] + 2);
417 #ifdef SNDRV_SBAWE_EMU8000
418 int seqdev = awe_port[
dev] > 0 ? 2 : 1;
430 #ifdef CONFIG_SND_SB16_CSP
442 #ifdef SNDRV_SBAWE_EMU8000
443 if (awe_port[dev] > 0) {
445 seq_ports[dev],
NULL)) < 0) {
446 snd_printk(
KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]);
457 (mic_agc[dev] ? 0x00 : 0x01));
458 spin_unlock_irqrestore(&chip->
mixer_lock, flags);
473 snd_pcm_suspend_all(chip->
pcm);
474 snd_sbmixer_suspend(chip);
478 static int snd_sb16_resume(
struct snd_card *card)
484 snd_sbmixer_resume(chip);
496 err = snd_sb16_card_new(dev, &card);
505 #ifdef SNDRV_SBAWE_EMU8000
507 awe_port[
dev] = port[
dev] + 0x400;
511 if ((err = snd_sb16_probe(card, dev)) < 0) {
520 static int __devinit snd_sb16_isa_match(
struct device *pdev,
unsigned int dev)
525 static int __devinit snd_sb16_isa_probe(
struct device *pdev,
unsigned int dev)
528 static int possible_irqs[] = {5, 9, 10, 7, -1};
529 static int possible_dmas8[] = {1, 3, 0, -1};
530 static int possible_dmas16[] = {5, 6, 7, -1};
533 if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) {
539 if ((dma8[dev] = snd_legacy_find_free_dma(possible_dmas8)) < 0) {
545 if ((dma16[dev] = snd_legacy_find_free_dma(possible_dmas16)) < 0) {
552 return snd_sb16_isa_probe1(dev, pdev);
554 static int possible_ports[] = {0x220, 0x240, 0x260, 0x280};
556 for (i = 0; i <
ARRAY_SIZE(possible_ports); i++) {
557 port[
dev] = possible_ports[
i];
558 err = snd_sb16_isa_probe1(dev, pdev);
566 static int __devexit snd_sb16_isa_remove(
struct device *pdev,
unsigned int dev)
574 static int snd_sb16_isa_suspend(
struct device *dev,
unsigned int n,
580 static int snd_sb16_isa_resume(
struct device *dev,
unsigned int n)
587 #define DEV_NAME "sbawe"
589 #define DEV_NAME "sb16"
592 static struct isa_driver snd_sb16_isa_driver = {
593 .match = snd_sb16_isa_match,
594 .probe = snd_sb16_isa_probe,
597 .suspend = snd_sb16_isa_suspend,
598 .resume = snd_sb16_isa_resume,
615 if (!
enable[dev] || !isapnp[dev])
617 res = snd_sb16_card_new(dev, &card);
621 if ((res = snd_card_sb16_pnp(dev, card->
private_data, pcard, pid)) < 0 ||
622 (res = snd_sb16_probe(card, dev)) < 0) {
626 pnp_set_card_drvdata(pcard, card);
637 pnp_set_card_drvdata(pcard,
NULL);
643 return snd_sb16_suspend(pnp_get_card_drvdata(pcard), state);
647 return snd_sb16_resume(pnp_get_card_drvdata(pcard));
658 .id_table = snd_sb16_pnpids,
659 .probe = snd_sb16_pnp_detect,
662 .suspend = snd_sb16_pnp_suspend,
663 .resume = snd_sb16_pnp_resume,
669 static int __init alsa_card_sb16_init(
void)
688 static void __exit alsa_card_sb16_exit(
void)