aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
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 /include/sound
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 'include/sound')
-rw-r--r--include/sound/ac97_codec.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 758f8bf133c7..4c43521cc493 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -27,6 +27,7 @@
27 27
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/workqueue.h>
30#include "pcm.h" 31#include "pcm.h"
31#include "control.h" 32#include "control.h"
32#include "info.h" 33#include "info.h"
@@ -140,6 +141,20 @@
140#define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */ 141#define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */
141#define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */ 142#define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */
142 143
144/* powerdown bits */
145#define AC97_PD_ADC_STATUS 0x0001 /* ADC status (RO) */
146#define AC97_PD_DAC_STATUS 0x0002 /* DAC status (RO) */
147#define AC97_PD_MIXER_STATUS 0x0004 /* Analog mixer status (RO) */
148#define AC97_PD_VREF_STATUS 0x0008 /* Vref status (RO) */
149#define AC97_PD_PR0 0x0100 /* Power down PCM ADCs and input MUX */
150#define AC97_PD_PR1 0x0200 /* Power down PCM front DAC */
151#define AC97_PD_PR2 0x0400 /* Power down Mixer (Vref still on) */
152#define AC97_PD_PR3 0x0800 /* Power down Mixer (Vref off) */
153#define AC97_PD_PR4 0x1000 /* Power down AC-Link */
154#define AC97_PD_PR5 0x2000 /* Disable internal clock usage */
155#define AC97_PD_PR6 0x4000 /* Headphone amplifier */
156#define AC97_PD_EAPD 0x8000 /* External Amplifer Power Down (EAPD) */
157
143/* extended audio ID bit defines */ 158/* extended audio ID bit defines */
144#define AC97_EI_VRA 0x0001 /* Variable bit rate supported */ 159#define AC97_EI_VRA 0x0001 /* Variable bit rate supported */
145#define AC97_EI_DRA 0x0002 /* Double rate supported */ 160#define AC97_EI_DRA 0x0002 /* Double rate supported */
@@ -359,6 +374,7 @@
359#define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */ 374#define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */
360#define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */ 375#define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */
361#define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */ 376#define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */
377#define AC97_SCAP_EAPD_LED (1<<10) /* EAPD as mute LED */
362 378
363/* ac97->flags */ 379/* ac97->flags */
364#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */ 380#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */
@@ -491,6 +507,12 @@ struct snd_ac97 {
491 /* jack-sharing info */ 507 /* jack-sharing info */
492 unsigned char indep_surround; 508 unsigned char indep_surround;
493 unsigned char channel_mode; 509 unsigned char channel_mode;
510
511#ifdef CONFIG_SND_AC97_POWER_SAVE
512 unsigned int power_up; /* power states */
513 struct workqueue_struct *power_workq;
514 struct work_struct power_work;
515#endif
494 struct device dev; 516 struct device dev;
495}; 517};
496 518
@@ -532,6 +554,15 @@ unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
532void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 554void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
533int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 555int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
534int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value); 556int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value);
557#ifdef CONFIG_SND_AC97_POWER_SAVE
558int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup);
559#else
560static inline int snd_ac97_update_power(struct snd_ac97 *ac97, int reg,
561 int powerup)
562{
563 return 0;
564}
565#endif
535#ifdef CONFIG_PM 566#ifdef CONFIG_PM
536void snd_ac97_suspend(struct snd_ac97 *ac97); 567void snd_ac97_suspend(struct snd_ac97 *ac97);
537void snd_ac97_resume(struct snd_ac97 *ac97); 568void snd_ac97_resume(struct snd_ac97 *ac97);
@@ -583,6 +614,7 @@ struct ac97_pcm {
583 copy_flag: 1, /* lowlevel driver must fill all entries */ 614 copy_flag: 1, /* lowlevel driver must fill all entries */
584 spdif: 1; /* spdif pcm */ 615 spdif: 1; /* spdif pcm */
585 unsigned short aslots; /* active slots */ 616 unsigned short aslots; /* active slots */
617 unsigned short cur_dbl; /* current double-rate state */
586 unsigned int rates; /* available rates */ 618 unsigned int rates; /* available rates */
587 struct { 619 struct {
588 unsigned short slots; /* driver input: requested AC97 slot numbers */ 620 unsigned short slots; /* driver input: requested AC97 slot numbers */