From b035ce0f26812292d067fbe2fc9e9d88d5dfcdb4 Mon Sep 17 00:00:00 2001 From: Jaya Kumar Date: Wed, 5 Nov 2008 17:30:08 -0500 Subject: ALSA: cs5535audio: turn off PCM properly if closing the audio device As per , we need to properly turn off the PCM if we're closing the device in order to save power. This also causes the MIC led to turn off properly. Signed-off-by: Jaya Kumar Signed-off-by: Andres Salomon Signed-off-by: Takashi Iwai --- sound/pci/cs5535audio/cs5535audio_pcm.c | 12 ++++++++++++ 1 file changed, 12 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 cdcda87116c3..6aa0c19390d7 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c @@ -260,6 +260,9 @@ static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream, err = cs5535audio_build_dma_packets(cs5535au, dma, substream, params_periods(hw_params), params_period_bytes(hw_params)); + if (!err) + dma->pcm_open_flag = 1; + return err; } @@ -268,6 +271,15 @@ static int snd_cs5535audio_hw_free(struct snd_pcm_substream *substream) struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream); struct cs5535audio_dma *dma = substream->runtime->private_data; + if (dma->pcm_open_flag) { + if (substream == cs5535au->playback_substream) + snd_ac97_update_power(cs5535au->ac97, + AC97_PCM_FRONT_DAC_RATE, 0); + else + snd_ac97_update_power(cs5535au->ac97, + AC97_PCM_LR_ADC_RATE, 0); + dma->pcm_open_flag = 0; + } cs5535audio_clear_dma_packets(cs5535au, dma, substream); return snd_pcm_lib_free_pages(substream); } -- cgit