Search:  
Gentoo Wiki

HOWTO_nForce2_hw_mixing

This page is a candidate for deletion 
Reason given: The nforce-driver package described has been removed from portage
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.
This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

This HOWTO is based on the following thread from Gentoo Forums, started by -=GGW=- $ol!d $n4>|e. This article is devoted to all people with nvidia's SoundStorm integrated on motherboard and willing to obtain hardware sound mixing with ALSA.

Comment:

This HOWTO is not correct. The nvidia kernel module is for the Open Sound System and not alsa related. So skip the parts where alsa gets configured. Read at the bottom of this page what needs to be done or check the Release notes.

It's now even more incorrect because portage no longer contains the nforce-audio ebuild; so you can't do it `the gentoo way' anymore :(

Preparing Kernel 2.6

First we have to change directory to /usr/src/linux and make menuconfig in order to configure our kernel

# cd /usr/src/linux
# make menuconfig 

You need to have these things checked as built in, not modular.

Linux Kernel Configuration: Kernel Configuration
Device Drivers --->
   Sound --->
      <*> Sound card support
      Advanced Linux Sound Architecture --->
         <*> Advanced Linux Sound Architecture
         <*> Sequencer support
         <*> OSS Mixer API
         <*> OSS PCM (digital audio) API
         PCI devices --->
            <*> Intel/SiS/nVidia/AMD/ALi AC97 Controller
      Open Sound System --->
         <*> Open Sound System (DEPRECATED)
         <*> VIA 82C686 Audio Codec


In other kernel versions The VIA 82C686 entry can be found here:

Linux Kernel Configuration: Kernel Configuration
 <*> Open Sound System (DEPRECATED)
    [*]   Obsolete OSS drivers
    [*]   VIA 82C686 Audio Codec


Assuming there have been changes in your kernel's configuration you will have to recompile it and install, otherwise you can pass to the next paragraph

# make && make modules_install
# cp arch/i386/boot/bzImage /boot/kernel-2.6
# cp System.map /boot/System.map-2.6
# cp .config /boot/config-2.6 

After that you need to reload your kernel which simply means rebooting

# reboot

Configuring ALSA

nforce-audio has been deprecated. You will want to use the intel8x0 driver. Set AlSA_CARDS in /etc/make.conf

# ALSA_CARDS="intel8x0"

Now you can emerge alsa-driver

# emerge alsa-driver

If alsa-driver fails, use the masked version

# echo "media-sound/alsa-driver" >> /etc/portage/package.keywords
# emerge alsa-driver alsa-utils

Now just start alsa

# /etc/init.d/alsasound start

If it starts fine, add it to the boot runlevel

# rc-update add alsasound boot

For more information on alsa, read ALSA/Install

System configuration

Configure /etc/modprobe.d/alsa

File: /etc/modprobe.d/alsa
 
  # ALSA portion
  alias char-major-116 snd
  alias snd-card-0 snd-intel8x0
  # OSS/Free portion
  alias char-major-14 soundcore
  alias sound-slot-0 snd-card-0 snd-intel8x0
  
  # OSS/Free portion - card #1
  alias sound-service-0-0 snd-mixer-oss
  alias sound-service-0-1 snd-seq-oss
  alias sound-service-0-3 snd-pcm-oss
  alias sound-service-0-8 snd-seq-oss
  alias sound-service-0-12 snd-pcm-oss
  
  alias /dev/mixer snd-mixer-oss
  alias /dev/dsp snd-pcm-oss
  alias /dev/midi snd-seq-oss
  
  options snd cards_limit=1
  

To be safe, check to make sure /etc/devfsd.conf is set up properly

File: /etc/devfsd.conf
# ALSA/OSS stuff
# Comment/change these if you want to change the permissions on
# the audio devices
LOOKUP snd MODLOAD ACTION snd
LOOKUP dsp MODLOAD
LOOKUP mixer MODLOAD
LOOKUP midi MODLOAD
REGISTER sound/.* PERMISSIONS root.audio 660
REGISTER snd/.* PERMISSIONS root.audio 660

in order to have nvsound loaded at boot add nvsound into your /etc/modules.autoload.d/kernel-2.6

echo "nvsound" >> /etc/modules.autoload.d/kernel-2.6
Note: Since nvsound takes care of hw mixing there is no need to set up a /.asoundrc config file for dmixing. Infact, setting one up will break the built in hwmixing and cause conflicts with some programs.

ALSA/OSS mixers

In order to be able to save and restore your alsa mixer level you have to:

# emerge alsa-utils
# emerge alsa-oss

Now since the original /etc/init.d/alsasound will attempt to load modules that are all ready taken car of nvidia and will spit out long annoying ugly looking warning and erros at you when you boot up, we use a modified version of the script.

File: /etc/init.d/alsasound
#!/sbin/runscript
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsasound,v 1.23 2005/04/21 09:07:45 eradicator Exp $

alsactl=/usr/sbin/alsactl
asoundcfg=/etc/asound.state

opts="${opts} save"

depend() {
need bootmisc localmount
after modules isapnp coldplug hotplug
}

restore_mixer() {
ebegin "Restoring Mixer Levels"

local val=0

if [[ ! -r ${asoundcfg} ]] ; then
ewarn "No mixer config in ${asoundcfg}, you have to unmute your card!"
elif [[ -x ${alsactl} ]] ; then
local CARDS="$(awk '/: / { print $1 }' /proc/asound/cards)"
local CARDNUM
for CARDNUM in ${CARDS}
do
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
${alsactl} -f ${asoundcfg} restore ${CARDNUM}
((val=val+$?))
done
else
eerror -e "ERROR: Cannot find alsactl, did you forget to install media-sound/alsa-utils?"
val=1
fi

eend ${val}
return ${val}
}

save() {
ebegin "Storing ALSA Mixer Levels"

local val=0

if [[ -x ${alsactl} ]] ; then
${alsactl} -f ${asoundcfg} store
val=$?
else
eerror -e "ERROR: Cannot find alsactl."
val=1
fi

eend ${val}
return ${val}
}

start() {
restore_mixer
}

stop() {
save
}

Use your favorite text editor to make that and save it as root in /etc/init.d/ as alsarestore (or whatever you want it to be called). For the purpose of this guide I will assume you named it alsarestore.

In order to make the boot script executable, as root do

# chmod +x /etc/init.d/alsarestore

Now we add the script to the boot run level

# rc-update add alsarestore boot

Next you have to unmute your channels.

# amixer set Master 100% unmute
# amixer set PCM 100% unmute

Activate the script so that it will store the sound state

# /etc/init.d/alsarestore start

Just to be safe

# alsactl store

Known problems

  • Hardware mixing works only with OSS, ALSA using programs will not work with this solution as well as the ALSA driver (intel-8x0). ALSA also only supports Software mixing. If you need ALSA/JACK/OSS support at the same time - install ALSA - run JACK - tell asound.conf to put ALSA through JACK and install OSS2JACK.
  • Although this may seem not related to sound, people with nForce2 motherboards in order to get USB keyboard/mouse properly working should check in kernel configuration OHCI HCD Support instead of UHCI HCD (most Intel and VIA) support
  • As well as that if you use nForce2 LAN Controler you should check Reverse Engineered nForce Ethernet support (EXPERIMENTAL)


This guide is all wrong

The new nvsound module is OSS only and supports hardware-mixing. You don't need any of the alsa stuff in the kernel. You just need to enable "Open Sound System" in the linux-kernel. Then emerge nforce-audio and load the nvsound module. Use nvmixer to set up your speaker options. To store the settings and get them loaded after a reboot, add the following to "/etc/conf.d/local.start"

/usr/bin/nvmix-reg -f /etc/nvmixrc -L >/dev/null 1>&2

and to "/etc/conf.d/local.stop"

/usr/bin/nvmix-reg -f /etc/nvmixrc -S >/dev/null 2>&1

You don't need to start alsa at boot. (do 'rc-update del alsasound')

ALSA replaces OSS

Alsa replaces the older oss, plus it's more featured and will become better supported.

Retrieved from "http://www.gentoo-wiki.info/HOWTO_nForce2_hw_mixing"

Last modified: Tue, 26 Aug 2008 21:16:00 +0000 Hits: 20,126