]> err.no Git - linux-2.6/blobdiff - sound/pci/ca0106/ca0106_main.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[linux-2.6] / sound / pci / ca0106 / ca0106_main.c
index 611fc15a0545b22a33e714ed8b9e8a8d5ffb077a..ecbe79b67e437c0d94018e67e1a15f12984a2dbd 100644 (file)
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
-#include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -274,10 +273,11 @@ static struct snd_ca0106_details ca0106_chip_details[] = {
 
 /* hardware definition */
 static struct snd_pcm_hardware snd_ca0106_playback_hw = {
-       .info =                 (SNDRV_PCM_INFO_MMAP | 
-                                SNDRV_PCM_INFO_INTERLEAVED |
-                                SNDRV_PCM_INFO_BLOCK_TRANSFER |
-                                SNDRV_PCM_INFO_MMAP_VALID),
+       .info =                 SNDRV_PCM_INFO_MMAP | 
+                               SNDRV_PCM_INFO_INTERLEAVED |
+                               SNDRV_PCM_INFO_BLOCK_TRANSFER |
+                               SNDRV_PCM_INFO_MMAP_VALID |
+                               SNDRV_PCM_INFO_SYNC_START,
        .formats =              SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE,
        .rates =                (SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
                                 SNDRV_PCM_RATE_192000),
@@ -435,22 +435,22 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu,
 static void snd_ca0106_intr_enable(struct snd_ca0106 *emu, unsigned int intrenb)
 {
        unsigned long flags;
-       unsigned int enable;
-  
+       unsigned int intr_enable;
+
        spin_lock_irqsave(&emu->emu_lock, flags);
-       enable = inl(emu->port + INTE) | intrenb;
-       outl(enable, emu->port + INTE);
+       intr_enable = inl(emu->port + INTE) | intrenb;
+       outl(intr_enable, emu->port + INTE);
        spin_unlock_irqrestore(&emu->emu_lock, flags);
 }
 
 static void snd_ca0106_intr_disable(struct snd_ca0106 *emu, unsigned int intrenb)
 {
        unsigned long flags;
-       unsigned int enable;
-  
+       unsigned int intr_enable;
+
        spin_lock_irqsave(&emu->emu_lock, flags);
-       enable = inl(emu->port + INTE) & ~intrenb;
-       outl(enable, emu->port + INTE);
+       intr_enable = inl(emu->port + INTE) & ~intrenb;
+       outl(intr_enable, emu->port + INTE);
        spin_unlock_irqrestore(&emu->emu_lock, flags);
 }
 
@@ -507,6 +507,7 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr
                 return err;
        if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
                 return err;
+       snd_pcm_set_sync(substream);
 
        if (chip->details->spi_dac && channel_id != PCM_FRONT_CHANNEL) {
                const int reg = spi_dacd_reg[channel_id];
@@ -853,6 +854,9 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
                break;
        }
         snd_pcm_group_for_each_entry(s, substream) {
+               if (snd_pcm_substream_chip(s) != emu ||
+                   s->stream != SNDRV_PCM_STREAM_PLAYBACK)
+                       continue;
                runtime = s->runtime;
                epcm = runtime->private_data;
                channel = epcm->channel_id;
@@ -1110,6 +1114,8 @@ static int snd_ca0106_free(struct snd_ca0106 *chip)
                 * So we can fix: snd-malloc: Memory leak?  pages not freed = 8
                 */
        }
+       if (chip->irq >= 0)
+               free_irq(chip->irq, chip);
        // release the data
 #if 1
        if (chip->buffer.area)
@@ -1119,9 +1125,6 @@ static int snd_ca0106_free(struct snd_ca0106 *chip)
        // release the i/o port
        release_and_free_resource(chip->res_port);
 
-       // release the irq
-       if (chip->irq >= 0)
-               free_irq(chip->irq, chip);
        pci_disable_device(chip->pci);
        kfree(chip);
        return 0;