Difference between revisions of "How to enable audio codec power saving"

From ThinkWiki
Jump to: navigation, search
(On-demand power control , confirms that X31 is supported with kernel version 2.6.20)
m (How to enable AC97 power saving moved to How to enable audio codec power saving: The page now covers non-AC97 codecs as well)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The AC97 sound device (e.g., AD1981B) requires a noticable amount of power (0.3W on {{T43}}). This power can be saved when the device is not in use.
+
=How to enable audio codec power saving=
 +
 
 +
The sound device (e.g., AD1981B or AD1892 codecs) requires a noticable amount of power (0.3W on {{T43}}). This power can be saved when the device is not in use by disabling it either completely, or partially.
  
 
==Disabling the device==
 
==Disabling the device==
Disable the sound device by unloading modules or {{cmdroot|echo -n 3 >  /sys/class/sound/controlC0/device/power/state}} (replace 3 by 0 to enable again).
+
Disable the entire sound device by unloading modules or, on older kernels, by {{cmdroot|echo -n 3 >  /sys/class/sound/controlC0/device/power/state}} (replace 3 by 0 to enable again).
  
 
==On-demand power control==
 
==On-demand power control==
 +
 +
On-demand power control lets the kernel switch off parts of the audio codec and audio bus that are not in use at the moment.  However, this can cause noticeable "click" sounds when enabling/disabling parts of the codec.
 +
 +
===AC97 audio subsystem===
 
There's an [http://www.kernel.org/git/?p=linux/kernel/git/perex/alsa.git;a=commitdiff_plain;h=6dbe662874ba08585eaf732d126762c25ac8e3f7;hp=2b29b13c5794f648cd5e839796496704d787f5a6 experimental patch from 2.6.19-rc2], [http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff_plain;h=da43deb116c0cea9ca2174f2ac64985c4d53077e;hp=dbedca39fe30db87b6401e4396f959c63d90082e that was later corrected in 2.6.19-rc3], which enables the support of aggressive AC97 power-saving mode in the Linux [[ALSA]] drivers.  In this mode, the AC97 powerdown register bits are dynamically controlled at each open/close of PCM streams. To allow powering off the analog mixer, make sure all analog inputs (Line, Microphone, CD, etc.) are muted.
 
There's an [http://www.kernel.org/git/?p=linux/kernel/git/perex/alsa.git;a=commitdiff_plain;h=6dbe662874ba08585eaf732d126762c25ac8e3f7;hp=2b29b13c5794f648cd5e839796496704d787f5a6 experimental patch from 2.6.19-rc2], [http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff_plain;h=da43deb116c0cea9ca2174f2ac64985c4d53077e;hp=dbedca39fe30db87b6401e4396f959c63d90082e that was later corrected in 2.6.19-rc3], which enables the support of aggressive AC97 power-saving mode in the Linux [[ALSA]] drivers.  In this mode, the AC97 powerdown register bits are dynamically controlled at each open/close of PCM streams. To allow powering off the analog mixer, make sure all analog inputs (Line, Microphone, CD, etc.) are muted.
  
Line 12: Line 18:
  
 
You may hear a faint click each time the device is powered up (at start of playback) and each time the device is powered down (2 seconds after playback ends).
 
You may hear a faint click each time the device is powered up (at start of playback) and each time the device is powered down (2 seconds after playback ends).
 +
 +
There are reports that on-demand power control can save 0.2W.  Make sure the microphone is muted, though, or its channel won't be turned off.
 +
 +
===HDA audio subsystem===
 +
If you have one of the newer Intel chips, there is an equivalent feature as of kernel 2.6.24, you can select the CONFIG_SND_HDA_POWER_SAVE option and set CONFIG_SND_HDA_POWER_SAVE_DEFAULT to the number of seconds after which you want the device to time out.
 +
 +
You can also control this on the fly via sysfs:
 +
 +
{{cmdroot|echo 10 > /sys/module/snd_hda_intel/parameters/power_save}}
 +
 +
would give you a timeout of 10 seconds. If you want to save more power you can disable the controller as well:
 +
 +
{{cmdroot|echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller}}
 +
 +
However you might want to disable this if you get annoyed by a "click" sound when the device wakes up again:
 +
 +
{{cmdroot|echo N > /sys/module/snd_hda_intel/parameters/power_save_controller}}

Latest revision as of 21:36, 27 January 2008

How to enable audio codec power saving

The sound device (e.g., AD1981B or AD1892 codecs) requires a noticable amount of power (0.3W on T43). This power can be saved when the device is not in use by disabling it either completely, or partially.

Disabling the device

Disable the entire sound device by unloading modules or, on older kernels, by # echo -n 3 > /sys/class/sound/controlC0/device/power/state (replace 3 by 0 to enable again).

On-demand power control

On-demand power control lets the kernel switch off parts of the audio codec and audio bus that are not in use at the moment. However, this can cause noticeable "click" sounds when enabling/disabling parts of the codec.

AC97 audio subsystem

There's an experimental patch from 2.6.19-rc2, that was later corrected in 2.6.19-rc3, which enables the support of aggressive AC97 power-saving mode in the Linux ALSA drivers. In this mode, the AC97 powerdown register bits are dynamically controlled at each open/close of PCM streams. To allow powering off the analog mixer, make sure all analog inputs (Line, Microphone, CD, etc.) are muted.

It is working without a hitch in an IBM X31 with kernel 2.6.20.

The mode is disabled by default, and activated via power_save=1 option for snd-ac97-codec driver (at run time, use # echo Y > /sys/module/snd_ac97_codec/parameters/power_save).

You may hear a faint click each time the device is powered up (at start of playback) and each time the device is powered down (2 seconds after playback ends).

There are reports that on-demand power control can save 0.2W. Make sure the microphone is muted, though, or its channel won't be turned off.

HDA audio subsystem

If you have one of the newer Intel chips, there is an equivalent feature as of kernel 2.6.24, you can select the CONFIG_SND_HDA_POWER_SAVE option and set CONFIG_SND_HDA_POWER_SAVE_DEFAULT to the number of seconds after which you want the device to time out.

You can also control this on the fly via sysfs:

# echo 10 > /sys/module/snd_hda_intel/parameters/power_save

would give you a timeout of 10 seconds. If you want to save more power you can disable the controller as well:

# echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller

However you might want to disable this if you get annoyed by a "click" sound when the device wakes up again:

# echo N > /sys/module/snd_hda_intel/parameters/power_save_controller