aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/es1938.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/es1938.c')
-rw-r--r--sound/pci/es1938.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 17fa80c23870..78f90defcab1 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -267,7 +267,7 @@ static void snd_es1938_mixer_write(es1938_t *chip, unsigned char reg, unsigned c
267 outb(val, SLSB_REG(chip, MIXERDATA)); 267 outb(val, SLSB_REG(chip, MIXERDATA));
268 spin_unlock_irqrestore(&chip->mixer_lock, flags); 268 spin_unlock_irqrestore(&chip->mixer_lock, flags);
269#ifdef REG_DEBUG 269#ifdef REG_DEBUG
270 snd_printk("Mixer reg %02x set to %02x\n", reg, val); 270 snd_printk(KERN_DEBUG "Mixer reg %02x set to %02x\n", reg, val);
271#endif 271#endif
272} 272}
273 273
@@ -283,7 +283,7 @@ static int snd_es1938_mixer_read(es1938_t *chip, unsigned char reg)
283 data = inb(SLSB_REG(chip, MIXERDATA)); 283 data = inb(SLSB_REG(chip, MIXERDATA));
284 spin_unlock_irqrestore(&chip->mixer_lock, flags); 284 spin_unlock_irqrestore(&chip->mixer_lock, flags);
285#ifdef REG_DEBUG 285#ifdef REG_DEBUG
286 snd_printk("Mixer reg %02x now is %02x\n", reg, data); 286 snd_printk(KERN_DEBUG "Mixer reg %02x now is %02x\n", reg, data);
287#endif 287#endif
288 return data; 288 return data;
289} 289}
@@ -303,7 +303,8 @@ static int snd_es1938_mixer_bits(es1938_t *chip, unsigned char reg, unsigned cha
303 new = (old & ~mask) | (val & mask); 303 new = (old & ~mask) | (val & mask);
304 outb(new, SLSB_REG(chip, MIXERDATA)); 304 outb(new, SLSB_REG(chip, MIXERDATA));
305#ifdef REG_DEBUG 305#ifdef REG_DEBUG
306 snd_printk("Mixer reg %02x was %02x, set to %02x\n", reg, old, new); 306 snd_printk(KERN_DEBUG "Mixer reg %02x was %02x, set to %02x\n",
307 reg, old, new);
307#endif 308#endif
308 } 309 }
309 spin_unlock_irqrestore(&chip->mixer_lock, flags); 310 spin_unlock_irqrestore(&chip->mixer_lock, flags);
@@ -323,7 +324,7 @@ static void snd_es1938_write_cmd(es1938_t *chip, unsigned char cmd)
323 return; 324 return;
324 } 325 }
325 } 326 }
326 printk("snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v); 327 printk(KERN_ERR "snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v);
327} 328}
328 329
329/* ----------------------------------------------------------------- 330/* -----------------------------------------------------------------
@@ -336,7 +337,7 @@ static int snd_es1938_get_byte(es1938_t *chip)
336 for (i = GET_LOOP_TIMEOUT; i; i--) 337 for (i = GET_LOOP_TIMEOUT; i; i--)
337 if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80) 338 if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80)
338 return inb(SLSB_REG(chip, READDATA)); 339 return inb(SLSB_REG(chip, READDATA));
339 snd_printk("get_byte timeout: status 0x02%x\n", v); 340 snd_printk(KERN_ERR "get_byte timeout: status 0x02%x\n", v);
340 return -ENODEV; 341 return -ENODEV;
341} 342}
342 343
@@ -351,7 +352,7 @@ static void snd_es1938_write(es1938_t *chip, unsigned char reg, unsigned char va
351 snd_es1938_write_cmd(chip, val); 352 snd_es1938_write_cmd(chip, val);
352 spin_unlock_irqrestore(&chip->reg_lock, flags); 353 spin_unlock_irqrestore(&chip->reg_lock, flags);
353#ifdef REG_DEBUG 354#ifdef REG_DEBUG
354 snd_printk("Reg %02x set to %02x\n", reg, val); 355 snd_printk(KERN_DEBUG "Reg %02x set to %02x\n", reg, val);
355#endif 356#endif
356} 357}
357 358
@@ -368,7 +369,7 @@ static unsigned char snd_es1938_read(es1938_t *chip, unsigned char reg)
368 val = snd_es1938_get_byte(chip); 369 val = snd_es1938_get_byte(chip);
369 spin_unlock_irqrestore(&chip->reg_lock, flags); 370 spin_unlock_irqrestore(&chip->reg_lock, flags);
370#ifdef REG_DEBUG 371#ifdef REG_DEBUG
371 snd_printk("Reg %02x now is %02x\n", reg, val); 372 snd_printk(KERN_DEBUG "Reg %02x now is %02x\n", reg, val);
372#endif 373#endif
373 return val; 374 return val;
374} 375}
@@ -390,7 +391,8 @@ static int snd_es1938_bits(es1938_t *chip, unsigned char reg, unsigned char mask
390 new = (old & ~mask) | (val & mask); 391 new = (old & ~mask) | (val & mask);
391 snd_es1938_write_cmd(chip, new); 392 snd_es1938_write_cmd(chip, new);
392#ifdef REG_DEBUG 393#ifdef REG_DEBUG
393 snd_printk("Reg %02x was %02x, set to %02x\n", reg, old, new); 394 snd_printk(KERN_DEBUG "Reg %02x was %02x, set to %02x\n",
395 reg, old, new);
394#endif 396#endif
395 } 397 }
396 spin_unlock_irqrestore(&chip->reg_lock, flags); 398 spin_unlock_irqrestore(&chip->reg_lock, flags);
@@ -413,7 +415,7 @@ static void snd_es1938_reset(es1938_t *chip)
413 goto __next; 415 goto __next;
414 } 416 }
415 } 417 }
416 snd_printk("ESS Solo-1 reset failed\n"); 418 snd_printk(KERN_ERR "ESS Solo-1 reset failed\n");
417 419
418 __next: 420 __next:
419 snd_es1938_write_cmd(chip, ESS_CMD_ENABLEEXT); 421 snd_es1938_write_cmd(chip, ESS_CMD_ENABLEEXT);
@@ -543,10 +545,12 @@ static int snd_es1938_capture_trigger(snd_pcm_substream_t * substream,
543 int val; 545 int val;
544 switch (cmd) { 546 switch (cmd) {
545 case SNDRV_PCM_TRIGGER_START: 547 case SNDRV_PCM_TRIGGER_START:
548 case SNDRV_PCM_TRIGGER_RESUME:
546 val = 0x0f; 549 val = 0x0f;
547 chip->active |= ADC1; 550 chip->active |= ADC1;
548 break; 551 break;
549 case SNDRV_PCM_TRIGGER_STOP: 552 case SNDRV_PCM_TRIGGER_STOP:
553 case SNDRV_PCM_TRIGGER_SUSPEND:
550 val = 0x00; 554 val = 0x00;
551 chip->active &= ~ADC1; 555 chip->active &= ~ADC1;
552 break; 556 break;
@@ -563,6 +567,7 @@ static int snd_es1938_playback1_trigger(snd_pcm_substream_t * substream,
563 es1938_t *chip = snd_pcm_substream_chip(substream); 567 es1938_t *chip = snd_pcm_substream_chip(substream);
564 switch (cmd) { 568 switch (cmd) {
565 case SNDRV_PCM_TRIGGER_START: 569 case SNDRV_PCM_TRIGGER_START:
570 case SNDRV_PCM_TRIGGER_RESUME:
566 /* According to the documentation this should be: 571 /* According to the documentation this should be:
567 0x13 but that value may randomly swap stereo channels */ 572 0x13 but that value may randomly swap stereo channels */
568 snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0x92); 573 snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0x92);
@@ -575,6 +580,7 @@ static int snd_es1938_playback1_trigger(snd_pcm_substream_t * substream,
575 chip->active |= DAC2; 580 chip->active |= DAC2;
576 break; 581 break;
577 case SNDRV_PCM_TRIGGER_STOP: 582 case SNDRV_PCM_TRIGGER_STOP:
583 case SNDRV_PCM_TRIGGER_SUSPEND:
578 outb(0, SLIO_REG(chip, AUDIO2MODE)); 584 outb(0, SLIO_REG(chip, AUDIO2MODE));
579 snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0); 585 snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0);
580 chip->active &= ~DAC2; 586 chip->active &= ~DAC2;
@@ -592,10 +598,12 @@ static int snd_es1938_playback2_trigger(snd_pcm_substream_t * substream,
592 int val; 598 int val;
593 switch (cmd) { 599 switch (cmd) {
594 case SNDRV_PCM_TRIGGER_START: 600 case SNDRV_PCM_TRIGGER_START:
601 case SNDRV_PCM_TRIGGER_RESUME:
595 val = 5; 602 val = 5;
596 chip->active |= DAC1; 603 chip->active |= DAC1;
597 break; 604 break;
598 case SNDRV_PCM_TRIGGER_STOP: 605 case SNDRV_PCM_TRIGGER_STOP:
606 case SNDRV_PCM_TRIGGER_SUSPEND:
599 val = 0; 607 val = 0;
600 chip->active &= ~DAC1; 608 chip->active &= ~DAC1;
601 break; 609 break;
@@ -1390,7 +1398,8 @@ static int es1938_suspend(snd_card_t *card, pm_message_t state)
1390 *d = snd_es1938_reg_read(chip, *s); 1398 *d = snd_es1938_reg_read(chip, *s);
1391 1399
1392 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ 1400 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */
1393 1401 if (chip->irq >= 0)
1402 free_irq(chip->irq, (void *)chip);
1394 pci_disable_device(chip->pci); 1403 pci_disable_device(chip->pci);
1395 return 0; 1404 return 0;
1396} 1405}
@@ -1401,6 +1410,9 @@ static int es1938_resume(snd_card_t *card)
1401 unsigned char *s, *d; 1410 unsigned char *s, *d;
1402 1411
1403 pci_enable_device(chip->pci); 1412 pci_enable_device(chip->pci);
1413 request_irq(chip->pci->irq, snd_es1938_interrupt,
1414 SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip);
1415 chip->irq = chip->pci->irq;
1404 snd_es1938_chip_init(chip); 1416 snd_es1938_chip_init(chip);
1405 1417
1406 /* restore mixer-related registers */ 1418 /* restore mixer-related registers */
@@ -1489,7 +1501,7 @@ static int __devinit snd_es1938_create(snd_card_t * card,
1489 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1501 /* check, if we can restrict PCI DMA transfers to 24 bits */
1490 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 1502 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 ||
1491 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 1503 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) {
1492 snd_printk("architecture does not support 24bit PCI busmaster DMA\n"); 1504 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
1493 pci_disable_device(pci); 1505 pci_disable_device(pci);
1494 return -ENXIO; 1506 return -ENXIO;
1495 } 1507 }
@@ -1514,13 +1526,13 @@ static int __devinit snd_es1938_create(snd_card_t * card,
1514 chip->mpu_port = pci_resource_start(pci, 3); 1526 chip->mpu_port = pci_resource_start(pci, 3);
1515 chip->game_port = pci_resource_start(pci, 4); 1527 chip->game_port = pci_resource_start(pci, 4);
1516 if (request_irq(pci->irq, snd_es1938_interrupt, SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip)) { 1528 if (request_irq(pci->irq, snd_es1938_interrupt, SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip)) {
1517 snd_printk("unable to grab IRQ %d\n", pci->irq); 1529 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1518 snd_es1938_free(chip); 1530 snd_es1938_free(chip);
1519 return -EBUSY; 1531 return -EBUSY;
1520 } 1532 }
1521 chip->irq = pci->irq; 1533 chip->irq = pci->irq;
1522#ifdef ES1938_DDEBUG 1534#ifdef ES1938_DDEBUG
1523 snd_printk("create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n", 1535 snd_printk(KERN_DEBUG "create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n",
1524 chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port); 1536 chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port);
1525#endif 1537#endif
1526 1538