Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[sfrench/cifs-2.6.git] / drivers / media / video / saa7134 / saa7134-alsa.c
index aca84d2f9825dbaa9285551dbe6eeeba95aebccc..a39e0136ce3ba4614b422d05e8febc1fd319c736 100644 (file)
@@ -507,7 +507,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
        /* release the old buffer */
        if (substream->runtime->dma_area) {
                saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
-               videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma);
+               videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma);
                dsp_buffer_free(dev);
                substream->runtime->dma_area = NULL;
        }
@@ -523,12 +523,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
                return err;
        }
 
-       if (0 != (err = videobuf_dma_pci_map(dev->pci, &dev->dmasound.dma))) {
+       if (0 != (err = videobuf_pci_dma_map(dev->pci, &dev->dmasound.dma))) {
                dsp_buffer_free(dev);
                return err;
        }
        if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) {
-               videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma);
+               videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma);
                dsp_buffer_free(dev);
                return err;
        }
@@ -537,7 +537,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
                                                dev->dmasound.dma.sglen,
                                                0))) {
                saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
-               videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma);
+               videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma);
                dsp_buffer_free(dev);
                return err;
        }
@@ -571,7 +571,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream)
 
        if (substream->runtime->dma_area) {
                saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
-               videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma);
+               videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma);
                dsp_buffer_free(dev);
                substream->runtime->dma_area = NULL;
        }
@@ -590,6 +590,11 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream)
 
 static int snd_card_saa7134_capture_close(struct snd_pcm_substream * substream)
 {
+       snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream);
+       struct saa7134_dev *dev = saa7134->dev;
+
+       dev->ctl_mute = 1;
+       saa7134_tvaudio_setmute(dev);
        return 0;
 }
 
@@ -631,6 +636,9 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
        runtime->private_free = snd_card_saa7134_runtime_free;
        runtime->hw = snd_card_saa7134_capture;
 
+       dev->ctl_mute = 0;
+       saa7134_tvaudio_setmute(dev);
+
        if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
                return err;
 
@@ -818,7 +826,7 @@ static int snd_saa7134_capsrc_put(struct snd_kcontrol * kcontrol,
                                break;
                }
 
-               /* output xbar always main channel */
+               /* output xbar always main channel */
                saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL1, 0xbbbb10);
 
                if (left || right) { // We've got data, turn the input on
@@ -929,7 +937,7 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
 
 
        err = request_irq(dev->pci->irq, saa7134_alsa_irq,
-                               SA_SHIRQ | SA_INTERRUPT, dev->name,
+                               IRQF_SHARED | IRQF_DISABLED, dev->name,
                                (void*) &dev->dmasound);
 
        if (err < 0) {
@@ -997,9 +1005,9 @@ static int saa7134_alsa_init(void)
        struct saa7134_dev *dev = NULL;
        struct list_head *list;
 
-       if (!dmasound_init && !dmasound_exit) {
-               dmasound_init = alsa_device_init;
-               dmasound_exit = alsa_device_exit;
+       if (!saa7134_dmasound_init && !saa7134_dmasound_exit) {
+               saa7134_dmasound_init = alsa_device_init;
+               saa7134_dmasound_exit = alsa_device_exit;
        } else {
                printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n");
                return -EBUSY;
@@ -1036,8 +1044,8 @@ static void saa7134_alsa_exit(void)
                snd_card_free(snd_saa7134_cards[idx]);
        }
 
-       dmasound_init = NULL;
-       dmasound_exit = NULL;
+       saa7134_dmasound_init = NULL;
+       saa7134_dmasound_exit = NULL;
        printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n");
 
        return;