aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97/ac97_pcm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-06-27 12:28:53 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:37:08 -0400
commit6dbe662874ba08585eaf732d126762c25ac8e3f7 (patch)
tree7460c36d4d848f223b682f7a700866bcf6dbc7d5 /sound/pci/ac97/ac97_pcm.c
parent2b29b13c5794f648cd5e839796496704d787f5a6 (diff)
[ALSA] Add experimental support of aggressive AC97 power-saving mode
Added CONFIG_SND_AC97_POWER_SAVE kernel config to enable the support of aggressive AC97 power-saving mode. In this mode, the AC97 powerdown register bits are dynamically controlled at each open/close of PCM streams. The mode is activated via power_save option for snd-ac97-codec driver. As default it's off. It can be turned on/off on the fly via sysfs, too. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/ac97/ac97_pcm.c')
-rw-r--r--sound/pci/ac97/ac97_pcm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c
index f684aa2c0067..3758d07182f8 100644
--- a/sound/pci/ac97/ac97_pcm.c
+++ b/sound/pci/ac97/ac97_pcm.c
@@ -269,6 +269,7 @@ int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate)
269 return -EINVAL; 269 return -EINVAL;
270 } 270 }
271 271
272 snd_ac97_update_power(ac97, reg, 1);
272 switch (reg) { 273 switch (reg) {
273 case AC97_PCM_MIC_ADC_RATE: 274 case AC97_PCM_MIC_ADC_RATE:
274 if ((ac97->regs[AC97_EXTENDED_STATUS] & AC97_EA_VRM) == 0) /* MIC VRA */ 275 if ((ac97->regs[AC97_EXTENDED_STATUS] & AC97_EA_VRM) == 0) /* MIC VRA */
@@ -606,6 +607,7 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
606 goto error; 607 goto error;
607 } 608 }
608 } 609 }
610 pcm->cur_dbl = r;
609 spin_unlock_irq(&pcm->bus->bus_lock); 611 spin_unlock_irq(&pcm->bus->bus_lock);
610 for (i = 3; i < 12; i++) { 612 for (i = 3; i < 12; i++) {
611 if (!(slots & (1 << i))) 613 if (!(slots & (1 << i)))
@@ -651,6 +653,21 @@ int snd_ac97_pcm_close(struct ac97_pcm *pcm)
651 unsigned short slots = pcm->aslots; 653 unsigned short slots = pcm->aslots;
652 int i, cidx; 654 int i, cidx;
653 655
656#ifdef CONFIG_SND_AC97_POWER_SAVE
657 int r = pcm->cur_dbl;
658 for (i = 3; i < 12; i++) {
659 if (!(slots & (1 << i)))
660 continue;
661 for (cidx = 0; cidx < 4; cidx++) {
662 if (pcm->r[r].rslots[cidx] & (1 << i)) {
663 int reg = get_slot_reg(pcm, cidx, i, r);
664 snd_ac97_update_power(pcm->r[r].codec[cidx],
665 reg, 0);
666 }
667 }
668 }
669#endif
670
654 bus = pcm->bus; 671 bus = pcm->bus;
655 spin_lock_irq(&pcm->bus->bus_lock); 672 spin_lock_irq(&pcm->bus->bus_lock);
656 for (i = 3; i < 12; i++) { 673 for (i = 3; i < 12; i++) {
@@ -660,6 +677,7 @@ int snd_ac97_pcm_close(struct ac97_pcm *pcm)
660 bus->used_slots[pcm->stream][cidx] &= ~(1 << i); 677 bus->used_slots[pcm->stream][cidx] &= ~(1 << i);
661 } 678 }
662 pcm->aslots = 0; 679 pcm->aslots = 0;
680 pcm->cur_dbl = 0;
663 spin_unlock_irq(&pcm->bus->bus_lock); 681 spin_unlock_irq(&pcm->bus->bus_lock);
664 return 0; 682 return 0;
665} 683}