aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs5535audio
diff options
context:
space:
mode:
authorJaya Kumar <jayakumar.lkml@gmail.com>2008-11-05 17:30:08 -0500
committerTakashi Iwai <tiwai@suse.de>2008-12-10 11:14:37 -0500
commitb035ce0f26812292d067fbe2fc9e9d88d5dfcdb4 (patch)
tree5c2e30e9e73e2542e9c97de2d689af17db358b0f /sound/pci/cs5535audio
parent0bed7b292d68f82316bfb8cd521e16c867689efe (diff)
ALSA: cs5535audio: turn off PCM properly if closing the audio device
As per <http://dev.laptop.org/ticket/1420>, 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 <jayakumar.lkml@gmail.com> Signed-off-by: Andres Salomon <dilinger@debian.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/cs5535audio')
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c3
-rw-r--r--sound/pci/cs5535audio/cs5535audio.h1
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pcm.c12
3 files changed, 15 insertions, 1 deletions
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 1d8b16052535..6c886edd06db 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -159,7 +159,8 @@ static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
159 return err; 159 return err;
160 160
161 memset(&ac97, 0, sizeof(ac97)); 161 memset(&ac97, 0, sizeof(ac97));
162 ac97.scaps = AC97_SCAP_AUDIO|AC97_SCAP_SKIP_MODEM; 162 ac97.scaps = AC97_SCAP_AUDIO | AC97_SCAP_SKIP_MODEM
163 | AC97_SCAP_POWER_SAVE;
163 ac97.private_data = cs5535au; 164 ac97.private_data = cs5535au;
164 ac97.pci = cs5535au->pci; 165 ac97.pci = cs5535au->pci;
165 166
diff --git a/sound/pci/cs5535audio/cs5535audio.h b/sound/pci/cs5535audio/cs5535audio.h
index 66bae7664193..57e9c65e6854 100644
--- a/sound/pci/cs5535audio/cs5535audio.h
+++ b/sound/pci/cs5535audio/cs5535audio.h
@@ -78,6 +78,7 @@ struct cs5535audio_dma {
78 unsigned int buf_addr, buf_bytes; 78 unsigned int buf_addr, buf_bytes;
79 unsigned int period_bytes, periods; 79 unsigned int period_bytes, periods;
80 u32 saved_prd; 80 u32 saved_prd;
81 int pcm_open_flag;
81}; 82};
82 83
83struct cs5535audio { 84struct cs5535audio {
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,
260 err = cs5535audio_build_dma_packets(cs5535au, dma, substream, 260 err = cs5535audio_build_dma_packets(cs5535au, dma, substream,
261 params_periods(hw_params), 261 params_periods(hw_params),
262 params_period_bytes(hw_params)); 262 params_period_bytes(hw_params));
263 if (!err)
264 dma->pcm_open_flag = 1;
265
263 return err; 266 return err;
264} 267}
265 268
@@ -268,6 +271,15 @@ static int snd_cs5535audio_hw_free(struct snd_pcm_substream *substream)
268 struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream); 271 struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
269 struct cs5535audio_dma *dma = substream->runtime->private_data; 272 struct cs5535audio_dma *dma = substream->runtime->private_data;
270 273
274 if (dma->pcm_open_flag) {
275 if (substream == cs5535au->playback_substream)
276 snd_ac97_update_power(cs5535au->ac97,
277 AC97_PCM_FRONT_DAC_RATE, 0);
278 else
279 snd_ac97_update_power(cs5535au->ac97,
280 AC97_PCM_LR_ADC_RATE, 0);
281 dma->pcm_open_flag = 0;
282 }
271 cs5535audio_clear_dma_packets(cs5535au, dma, substream); 283 cs5535audio_clear_dma_packets(cs5535au, dma, substream);
272 return snd_pcm_lib_free_pages(substream); 284 return snd_pcm_lib_free_pages(substream);
273} 285}