Difference between pages "Power Management" and "Intel HD Audio"

From Funtoo
(Difference between pages)
Jump to: navigation, search
 
P4 (Talk)
m
 
Line 1: Line 1:
__TOC__
+
== Introduction ==
Note: This page is a work in progress.
+
  
== Who is this for? ==
+
This tutorial describes how to configure an Intel HD Audio sound card. It explains the configuration at the kernel level and the changes you'll need to make to /etc/modprobe.d/alsa.conf.
  
The majority of people who will be interested in power management on Funtoo will be split into the following two cases:
+
== Prerequisites ==
  
* Laptop users
+
Before using this tutorial to configure your PC's sound card, make sure that the command '''''lspci''''' displays information similar to the following:
* Low Power Workstation/Server users
+
  
This article is currently almost exclusively directed at laptop users.
+
<pre>
 +
# lspci | grep -i audio
 +
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
 +
</pre>
  
==== Why bother? ====
+
In addition, the following packages must be installed. They are usually installed during the installation of the base system.
  
Battery life, environmentalism, obsessiveness.
+
*media-libs/alsa-lib
 +
*media-plugins/gst-plugins-alsa
 +
*media-sound/alsa-headers
 +
*media-sound/alsa-utils
  
The author of this article saw a huge improvement in battery life after setting up necessary options, jumping from a 5:37 hour ACPI estimate to over 11 hours! (Thinkpad T420, 9-cell battery)
+
The codec for the sound card used in this example is:
  
We've only got one planet right now, resources are limited, so why not use them wisely? Saving power reduces strain on your infrastructure and might save a couple furry bear cubs down the road. Also note that a reduction in power consumption means a reduction in your electricity bill.
+
<pre>
 +
$ cat /proc/asound/card*/codec#0 | grep -i codec
 +
Codec: IDT 92HD73C1X5
 +
</pre>
  
== The trade-off ==
+
== Kernel configuration ==
  
First of all, you need to decide how much performance (if any) you're willing to sacrifice for a reduction in power.
+
{{Fancynote|The kernel configuration shown in this example is based on vanilla-sources-3.0.3, but the options are present in other versions of the kernel, including gentoo-sources and git-sources.}}
  
Tools like laptop-mode and cpufreqd can cause a reduction in performance, however with careful configuration you can make this minimal while maintaining most of the benefits. Throughout this guide make sure to read comments in configuration files and decide what you need and want.
+
=== menuconfig ===
  
== Getting started ==
+
Shown here are the kernel options that need to be selected. Configure the options as modules ('''<M>''') if permitted. Leave the other options as they are.  
 
+
----
+
 
+
==== Using Gentoo's resources ====
+
 
+
You'll find a fantastically written starter guide on the Gentoo site [http://www.gentoo.org/doc/en/power-management-guide.xml], note however that you are not required to use Gentoo-Sources. (Making your own kernel is a boatload of fun though! You're missing out.)
+
 
+
==== Laptop-mode-tools ====
+
 
+
Laptop-mode-tools should be reasonably well configured out of the box.
+
  
 
<pre>
 
<pre>
vim /etc/laptop-mode/laptop-mode.conf
+
Device Drivers  --->
 +
  <M> Sound card support  --->
 +
    [*]  Preclaim OSS device numbers
 +
    <M>  Advanced Linux Sound Architecture  --->
 +
      <M>  Sequencer support
 +
      <M>    Sequencer dummy client
 +
      <M>  OSS Mixer API
 +
      <M>  OSS PCM (digital audio) API
 +
      [*]    OSS PCM (digital audio) API - Include plugin system
 +
      [*]  OSS Sequencer API
 +
      <M>  HR-timer backend support
 +
      [*]    Use HR-timer as default sequencer timer
 +
      -*-  Dynamic device file minor numbers
 +
      [*]  Verbose procfs contents
 +
      [*]  Generic sound devices  --->
 +
        <M>  Virtual MIDI soundcard
 +
      [*]  PCI sound devices  --->
 +
        <M>  Intel HD Audio  --->
 +
          [*]  Build Realtek HD-audio codec support
 +
          [*]  Build Analog Device HD-audio codec support
 +
          [*]  Build IDT/Sigmatel HD-audio codec support
 +
          [*]  Build VIA HD-audio codec support
 +
          [*]  Build HDMI/DisplayPort HD-audio codec support
 +
          [*]  Build Conexant HD-audio codec support
 +
          [*]  Build Creative CA0110-IBG codec support
 +
          [*]  Build C-Media HD-audio codec support
 +
          [*]  Build Silicon Labs 3054 HD-modem codec support
 +
          [*]  Enable generic HD-audio codec parser
 +
          [*]  Aggressive power-saving on HD-audio
 +
          (20)    Default time-out for HD-audio power-save mode
 +
      [*]  USB sound devices  --->
 +
        <M>  USB Audio/MIDI driver
 +
      [*]  FireWire sound devices  --->
 
</pre>
 
</pre>
  
Make sure it's enabled:
+
=== /usr/src/linux/.config ===
<pre>
+
 
###############################################################################
+
The options required for the sound card can be selected by editing /usr/src/linux/.config as well:
# Enable/Disable laptop-mode-tools execution
+
# ------------------------------------------
+
# Set it to 0 to completely disable laptop-mode-tools from running
+
###############################################################################
+
#
+
ENABLE_LAPTOP_MODE_TOOLS=1
+
</pre>
+
  
Next declare when to use laptop-mode:
 
 
<pre>
 
<pre>
# Enable laptop mode when on battery power.
+
CONFIG_SOUND=m
#
+
CONFIG_SOUND_OSS_CORE=y
ENABLE_LAPTOP_MODE_ON_BATTERY=1
+
CONFIG_SOUND_OSS_CORE_PRECLAIM=y
 +
CONFIG_SND=m
 +
CONFIG_SND_TIMER=m
 +
CONFIG_SND_PCM=m
 +
CONFIG_SND_HWDEP=m
 +
CONFIG_SND_RAWMIDI=m
 +
CONFIG_SND_SEQUENCER=m
 +
CONFIG_SND_SEQ_DUMMY=m
 +
CONFIG_SND_OSSEMUL=y
 +
CONFIG_SND_MIXER_OSS=m
 +
CONFIG_SND_PCM_OSS=m
 +
CONFIG_SND_PCM_OSS_PLUGINS=y
 +
CONFIG_SND_SEQUENCER_OSS=y
 +
CONFIG_SND_HRTIMER=m
 +
CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
 +
CONFIG_SND_DYNAMIC_MINORS=y
 +
# CONFIG_SND_SUPPORT_OLD_API is not set
 +
CONFIG_SND_VERBOSE_PROCFS=y
 +
# CONFIG_SND_VERBOSE_PRINTK is not set
 +
# CONFIG_SND_DEBUG is not set
 +
CONFIG_SND_VMASTER=y
 +
CONFIG_SND_DMA_SGBUF=y
 +
CONFIG_SND_RAWMIDI_SEQ=m
 +
# CONFIG_SND_OPL3_LIB_SEQ is not set
 +
# CONFIG_SND_OPL4_LIB_SEQ is not set
 +
# CONFIG_SND_SBAWE_SEQ is not set
 +
# CONFIG_SND_EMU10K1_SEQ is not set
 +
CONFIG_SND_DRIVERS=y
 +
# CONFIG_SND_PCSP is not set
 +
# CONFIG_SND_DUMMY is not set
 +
# CONFIG_SND_ALOOP is not set
 +
CONFIG_SND_VIRMIDI=m
 +
# CONFIG_SND_MTPAV is not set
 +
# CONFIG_SND_SERIAL_U16550 is not set
 +
# CONFIG_SND_MPU401 is not set
 +
CONFIG_SND_PCI=y
 +
# CONFIG_SND_AD1889 is not set
 +
# CONFIG_SND_ALS300 is not set
 +
# CONFIG_SND_ALS4000 is not set
 +
# CONFIG_SND_ALI5451 is not set
 +
# CONFIG_SND_ASIHPI is not set
 +
# CONFIG_SND_ATIIXP is not set
 +
# CONFIG_SND_ATIIXP_MODEM is not set
 +
# CONFIG_SND_AU8810 is not set
 +
# CONFIG_SND_AU8820 is not set
 +
# CONFIG_SND_AU8830 is not set
 +
# CONFIG_SND_AW2 is not set
 +
# CONFIG_SND_AZT3328 is not set
 +
# CONFIG_SND_BT87X is not set
 +
# CONFIG_SND_CA0106 is not set
 +
# CONFIG_SND_CMIPCI is not set
 +
# CONFIG_SND_OXYGEN is not set
 +
# CONFIG_SND_CS4281 is not set
 +
# CONFIG_SND_CS46XX is not set
 +
# CONFIG_SND_CS5530 is not set
 +
# CONFIG_SND_CS5535AUDIO is not set
 +
# CONFIG_SND_CTXFI is not set
 +
# CONFIG_SND_DARLA20 is not set
 +
# CONFIG_SND_GINA20 is not set
 +
# CONFIG_SND_LAYLA20 is not set
 +
# CONFIG_SND_DARLA24 is not set
 +
# CONFIG_SND_GINA24 is not set
 +
# CONFIG_SND_LAYLA24 is not set
 +
# CONFIG_SND_MONA is not set
 +
# CONFIG_SND_MIA is not set
 +
# CONFIG_SND_ECHO3G is not set
 +
# CONFIG_SND_INDIGO is not set
 +
# CONFIG_SND_INDIGOIO is not set
 +
# CONFIG_SND_INDIGODJ is not set
 +
# CONFIG_SND_INDIGOIOX is not set
 +
# CONFIG_SND_INDIGODJX is not set
 +
# CONFIG_SND_EMU10K1 is not set
 +
# CONFIG_SND_EMU10K1X is not set
 +
# CONFIG_SND_ENS1370 is not set
 +
# CONFIG_SND_ENS1371 is not set
 +
# CONFIG_SND_ES1938 is not set
 +
# CONFIG_SND_ES1968 is not set
 +
# CONFIG_SND_FM801 is not set
 +
CONFIG_SND_HDA_INTEL=m
 +
# CONFIG_SND_HDA_HWDEP is not set
 +
# CONFIG_SND_HDA_INPUT_BEEP is not set
 +
# CONFIG_SND_HDA_INPUT_JACK is not set
 +
# CONFIG_SND_HDA_PATCH_LOADER is not set
 +
CONFIG_SND_HDA_CODEC_REALTEK=y
 +
CONFIG_SND_HDA_CODEC_ANALOG=y
 +
CONFIG_SND_HDA_CODEC_SIGMATEL=y
 +
CONFIG_SND_HDA_CODEC_VIA=y
 +
CONFIG_SND_HDA_CODEC_HDMI=y
 +
# CONFIG_SND_HDA_CODEC_CIRRUS is not set
 +
CONFIG_SND_HDA_CODEC_CONEXANT=y
 +
CONFIG_SND_HDA_CODEC_CA0110=y
 +
CONFIG_SND_HDA_CODEC_CMEDIA=y
 +
CONFIG_SND_HDA_CODEC_SI3054=y
 +
CONFIG_SND_HDA_GENERIC=y
 +
CONFIG_SND_HDA_POWER_SAVE=y
 +
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=20
 +
# CONFIG_SND_HDSP is not set
 +
# CONFIG_SND_HDSPM is not set
 +
# CONFIG_SND_ICE1712 is not set
 +
# CONFIG_SND_ICE1724 is not set
 +
# CONFIG_SND_INTEL8X0 is not set
 +
# CONFIG_SND_INTEL8X0M is not set
 +
# CONFIG_SND_KORG1212 is not set
 +
# CONFIG_SND_LOLA is not set
 +
# CONFIG_SND_LX6464ES is not set
 +
# CONFIG_SND_MAESTRO3 is not set
 +
# CONFIG_SND_MIXART is not set
 +
# CONFIG_SND_NM256 is not set
 +
# CONFIG_SND_PCXHR is not set
 +
# CONFIG_SND_RIPTIDE is not set
 +
# CONFIG_SND_RME32 is not set
 +
# CONFIG_SND_RME96 is not set
 +
# CONFIG_SND_RME9652 is not set
 +
# CONFIG_SND_SONICVIBES is not set
 +
# CONFIG_SND_TRIDENT is not set
 +
# CONFIG_SND_VIA82XX is not set
 +
# CONFIG_SND_VIA82XX_MODEM is not set
 +
# CONFIG_SND_VIRTUOSO is not set
 +
# CONFIG_SND_VX222 is not set
 +
# CONFIG_SND_YMFPCI is not set
 +
CONFIG_SND_USB=y
 +
CONFIG_SND_USB_AUDIO=m
 +
# CONFIG_SND_USB_UA101 is not set
 +
# CONFIG_SND_USB_USX2Y is not set
 +
# CONFIG_SND_USB_CAIAQ is not set
 +
# CONFIG_SND_USB_US122L is not set
 +
# CONFIG_SND_USB_6FIRE is not set
 +
CONFIG_SND_FIREWIRE=y
 +
# CONFIG_SND_FIREWIRE_SPEAKERS is not set
 +
# CONFIG_SND_ISIGHT is not set
 +
# CONFIG_SND_PCMCIA is not set
 +
# CONFIG_SND_SOC is not set
 +
# CONFIG_SOUND_PRIME is not set
 +
</pre>
  
# Enable laptop mode when on AC power.
+
== /etc/modprobe.d/alsa.conf ==
#
+
ENABLE_LAPTOP_MODE_ON_AC=0
+
</pre>
+
  
Next you will probably be safe to enable AUTO_MODULES with:
+
=== Dell laptop ===
<pre>
+
  
ENABLE_AUTO_MODULES=1
+
{{Fancynote|The configuration shown here applies to a Dell Studio 1749 laptop. It might also be applicable to other Dell laptops.}}
</pre>
+
  
However, provided you're not using HAL (You shouldn't be, it's deprecated and is replaced by udev) you may want to disable the HAL module explicitly:
+
If you plan on using external speakers or a headset, you need to edit /etc/modprobe.d/alsa.conf so that the integrated speakers are muted when you plug an external sound device in. Add the following lines to the end of the file:
<pre>
+
vim /etc/laptop-mode/conf.d/hal-polling.conf
+
----
+
CONTROL_HAL_POLLING=0
+
</pre>
+
  
Finally, lets start up laptop_mode, then add it to our init.
 
 
<pre>
 
<pre>
/etc/init.d/laptop_mode start
+
# Sound card config
 +
# Codec: IDT 92HD73C1X5
  
rc-update add laptop_mode default
+
options snd-hda-intel model=dell-m6
 +
options snd-hda-intel enable_msi=1
 
</pre>
 
</pre>

Latest revision as of 06:42, 31 January 2012

Introduction

This tutorial describes how to configure an Intel HD Audio sound card. It explains the configuration at the kernel level and the changes you'll need to make to /etc/modprobe.d/alsa.conf.

Prerequisites

Before using this tutorial to configure your PC's sound card, make sure that the command lspci displays information similar to the following:

# lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)

In addition, the following packages must be installed. They are usually installed during the installation of the base system.

  • media-libs/alsa-lib
  • media-plugins/gst-plugins-alsa
  • media-sound/alsa-headers
  • media-sound/alsa-utils

The codec for the sound card used in this example is:

$ cat /proc/asound/card*/codec#0 | grep -i codec
Codec: IDT 92HD73C1X5

Kernel configuration

Note: The kernel configuration shown in this example is based on vanilla-sources-3.0.3, but the options are present in other versions of the kernel, including gentoo-sources and git-sources.

menuconfig

Shown here are the kernel options that need to be selected. Configure the options as modules (<M>) if permitted. Leave the other options as they are.

Device Drivers  --->
  <M> Sound card support  --->
    [*]   Preclaim OSS device numbers
    <M>   Advanced Linux Sound Architecture  --->
      <M>   Sequencer support
      <M>     Sequencer dummy client
      <M>   OSS Mixer API
      <M>   OSS PCM (digital audio) API
      [*]     OSS PCM (digital audio) API - Include plugin system
      [*]   OSS Sequencer API
      <M>   HR-timer backend support
      [*]     Use HR-timer as default sequencer timer
      -*-   Dynamic device file minor numbers
      [*]   Verbose procfs contents
      [*]   Generic sound devices  --->
         <M>   Virtual MIDI soundcard
      [*]   PCI sound devices  --->
         <M>   Intel HD Audio  --->
           [*]   Build Realtek HD-audio codec support
           [*]   Build Analog Device HD-audio codec support
           [*]   Build IDT/Sigmatel HD-audio codec support
           [*]   Build VIA HD-audio codec support
           [*]   Build HDMI/DisplayPort HD-audio codec support
           [*]   Build Conexant HD-audio codec support
           [*]   Build Creative CA0110-IBG codec support
           [*]   Build C-Media HD-audio codec support
           [*]   Build Silicon Labs 3054 HD-modem codec support
           [*]   Enable generic HD-audio codec parser
           [*]   Aggressive power-saving on HD-audio
           (20)    Default time-out for HD-audio power-save mode
      [*]   USB sound devices  --->
        <M>   USB Audio/MIDI driver
      [*]   FireWire sound devices  --->

/usr/src/linux/.config

The options required for the sound card can be selected by editing /usr/src/linux/.config as well:

CONFIG_SOUND=m
CONFIG_SOUND_OSS_CORE=y
CONFIG_SOUND_OSS_CORE_PRECLAIM=y
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
CONFIG_SND_HWDEP=m
CONFIG_SND_RAWMIDI=m
CONFIG_SND_SEQUENCER=m
CONFIG_SND_SEQ_DUMMY=m
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_HRTIMER=m
CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
CONFIG_SND_DYNAMIC_MINORS=y
# CONFIG_SND_SUPPORT_OLD_API is not set
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set
CONFIG_SND_VMASTER=y
CONFIG_SND_DMA_SGBUF=y
CONFIG_SND_RAWMIDI_SEQ=m
# CONFIG_SND_OPL3_LIB_SEQ is not set
# CONFIG_SND_OPL4_LIB_SEQ is not set
# CONFIG_SND_SBAWE_SEQ is not set
# CONFIG_SND_EMU10K1_SEQ is not set
CONFIG_SND_DRIVERS=y
# CONFIG_SND_PCSP is not set
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_ALOOP is not set
CONFIG_SND_VIRMIDI=m
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_MPU401 is not set
CONFIG_SND_PCI=y
# CONFIG_SND_AD1889 is not set
# CONFIG_SND_ALS300 is not set
# CONFIG_SND_ALS4000 is not set
# CONFIG_SND_ALI5451 is not set
# CONFIG_SND_ASIHPI is not set
# CONFIG_SND_ATIIXP is not set
# CONFIG_SND_ATIIXP_MODEM is not set
# CONFIG_SND_AU8810 is not set
# CONFIG_SND_AU8820 is not set
# CONFIG_SND_AU8830 is not set
# CONFIG_SND_AW2 is not set
# CONFIG_SND_AZT3328 is not set
# CONFIG_SND_BT87X is not set
# CONFIG_SND_CA0106 is not set
# CONFIG_SND_CMIPCI is not set
# CONFIG_SND_OXYGEN is not set
# CONFIG_SND_CS4281 is not set
# CONFIG_SND_CS46XX is not set
# CONFIG_SND_CS5530 is not set
# CONFIG_SND_CS5535AUDIO is not set
# CONFIG_SND_CTXFI is not set
# CONFIG_SND_DARLA20 is not set
# CONFIG_SND_GINA20 is not set
# CONFIG_SND_LAYLA20 is not set
# CONFIG_SND_DARLA24 is not set
# CONFIG_SND_GINA24 is not set
# CONFIG_SND_LAYLA24 is not set
# CONFIG_SND_MONA is not set
# CONFIG_SND_MIA is not set
# CONFIG_SND_ECHO3G is not set
# CONFIG_SND_INDIGO is not set
# CONFIG_SND_INDIGOIO is not set
# CONFIG_SND_INDIGODJ is not set
# CONFIG_SND_INDIGOIOX is not set
# CONFIG_SND_INDIGODJX is not set
# CONFIG_SND_EMU10K1 is not set
# CONFIG_SND_EMU10K1X is not set
# CONFIG_SND_ENS1370 is not set
# CONFIG_SND_ENS1371 is not set
# CONFIG_SND_ES1938 is not set
# CONFIG_SND_ES1968 is not set
# CONFIG_SND_FM801 is not set
CONFIG_SND_HDA_INTEL=m
# CONFIG_SND_HDA_HWDEP is not set
# CONFIG_SND_HDA_INPUT_BEEP is not set
# CONFIG_SND_HDA_INPUT_JACK is not set
# CONFIG_SND_HDA_PATCH_LOADER is not set
CONFIG_SND_HDA_CODEC_REALTEK=y
CONFIG_SND_HDA_CODEC_ANALOG=y
CONFIG_SND_HDA_CODEC_SIGMATEL=y
CONFIG_SND_HDA_CODEC_VIA=y
CONFIG_SND_HDA_CODEC_HDMI=y
# CONFIG_SND_HDA_CODEC_CIRRUS is not set
CONFIG_SND_HDA_CODEC_CONEXANT=y
CONFIG_SND_HDA_CODEC_CA0110=y
CONFIG_SND_HDA_CODEC_CMEDIA=y
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y
CONFIG_SND_HDA_POWER_SAVE=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=20
# CONFIG_SND_HDSP is not set
# CONFIG_SND_HDSPM is not set
# CONFIG_SND_ICE1712 is not set
# CONFIG_SND_ICE1724 is not set
# CONFIG_SND_INTEL8X0 is not set
# CONFIG_SND_INTEL8X0M is not set
# CONFIG_SND_KORG1212 is not set
# CONFIG_SND_LOLA is not set
# CONFIG_SND_LX6464ES is not set
# CONFIG_SND_MAESTRO3 is not set
# CONFIG_SND_MIXART is not set
# CONFIG_SND_NM256 is not set
# CONFIG_SND_PCXHR is not set
# CONFIG_SND_RIPTIDE is not set
# CONFIG_SND_RME32 is not set
# CONFIG_SND_RME96 is not set
# CONFIG_SND_RME9652 is not set
# CONFIG_SND_SONICVIBES is not set
# CONFIG_SND_TRIDENT is not set
# CONFIG_SND_VIA82XX is not set
# CONFIG_SND_VIA82XX_MODEM is not set
# CONFIG_SND_VIRTUOSO is not set
# CONFIG_SND_VX222 is not set
# CONFIG_SND_YMFPCI is not set
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=m
# CONFIG_SND_USB_UA101 is not set
# CONFIG_SND_USB_USX2Y is not set
# CONFIG_SND_USB_CAIAQ is not set
# CONFIG_SND_USB_US122L is not set
# CONFIG_SND_USB_6FIRE is not set
CONFIG_SND_FIREWIRE=y
# CONFIG_SND_FIREWIRE_SPEAKERS is not set
# CONFIG_SND_ISIGHT is not set
# CONFIG_SND_PCMCIA is not set
# CONFIG_SND_SOC is not set
# CONFIG_SOUND_PRIME is not set

/etc/modprobe.d/alsa.conf

Dell laptop

Note: The configuration shown here applies to a Dell Studio 1749 laptop. It might also be applicable to other Dell laptops.

If you plan on using external speakers or a headset, you need to edit /etc/modprobe.d/alsa.conf so that the integrated speakers are muted when you plug an external sound device in. Add the following lines to the end of the file:

# Sound card config
# Codec: IDT 92HD73C1X5

options snd-hda-intel model=dell-m6
options snd-hda-intel enable_msi=1