[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 ec9209cd517784f201316c21a2adcb49e048fe95..cf18fe4617a1e1f23848eed4965ce67a7d1b4b6b 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 c7f79be98d04c3feaedb21505137e86acb5f0391..31d8db9f7a4c023950fb14c6caee50212ede553a 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 44cf546076474c8f5e4ed61c181551262302f733..1fca49a1641a605b66fdc9dea461d4dc8d065149 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 5450a9e8f13366b991a223d985429cef7aa8180f..ec920cbb2a7196c9cf1ee778e56ee763b1cc35c8 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 6ace1076c19b80438d97c0df1817a4a07cbeb051..d619a3842cddb20c2492a6e79d17f4dcf7624947 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 5338243fb0353937c079885d1de4d28ba5c210a3..c4af57fb5af15d28cc92fa759e217be664a7639d 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 8a5ff1cb53624a7af375202fde52073d733d21cc..32245770595e99d12052643e0a710cae58dbab8c 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 c5109547f43ff5aca1ca59690ec39637fdfec9e9..880b824e24cd6a319174525a112a5fafd8295e07 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 c7621bd770a6eb116c48056d9a2168c64315ea52..276c5763f0e5dc0e2894d14c4daca58293b2ff00 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 1b787f45557674800d2100d16b6b3dc407894484..cd4613a97bd78384267782163cbd257ab15a4976 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 9a4596f879e860df29bcbe49944e8bae52723bac..ba4a34bae48f4ddcebdeaedaa31a93857264a52a 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 adbc86855b0930fccefdc38d745e9418aae69694..04b95ae5c3aa0ddf864e2cd17da4729220f5aa06 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;