aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/atiixp_modem.c
diff options
context:
space:
mode:
authorSasha Khapyorsky <sashak@smlink.com>2005-05-29 09:10:07 -0400
committerJaroslav Kysela <perex@suse.cz>2005-06-22 06:27:21 -0400
commit83a5b72ad7c7cbd0d155d922733b2429f46801bf (patch)
tree631cfda2bc042da17cfec15902fc6d4b735de07c /sound/pci/atiixp_modem.c
parent87d61c290b5de63cc18ed5ec8103e30fe297373e (diff)
[ALSA] PCI modem drivers update
ATIIXP-modem driver,Intel8x0-modem driver,VIA82xx-modem driver Modem drivers (atiixp-modem, intel8x0m, via82xx-modem) migration for using MC97 generic modem mixer for off-hook operation. Signed-off-by: Sasha Khapyorsky <sashak@smlink.com> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/atiixp_modem.c')
-rw-r--r--sound/pci/atiixp_modem.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 9220aae632b0..a6b4b8d589fd 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -463,6 +463,11 @@ static unsigned short snd_atiixp_ac97_read(ac97_t *ac97, unsigned short reg)
463static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) 463static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
464{ 464{
465 atiixp_t *chip = ac97->private_data; 465 atiixp_t *chip = ac97->private_data;
466 if (reg == AC97_GPIO_STATUS) {
467 atiixp_write(chip, MODEM_OUT_GPIO,
468 (val << ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT) | ATI_REG_MODEM_OUT_GPIO_EN);
469 return;
470 }
466 snd_atiixp_codec_write(chip, ac97->num, reg, val); 471 snd_atiixp_codec_write(chip, ac97->num, reg, val);
467} 472}
468 473
@@ -663,44 +668,33 @@ static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
663{ 668{
664 atiixp_t *chip = snd_pcm_substream_chip(substream); 669 atiixp_t *chip = snd_pcm_substream_chip(substream);
665 atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; 670 atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
666 unsigned int reg = 0; 671 int err = 0;
667 int i;
668 672
669 snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL); 673 snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
670 674
671 if (cmd != SNDRV_PCM_TRIGGER_START && cmd != SNDRV_PCM_TRIGGER_STOP)
672 return -EINVAL;
673
674 spin_lock(&chip->reg_lock); 675 spin_lock(&chip->reg_lock);
675 676 switch(cmd) {
676 /* hook off/on: via GPIO_OUT */ 677 case SNDRV_PCM_TRIGGER_START:
677 for (i = 0; i < NUM_ATI_CODECS; i++) {
678 if (chip->ac97[i]) {
679 reg = snd_ac97_read(chip->ac97[i], AC97_GPIO_STATUS);
680 break;
681 }
682 }
683 if(cmd == SNDRV_PCM_TRIGGER_START)
684 reg |= AC97_GPIO_LINE1_OH;
685 else
686 reg &= ~AC97_GPIO_LINE1_OH;
687 reg = (reg << ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT) | ATI_REG_MODEM_OUT_GPIO_EN ;
688 atiixp_write(chip, MODEM_OUT_GPIO, reg);
689
690 if (cmd == SNDRV_PCM_TRIGGER_START) {
691 dma->ops->enable_transfer(chip, 1); 678 dma->ops->enable_transfer(chip, 1);
692 dma->running = 1; 679 dma->running = 1;
693 } else { 680 break;
681 case SNDRV_PCM_TRIGGER_STOP:
694 dma->ops->enable_transfer(chip, 0); 682 dma->ops->enable_transfer(chip, 0);
695 dma->running = 0; 683 dma->running = 0;
684 break;
685 default:
686 err = -EINVAL;
687 break;
696 } 688 }
689 if (! err) {
697 snd_atiixp_check_bus_busy(chip); 690 snd_atiixp_check_bus_busy(chip);
698 if (cmd == SNDRV_PCM_TRIGGER_STOP) { 691 if (cmd == SNDRV_PCM_TRIGGER_STOP) {
699 dma->ops->flush_dma(chip); 692 dma->ops->flush_dma(chip);
700 snd_atiixp_check_bus_busy(chip); 693 snd_atiixp_check_bus_busy(chip);
701 } 694 }
695 }
702 spin_unlock(&chip->reg_lock); 696 spin_unlock(&chip->reg_lock);
703 return 0; 697 return err;
704} 698}
705 699
706 700