diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-10-10 07:42:24 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-11-04 07:18:23 -0500 |
commit | 93b9f426374a07d46f582fdf284e4e26d8fe9756 (patch) | |
tree | 1bdca00719c0eb5e02e4948a8f762c425e8bd3a1 /sound/pci | |
parent | c913f69b0d1b9f3f3aa39f49a240cb0fb9d7c6dd (diff) |
[ALSA] es1938 - Clean up and fix trigger in PM
Modules: ES1938 driver
- Clean up the last PM fix
- Add TRIGGER_SUSPEND/RESUME to disable/enable DMA properly during PM
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/es1938.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index e8b8ebf99635..7bfbdfc2f8bc 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -543,10 +543,12 @@ static int snd_es1938_capture_trigger(snd_pcm_substream_t * substream, | |||
543 | int val; | 543 | int val; |
544 | switch (cmd) { | 544 | switch (cmd) { |
545 | case SNDRV_PCM_TRIGGER_START: | 545 | case SNDRV_PCM_TRIGGER_START: |
546 | case SNDRV_PCM_TRIGGER_RESUME: | ||
546 | val = 0x0f; | 547 | val = 0x0f; |
547 | chip->active |= ADC1; | 548 | chip->active |= ADC1; |
548 | break; | 549 | break; |
549 | case SNDRV_PCM_TRIGGER_STOP: | 550 | case SNDRV_PCM_TRIGGER_STOP: |
551 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
550 | val = 0x00; | 552 | val = 0x00; |
551 | chip->active &= ~ADC1; | 553 | chip->active &= ~ADC1; |
552 | break; | 554 | break; |
@@ -563,6 +565,7 @@ static int snd_es1938_playback1_trigger(snd_pcm_substream_t * substream, | |||
563 | es1938_t *chip = snd_pcm_substream_chip(substream); | 565 | es1938_t *chip = snd_pcm_substream_chip(substream); |
564 | switch (cmd) { | 566 | switch (cmd) { |
565 | case SNDRV_PCM_TRIGGER_START: | 567 | case SNDRV_PCM_TRIGGER_START: |
568 | case SNDRV_PCM_TRIGGER_RESUME: | ||
566 | /* According to the documentation this should be: | 569 | /* According to the documentation this should be: |
567 | 0x13 but that value may randomly swap stereo channels */ | 570 | 0x13 but that value may randomly swap stereo channels */ |
568 | snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0x92); | 571 | snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0x92); |
@@ -575,6 +578,7 @@ static int snd_es1938_playback1_trigger(snd_pcm_substream_t * substream, | |||
575 | chip->active |= DAC2; | 578 | chip->active |= DAC2; |
576 | break; | 579 | break; |
577 | case SNDRV_PCM_TRIGGER_STOP: | 580 | case SNDRV_PCM_TRIGGER_STOP: |
581 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
578 | outb(0, SLIO_REG(chip, AUDIO2MODE)); | 582 | outb(0, SLIO_REG(chip, AUDIO2MODE)); |
579 | snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0); | 583 | snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0); |
580 | chip->active &= ~DAC2; | 584 | chip->active &= ~DAC2; |
@@ -592,10 +596,12 @@ static int snd_es1938_playback2_trigger(snd_pcm_substream_t * substream, | |||
592 | int val; | 596 | int val; |
593 | switch (cmd) { | 597 | switch (cmd) { |
594 | case SNDRV_PCM_TRIGGER_START: | 598 | case SNDRV_PCM_TRIGGER_START: |
599 | case SNDRV_PCM_TRIGGER_RESUME: | ||
595 | val = 5; | 600 | val = 5; |
596 | chip->active |= DAC1; | 601 | chip->active |= DAC1; |
597 | break; | 602 | break; |
598 | case SNDRV_PCM_TRIGGER_STOP: | 603 | case SNDRV_PCM_TRIGGER_STOP: |
604 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
599 | val = 0; | 605 | val = 0; |
600 | chip->active &= ~DAC1; | 606 | chip->active &= ~DAC1; |
601 | break; | 607 | break; |
@@ -1390,7 +1396,7 @@ static int es1938_suspend(snd_card_t *card, pm_message_t state) | |||
1390 | *d = snd_es1938_reg_read(chip, *s); | 1396 | *d = snd_es1938_reg_read(chip, *s); |
1391 | 1397 | ||
1392 | outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ | 1398 | outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ |
1393 | if (chip->irq >= 0) | 1399 | if (chip->irq >= 0) |
1394 | free_irq(chip->irq, (void *)chip); | 1400 | free_irq(chip->irq, (void *)chip); |
1395 | pci_disable_device(chip->pci); | 1401 | pci_disable_device(chip->pci); |
1396 | return 0; | 1402 | return 0; |
@@ -1402,7 +1408,9 @@ static int es1938_resume(snd_card_t *card) | |||
1402 | unsigned char *s, *d; | 1408 | unsigned char *s, *d; |
1403 | 1409 | ||
1404 | pci_enable_device(chip->pci); | 1410 | pci_enable_device(chip->pci); |
1405 | request_irq(chip->pci->irq, snd_es1938_interrupt, SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip); | 1411 | request_irq(chip->pci->irq, snd_es1938_interrupt, |
1412 | SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip); | ||
1413 | chip->irq = chip->pci->irq; | ||
1406 | snd_es1938_chip_init(chip); | 1414 | snd_es1938_chip_init(chip); |
1407 | 1415 | ||
1408 | /* restore mixer-related registers */ | 1416 | /* restore mixer-related registers */ |