aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/atiixp_modem.c
diff options
context:
space:
mode:
authorSasha Khapyorsky <sashak@smlink.com>2005-05-29 15:10:07 +0200
committerJaroslav Kysela <perex@suse.cz>2005-06-22 12:27:21 +0200
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 9220aae632b..a6b4b8d589f 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)
static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
{
atiixp_t *chip = ac97->private_data;
+ if (reg == AC97_GPIO_STATUS) {
+ atiixp_write(chip, MODEM_OUT_GPIO,
+ (val << ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT) | ATI_REG_MODEM_OUT_GPIO_EN);
+ return;
+ }
snd_atiixp_codec_write(chip, ac97->num, reg, val);
}
@@ -663,44 +668,33 @@ static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
{
atiixp_t *chip = snd_pcm_substream_chip(substream);
atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
- unsigned int reg = 0;
- int i;
+ int err = 0;
snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
- if (cmd != SNDRV_PCM_TRIGGER_START && cmd != SNDRV_PCM_TRIGGER_STOP)
- return -EINVAL;
-
spin_lock(&chip->reg_lock);
-
- /* hook off/on: via GPIO_OUT */
- for (i = 0; i < NUM_ATI_CODECS; i++) {
- if (chip->ac97[i]) {
- reg = snd_ac97_read(chip->ac97[i], AC97_GPIO_STATUS);
- break;
- }
- }
- if(cmd == SNDRV_PCM_TRIGGER_START)
- reg |= AC97_GPIO_LINE1_OH;
- else
- reg &= ~AC97_GPIO_LINE1_OH;
- reg = (reg << ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT) | ATI_REG_MODEM_OUT_GPIO_EN ;
- atiixp_write(chip, MODEM_OUT_GPIO, reg);
-
- if (cmd == SNDRV_PCM_TRIGGER_START) {
+ switch(cmd) {
+ case SNDRV_PCM_TRIGGER_START:
dma->ops->enable_transfer(chip, 1);
dma->running = 1;
- } else {
+ break;
+ case SNDRV_PCM_TRIGGER_STOP:
dma->ops->enable_transfer(chip, 0);
dma->running = 0;
+ break;
+ default:
+ err = -EINVAL;
+ break;
}
+ if (! err) {
snd_atiixp_check_bus_busy(chip);
if (cmd == SNDRV_PCM_TRIGGER_STOP) {
dma->ops->flush_dma(chip);
snd_atiixp_check_bus_busy(chip);
}
+ }
spin_unlock(&chip->reg_lock);
- return 0;
+ return err;
}