From b83f346bc4d6ab358fd0da85b7eab08bf0234c0b Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 13 Aug 2007 17:37:55 +0200 Subject: [ALSA] remove incorrect usage of SNDRV_PCM_INFO_SYNC_START and snd_pcm_set_sync() 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 Signed-off-by: Jaroslav Kysela --- sound/pci/cs5535audio/cs5535audio_pcm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sound/pci/cs5535audio/cs5535audio_pcm.c') diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index 5450a9e8f13..ec920cbb2a7 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c @@ -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; -- cgit v1.2.3 From 7abcacb09ac0f9c6848f1e7d86b284427fa83cee Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Mon, 3 Sep 2007 15:41:47 +0200 Subject: [ALSA] cs5535audio: correctly set dma->substream We're never actually setting dma->substream to the current substream; that means the dma->substream checks that we do in the suspend/resume path are never satisfied, and the PRD registers are never correctly managed. This changes it so that we set the substream when constructing the specific bus master DMA, and unsetting it when we tear down the BM's DMA. Signed-off-by: Andres Salomon Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/pci/cs5535audio/cs5535audio_pcm.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound/pci/cs5535audio/cs5535audio_pcm.c') diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index ec920cbb2a7..9a1e87fd481 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c @@ -161,6 +161,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au, jmpprd_addr = cpu_to_le32(lastdesc->addr + (sizeof(struct cs5535audio_dma_desc)*periods)); + dma->substream = substream; dma->period_bytes = period_bytes; dma->periods = periods; spin_lock_irq(&cs5535au->reg_lock); @@ -238,6 +239,7 @@ static void cs5535audio_clear_dma_packets(struct cs5535audio *cs5535au, { snd_dma_free_pages(&dma->desc_buf); dma->desc_buf.area = NULL; + dma->substream = NULL; } static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream, -- cgit v1.2.3 From 222fa0b0d2fdb2373a71d532c2cabd2ec920b3b3 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Mon, 3 Sep 2007 15:42:16 +0200 Subject: [ALSA] cs5535audio: fix PRD register save/restore power management race In the suspend path, we currently save the PRD registers and then disable DMA. This is racy; the sound hardware might update the PRD register as it finishes processing some DMA pages between when we've saved the PRD registers and when DMA actually gets disabled. Furthermore, we actively check whether or not DMA is enabled before saving PRD registers; there's no reason to do that, as the PRD registers should not update when we twiddle the ACC_BM[x]_CMD register(s). Worst case, we save the PRD registers twice; even powering down the ACC shouldn't mess with the PRD registers (according to the 5536 data sheet, section 5.3.7.4, power-down procedure). This patch reworks all that to first disable DMA, and then save PRD registers. Signed-off-by: Andres Salomon Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/pci/cs5535audio/cs5535audio_pcm.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound/pci/cs5535audio/cs5535audio_pcm.c') diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index 9a1e87fd481..21df0634af3 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c @@ -297,14 +297,12 @@ static int snd_cs5535audio_trigger(struct snd_pcm_substream *substream, int cmd) break; case SNDRV_PCM_TRIGGER_RESUME: dma->ops->enable_dma(cs5535au); - dma->suspended = 0; break; case SNDRV_PCM_TRIGGER_STOP: dma->ops->disable_dma(cs5535au); break; case SNDRV_PCM_TRIGGER_SUSPEND: dma->ops->disable_dma(cs5535au); - dma->suspended = 1; break; default: snd_printk(KERN_ERR "unhandled trigger\n"); -- cgit v1.2.3