15 #include <linux/module.h>
24 #define SNDRV_LEGACY_FIND_FREE_IRQ
25 #define SNDRV_LEGACY_FIND_FREE_DMA
28 #define PFX "jazz16: "
66 #define SB_JAZZ16_WAKEUP 0xaf
67 #define SB_JAZZ16_SET_PORTS 0x50
68 #define SB_DSP_GET_JAZZ_BRD_REV 0xfa
69 #define SB_JAZZ16_SET_DMAINTR 0xfb
70 #define SB_DSP_GET_JAZZ_MODEL 0xfe
81 static int __devinit jazz16_configure_ports(
unsigned long port,
95 val |= (mpu_port & 0x30) >> 4;
102 static int __devinit jazz16_detect_board(
unsigned long port,
103 unsigned long mpu_port)
118 for (val = 0; val < 4; val++) {
119 err = jazz16_configure_ports(port, mpu_port, val);
139 if ((val & 0xf0) != 0x10) {
149 snd_printd(
"Media Vision Jazz16 board detected: rev 0x%x, model 0x%x\n",
161 static unsigned char jazz_irq_bits[] = { 0, 0, 2, 3, 0, 1, 0, 4,
162 0, 2, 5, 0, 0, 0, 0, 6 };
163 static unsigned char jazz_dma_bits[] = { 0, 1, 0, 2, 0, 3, 0, 4 };
165 if (jazz_dma_bits[chip->
dma8] == 0 ||
166 jazz_dma_bits[chip->
dma16] == 0 ||
167 jazz_irq_bits[chip->
irq] == 0)
174 jazz_dma_bits[chip->
dma8] |
175 (jazz_dma_bits[chip->
dma16] << 4)))
179 jazz_irq_bits[chip->
irq] |
180 (jazz_irq_bits[mpu_irq] << 4)))
193 }
else if (port[dev] == 0x200 || (port[dev] & ~0x270)) {
208 (mpu_port[dev] & ~0x030) != 0x300) {
213 mpu_irq[dev] != 2 && mpu_irq[dev] != 3 &&
214 mpu_irq[dev] != 5 && mpu_irq[dev] != 7) {
221 static int __devinit snd_jazz16_probe(
struct device *devptr,
unsigned int dev)
227 static int possible_irqs[] = {2, 3, 5, 7, 9, 10, 15, -1};
228 static int possible_dmas8[] = {1, 3, -1};
229 static int possible_dmas16[] = {5, 7, -1};
230 int err, xirq, xdma8, xdma16, xmpu_port, xmpu_irq;
241 xirq = snd_legacy_find_free_irq(possible_irqs);
250 xdma8 = snd_legacy_find_free_dma(possible_dmas8);
259 xdma16 = snd_legacy_find_free_dma(possible_dmas16);
267 xmpu_port = mpu_port[
dev];
270 err = jazz16_detect_board(port[dev], xmpu_port);
277 dma8[dev], dma16[dev],
283 xmpu_irq = mpu_irq[
dev];
286 err = jazz16_configure_board(chip, xmpu_irq);
297 "Media Vision Jazz16 at 0x%lx, irq %d, dma8 %d, dma16 %d",
298 port[dev], xirq, xdma8, xdma16);
344 static int __devexit snd_jazz16_remove(
struct device *devptr,
unsigned int dev)
354 static int snd_jazz16_suspend(
struct device *pdev,
unsigned int n,
362 snd_pcm_suspend_all(chip->
pcm);
363 snd_sbmixer_suspend(chip);
367 static int snd_jazz16_resume(
struct device *pdev,
unsigned int n)
374 snd_sbmixer_resume(chip);
380 static struct isa_driver snd_jazz16_driver = {
381 .match = snd_jazz16_match,
382 .probe = snd_jazz16_probe,
385 .suspend = snd_jazz16_suspend,
386 .resume = snd_jazz16_resume,
393 static int __init alsa_card_jazz16_init(
void)
398 static void __exit alsa_card_jazz16_exit(
void)