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 9a1e87fd4815..21df0634af32 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-59-g8ed1b