[ALSA] remove incorrect usage of SNDRV_PCM_INFO_SYNC_START and snd_pcm_set_sync()
authorClemens Ladisch <clemens@ladisch.de>
Mon, 13 Aug 2007 15:37:55 +0000 (17:37 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 13:58:52 +0000 (15:58 +0200)
Set the SNDRV_PCM_INFO_SYNC_START flag and the substream's sync ID
(only) if the substream actually can be linked to another one.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
12 files changed:
sound/isa/ad1816a/ad1816a_lib.c
sound/pci/ca0106/ca0106_main.c
sound/pci/cs4281.c
sound/pci/cs5535audio/cs5535audio_pcm.c
sound/pci/emu10k1/p16v.c
sound/pci/korg1212/korg1212.c
sound/pci/maestro3.c
sound/pci/mixart/mixart.c
sound/pci/nm256/nm256.c
sound/pci/pcxhr/pcxhr.c
sound/pci/rme96.c
sound/ppc/pmac.c

index ec9209c..cf18fe4 100644 (file)
@@ -453,7 +453,6 @@ static int snd_ad1816a_playback_open(struct snd_pcm_substream *substream)
 
        if ((error = snd_ad1816a_open(chip, AD1816A_MODE_PLAYBACK)) < 0)
                return error;
-       snd_pcm_set_sync(substream);
        runtime->hw = snd_ad1816a_playback;
        snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max);
        snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.period_bytes_max);
@@ -469,7 +468,6 @@ static int snd_ad1816a_capture_open(struct snd_pcm_substream *substream)
 
        if ((error = snd_ad1816a_open(chip, AD1816A_MODE_CAPTURE)) < 0)
                return error;
-       snd_pcm_set_sync(substream);
        runtime->hw = snd_ad1816a_capture;
        snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max);
        snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.period_bytes_max);
index c7f79be..31d8db9 100644 (file)
@@ -274,10 +274,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),
@@ -507,6 +508,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];
index 44cf546..1fca49a 100644 (file)
@@ -842,12 +842,11 @@ static snd_pcm_uframes_t snd_cs4281_pointer(struct snd_pcm_substream *substream)
 
 static struct snd_pcm_hardware snd_cs4281_playback =
 {
-       .info =                 (SNDRV_PCM_INFO_MMAP |
-                                SNDRV_PCM_INFO_INTERLEAVED |
-                                SNDRV_PCM_INFO_MMAP_VALID |
-                                SNDRV_PCM_INFO_PAUSE |
-                                SNDRV_PCM_INFO_RESUME |
-                                SNDRV_PCM_INFO_SYNC_START),
+       .info =                 SNDRV_PCM_INFO_MMAP |
+                               SNDRV_PCM_INFO_INTERLEAVED |
+                               SNDRV_PCM_INFO_MMAP_VALID |
+                               SNDRV_PCM_INFO_PAUSE |
+                               SNDRV_PCM_INFO_RESUME,
        .formats =              SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 |
                                SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_S16_LE |
                                SNDRV_PCM_FMTBIT_U16_BE | SNDRV_PCM_FMTBIT_S16_BE |
@@ -868,12 +867,11 @@ static struct snd_pcm_hardware snd_cs4281_playback =
 
 static struct snd_pcm_hardware snd_cs4281_capture =
 {
-       .info =                 (SNDRV_PCM_INFO_MMAP |
-                                SNDRV_PCM_INFO_INTERLEAVED |
-                                SNDRV_PCM_INFO_MMAP_VALID |
-                                SNDRV_PCM_INFO_PAUSE |
-                                SNDRV_PCM_INFO_RESUME |
-                                SNDRV_PCM_INFO_SYNC_START),
+       .info =                 SNDRV_PCM_INFO_MMAP |
+                               SNDRV_PCM_INFO_INTERLEAVED |
+                               SNDRV_PCM_INFO_MMAP_VALID |
+                               SNDRV_PCM_INFO_PAUSE |
+                               SNDRV_PCM_INFO_RESUME,
        .formats =              SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 |
                                SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_S16_LE |
                                SNDRV_PCM_FMTBIT_U16_BE | SNDRV_PCM_FMTBIT_S16_BE |
@@ -904,7 +902,6 @@ static int snd_cs4281_playback_open(struct snd_pcm_substream *substream)
        dma->right_slot = 1;
        runtime->private_data = dma;
        runtime->hw = snd_cs4281_playback;
-       snd_pcm_set_sync(substream);
        /* should be detected from the AC'97 layer, but it seems
           that although CS4297A rev B reports 18-bit ADC resolution,
           samples are 20-bit */
@@ -924,7 +921,6 @@ static int snd_cs4281_capture_open(struct snd_pcm_substream *substream)
        dma->right_slot = 11;
        runtime->private_data = dma;
        runtime->hw = snd_cs4281_capture;
-       snd_pcm_set_sync(substream);
        /* should be detected from the AC'97 layer, but it seems
           that although CS4297A rev B reports 18-bit ADC resolution,
           samples are 20-bit */
index 5450a9e..ec920cb 100644 (file)
@@ -43,7 +43,6 @@ static struct snd_pcm_hardware snd_cs5535audio_playback =
                                SNDRV_PCM_INFO_BLOCK_TRANSFER |
                                SNDRV_PCM_INFO_MMAP_VALID |
                                SNDRV_PCM_INFO_PAUSE |
-                               SNDRV_PCM_INFO_SYNC_START |
                                SNDRV_PCM_INFO_RESUME
                                ),
        .formats =              (
@@ -71,8 +70,7 @@ static struct snd_pcm_hardware snd_cs5535audio_capture =
                                SNDRV_PCM_INFO_MMAP |
                                SNDRV_PCM_INFO_INTERLEAVED |
                                SNDRV_PCM_INFO_BLOCK_TRANSFER |
-                               SNDRV_PCM_INFO_MMAP_VALID |
-                               SNDRV_PCM_INFO_SYNC_START
+                               SNDRV_PCM_INFO_MMAP_VALID
                                ),
        .formats =              (
                                SNDRV_PCM_FMTBIT_S16_LE
@@ -102,7 +100,6 @@ static int snd_cs5535audio_playback_open(struct snd_pcm_substream *substream)
        runtime->hw = snd_cs5535audio_playback;
        cs5535au->playback_substream = substream;
        runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_PLAYBACK]);
-       snd_pcm_set_sync(substream);
        if ((err = snd_pcm_hw_constraint_integer(runtime,
                                SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
                return err;
@@ -348,7 +345,6 @@ static int snd_cs5535audio_capture_open(struct snd_pcm_substream *substream)
        runtime->hw = snd_cs5535audio_capture;
        cs5535au->capture_substream = substream;
        runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_CAPTURE]);
-       snd_pcm_set_sync(substream);
        if ((err = snd_pcm_hw_constraint_integer(runtime,
                                         SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
                return err;
index 6ace107..d619a38 100644 (file)
 
  /* hardware definition */
 static struct snd_pcm_hardware snd_p16v_playback_hw = {
-       .info =                 (SNDRV_PCM_INFO_MMAP | 
-                                SNDRV_PCM_INFO_INTERLEAVED |
-                                SNDRV_PCM_INFO_BLOCK_TRANSFER |
-                                SNDRV_PCM_INFO_RESUME |
-                                SNDRV_PCM_INFO_MMAP_VALID),
+       .info =                 SNDRV_PCM_INFO_MMAP | 
+                               SNDRV_PCM_INFO_INTERLEAVED |
+                               SNDRV_PCM_INFO_BLOCK_TRANSFER |
+                               SNDRV_PCM_INFO_RESUME |
+                               SNDRV_PCM_INFO_MMAP_VALID |
+                               SNDRV_PCM_INFO_SYNC_START,
        .formats =              SNDRV_PCM_FMTBIT_S32_LE, /* Only supports 24-bit samples padded to 32 bits. */
        .rates =                SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100, 
        .rate_min =             44100,
@@ -207,6 +208,11 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea
        if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
                 return err;
 
+       runtime->sync.id32[0] = substream->pcm->card->number;
+       runtime->sync.id32[1] = 'P';
+       runtime->sync.id32[2] = 16;
+       runtime->sync.id32[3] = 'V';
+
        return 0;
 }
 /* open_capture callback */
index 5338243..c4af57f 100644 (file)
@@ -1391,8 +1391,6 @@ static int snd_korg1212_playback_open(struct snd_pcm_substream *substream)
        K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_open [%s]\n",
                           stateName[korg1212->cardState]);
 
-        snd_pcm_set_sync(substream);    // ???
-
        snd_korg1212_OpenCard(korg1212);
 
         runtime->hw = snd_korg1212_playback_info;
@@ -1422,8 +1420,6 @@ static int snd_korg1212_capture_open(struct snd_pcm_substream *substream)
        K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_open [%s]\n",
                           stateName[korg1212->cardState]);
 
-        snd_pcm_set_sync(substream);
-
        snd_korg1212_OpenCard(korg1212);
 
         runtime->hw = snd_korg1212_capture_info;
index 8a5ff1c..3224577 100644 (file)
@@ -1821,7 +1821,6 @@ snd_m3_playback_open(struct snd_pcm_substream *subs)
                return err;
 
        runtime->hw = snd_m3_playback;
-       snd_pcm_set_sync(subs);
 
        return 0;
 }
@@ -1846,7 +1845,6 @@ snd_m3_capture_open(struct snd_pcm_substream *subs)
                return err;
 
        runtime->hw = snd_m3_capture;
-       snd_pcm_set_sync(subs);
 
        return 0;
 }
index c510954..880b824 100644 (file)
@@ -652,7 +652,7 @@ static int snd_mixart_hw_free(struct snd_pcm_substream *subs)
 static struct snd_pcm_hardware snd_mixart_analog_caps =
 {
        .info             = ( SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
-                             SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START |
+                             SNDRV_PCM_INFO_MMAP_VALID |
                              SNDRV_PCM_INFO_PAUSE),
        .formats          = ( SNDRV_PCM_FMTBIT_U8 |
                              SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
@@ -673,7 +673,7 @@ static struct snd_pcm_hardware snd_mixart_analog_caps =
 static struct snd_pcm_hardware snd_mixart_digital_caps =
 {
        .info             = ( SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
-                             SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START |
+                             SNDRV_PCM_INFO_MMAP_VALID |
                              SNDRV_PCM_INFO_PAUSE),
        .formats          = ( SNDRV_PCM_FMTBIT_U8 |
                              SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
index c7621bd..276c576 100644 (file)
@@ -842,7 +842,6 @@ static void snd_nm256_setup_stream(struct nm256 *chip, struct nm256_stream *s,
        runtime->private_data = s;
        s->substream = substream;
 
-       snd_pcm_set_sync(substream);
        snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                   &constraints_rates);
 }
index 1b787f4..cd4613a 100644 (file)
@@ -904,6 +904,8 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
        snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 4);
        snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4);
 
+       snd_pcm_set_sync(subs);
+
        mgr->ref_count_rate++;
 
        mutex_unlock(&mgr->setup_mutex);
index 9a4596f..ba4a34b 100644 (file)
@@ -1176,8 +1176,6 @@ snd_rme96_playback_spdif_open(struct snd_pcm_substream *substream)
        struct rme96 *rme96 = snd_pcm_substream_chip(substream);
        struct snd_pcm_runtime *runtime = substream->runtime;
 
-       snd_pcm_set_sync(substream);
-
        spin_lock_irq(&rme96->lock);    
         if (rme96->playback_substream != NULL) {
                spin_unlock_irq(&rme96->lock);
@@ -1214,8 +1212,6 @@ snd_rme96_capture_spdif_open(struct snd_pcm_substream *substream)
        struct rme96 *rme96 = snd_pcm_substream_chip(substream);
        struct snd_pcm_runtime *runtime = substream->runtime;
 
-       snd_pcm_set_sync(substream);
-
        runtime->hw = snd_rme96_capture_spdif_info;
         if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
             (rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0)
@@ -1247,8 +1243,6 @@ snd_rme96_playback_adat_open(struct snd_pcm_substream *substream)
        struct rme96 *rme96 = snd_pcm_substream_chip(substream);
        struct snd_pcm_runtime *runtime = substream->runtime;        
        
-       snd_pcm_set_sync(substream);
-
        spin_lock_irq(&rme96->lock);    
         if (rme96->playback_substream != NULL) {
                spin_unlock_irq(&rme96->lock);
@@ -1280,8 +1274,6 @@ snd_rme96_capture_adat_open(struct snd_pcm_substream *substream)
        struct rme96 *rme96 = snd_pcm_substream_chip(substream);
        struct snd_pcm_runtime *runtime = substream->runtime;
 
-       snd_pcm_set_sync(substream);
-
        runtime->hw = snd_rme96_capture_adat_info;
         if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
                 /* makes no sense to use analog input. Note that analog
index adbc868..04b95ae 100644 (file)
@@ -551,9 +551,6 @@ static int snd_pmac_pcm_open(struct snd_pmac *chip, struct pmac_stream *rec,
 
        runtime->hw.periods_max = rec->cmd.size - 1;
 
-       if (chip->can_duplex)
-               snd_pcm_set_sync(subs);
-
        /* constraints to fix choppy sound */
        snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
        return 0;