Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


Finding and Installing Drivers

by Dave Phillips
05/17/2001

The specific CPU architecture addressed throughout this article is the Intel x86 series (and its competition from AMD and Cyrix). My apologies to interested readers running other Linux systems, and I would be happy to hear of your experience if you are running Linux sound drivers on systems such as LinuxPPC and 64-bit machines.

Finding the Right Driver

Drivers for many soundcards and audio chipsets are included with the regular Linux kernel sources. More cards and more features are supported by the driver packages from ALSA and 4Front (OSS/Linux). These three are the main sources of Linux soundcard drivers. A few other independently maintained drivers are listed on the Linux Music and Sound Applications site, and a very few manufacturers offer native Linux drivers of their own making.

If you're lucky your soundcard was detected automatically by your distribution's hardware probe, and if you're even luckier the distribution will install and configure the correct driver for you. In many cases, your card may be correctly identified, but the configuration routine may prompt you for more information, so be sure to keep the card's documentation handy.

The Kernel Modules

If you plan to use the kernel sound driver, read the documentation in /usr/src/linux/Documentation/sound, or run one of the kernel configuration scripts ('make [config|menuconfig|xconfig]') and study the selections and help files in the sound configuration section. Kernel developer Alan Cox sporadically maintains Linux Sound System, an information page that includes a listing of cards and chipsets supported by the kernel modules; unfortunately, it is out of date and does not include information for the sound system in kernels beyond the 2.2.x series. More information about using the kernel modules is occasionally available on the linux.dev.sound newsgroup.

 
Figure 1: Configuring the kernel sound system with xconfig  

Most modern Linux distributions include sound configuration utilities for managing the kernel sound modules. Red Hat's sndconfig is a typical sound system utility, detecting PnP (Plug and Play) and PCI cards or presenting a list of supported cards if no card is detected. The user acknowledges or makes the proper selection, sndconfig responds by prompting for any special information, the user completes the configuration, and the utility plays a short soundfile to verify a successful installation. Similar sound configuration tools are found in the SuSE and Mandrake distributions. Check your distribution's documentation for the name of your sound system configuration utility, then run it to see if your card or chipset is listed.

 
Figure 2: Red Hat's sndconfig detects my SB Live  

ALSA

The ALSA project maintains a well-organized soundcard matrix with listings by vendor, product name, and chipset. The recommended ALSA driver is also indicated. If your card is listed in the matrix, you may want to try the ALSA driver. The ALSA project has many virtues, including a very active community of users and developers. The drivers are free and open source, and a wide variety of cards and chipsets are supported. Drivers, libraries, and utilities must be compiled and installed locally (which may require root privileges). Installation and configuration can be tricky at times, although I had no problems with the recent drivers for my SBLive Value and my SB PCI128. As it nears the 1.0 release ALSA is a fast-moving target, but I must emphasize that the user community is very active and helpful. If you have trouble with your ALSA setup, someone on the users mailing list should be able to lend a helping hand.

OSS/Linux

4Front Technologies maintains a list of soundcards and chipsets supported by the company's commercially available OSS/Linux drivers. Check that list to see if your card is included; if it is, you can try OSS/Linux by downloading 4Front's limited-time demo package. The drivers are binary-only (sorry, no source code here); you install them by using 4Front's excellent soundconf utility, a straightforward text-based program that lets you easily install and uninstall the drivers, enable and disable card capabilities, and manage complex multiple card setups.

 
Figure 3: Selecting a soundcard with OSS/Linux soundconf  

Other Sources

Very few companies supply native Linux drivers for their soundcards, but the notable exception is Creative Labs. They have generously released the source code for their popular SBLive under the GPL, and development of a native driver has been steady and fruitful. Please see the Creative Open Source page for more information regarding the current availability and development status of the SBLive driver.

Aureal also ventured into the native Linux driver development world, supplying users with mixed binary/source drivers for their popular Vortex chipsets. Alas, Aureal no longer exists, though independent work on the drivers continues at the Linux Aureal Driver site on SourceForge.

The Zefiro ZA2 is a somewhat dated ISA digital audio card with some nice features, including the company's support for Linux driver developers. Peter Wahl has written a driver and control panel for the ZA2 available from his ZA2 Driver for Linux page. Peter has also written an alpha ZA2 driver for ALSA, but the current version is compatible only with the API for the ALSA 0.5.x release series.

What If ...

If your card is supported by one or another of the preceding sources, you should have little or no difficulty with the installation and configuration procedures. Things may become more difficult if your situation falls into one of these scenarios:

• You want to replace an existing card with a new one.

In this case, if you're lucky you can simply take out the old card, put in the new one, reboot and let your distribution's hardware probe detect the change in your system. However, your luck will depend on how well you do your initial homework, so check for Linux support before you purchase the new board (or any new hardware for a Linux system).

•You have a card you want to install, but you have no documentation for it.

This can usually be resolved by searching for a tech support section on the manufacturer's site. You may be able to order a new set of docs, or you might find an online manual. Failing either of those solutions, use Google or Deja search engines to find other people who own the same card and ask for assistance. Although it's unlikely to contain Linux-specific information, the card's documentation may contain everything you need to know in order to identify the correct Linux driver for your card. Many audio chipsets appear on a variety of differently named cards, and you should know the names of the audio chipset and the card itself. That information should be found in your card's documentation; if it isn't (or if you have no documentation), you must search the card for any product identification and to find what chipsets are used.

•You have a card installed but your present kernel has no sound support and you need to recompile it with the sound system enabled.

This scenario presents no real difficulty. Simply enable sound support during the kernel configuration and specify the correct driver module for your soundcard (if you want to use the kernel sound modules; make no selection if you intend to use the ALSA driver). Complete the kernel configuration and compiling process, reboot, then configure the sound system as needed.

•You can't get the performance you desire from the current driver and want to try another one.

The Linux Soundcard Driver

Introduction

Inside the Driver

The Future of Linux Audio Driver Support

This is potentially the trickiest scenario to manage. Each of the available driver packages maintains a different presence in your system startup and filesystem. If your existing driver is modular you can simply remove it from /lib/modules/linux-version/sound; however, if the driver is hardcoded into the kernel you will to recompile the kernel for modular sound support. You must have a kernel set up for modular sound if you want to use the ALSA drivers (just don't select any specific driver when configuring the kernel). The 4Front package installation routine can be directed to uninstall any kernel sound modules (but not ALSA modules) before installing OSS/Linux; a reboot is not required.

•You have a laptop/notebook, it has a soundchip, and you don't know much more than that.

Take a look at the Linux On Laptops and Sound Card Support for Linux with Laptops sites. Both indicate Linux sound support for specific laptops and chipsets; driver recommendations and configuration instructions can also be found on those pages. I was pleasantly surprised to see how many laptops and notebooks will work with Linux, but the surprise is mixed. Indeed, many laptops can be configured for Linux sound; unfortunately it can be a difficult and frustrating task. Nevertheless, Linux laptop sound support has seen great improvement in the last few years, and the recommended web sites keep up with the evolving status of Linux laptop and notebook audio support.

When All Else Fails...

If you've searched the documentation and databases for the kernel modules, ALSA, and OSS/Linux, then you've almost exhausted the possible sources for Linux audio drivers. A few other independently maintained drivers are listed on the Linux sound apps pages; failing all other possibilities, write to your soundcard's manufacturer, politely inquiring whether they have any plans for supporting Linux, or if they would be willing to provide Linux driver developers with the necessary specifications.

When all else fails, buy a different soundcard. Do some homework, research the resources I've already mentioned, then purchase a card known to work under Linux, with an easily available driver. You still might want to write to the manufacturer of your original card, adding (politely) that the lack of a Linux driver prompted your decision to purchase a different card.

Choosing a Driver

If you are planning for the simplest use of your sound hardware (CD audio, MP3 playback, streaming audio, etc.) and your card is supported, and you just don't want to work very hard at the system setup (or spend any money on it), you should try the driver modules supplied with the kernel. Most modern Linux distributions provide kernels prepared for dynamically adding and deleting precompiled modules. Some include autodetection routines that will automatically configure the sound system with the correct drivers at startup, while other distributions require root privileges to select, configure, and install the needed modules after the initial installation.

If your needs tend towards sophisticated desktop sound (high-end games, digital audio/video editing) or the professional side (multi-channel hard disk recording) you should consider either ALSA or OSS/Linux. Linux is slowly gathering support for digital audio cards suitable for professional audio applications. Specifications for these boards include multichannel digital record and playback, sampling rates exceeding 48 kHz, and advanced synchronization options. They are definitely not soundcards: they do not support an on-board synthesizer, MIDI I/O is not provided, and in some cases external ADC/DAC hardware is required. Linux-friendly professional-grade digital audio cards include the RME Hammerfall (and its relations) and the MIDIman Delta series; a driver for the Hammerfall is available from ALSA, drivers for the Delta cards are available from both ALSA and 4Front.

Boarding The Bus

If you look at the layout of your computer's motherboard you will notice connection traces running between the expansion card slots and the CPU. These connections form a path for data transfer between the CPU and your peripherals; that pathway is known as a bus. Buses come in different kinds and capabilities, and you may need to know something about your system's bus in order to match your soundcard with the correct driver.

ISA

Linux support for Industry Standard Interface (ISA) bus soundcards dates from Hannu Savolainen's original kernel driver (written in 1992) for the original 8-bit SoundBlaster. The ISA bus is not generally regarded as sufficiently fast enough for any but the most basic sound services, but if that's what you have then you'll be happy to note that the kernel modules, ALSA, and OSS/Linux all support soundcards made for the now outdated bus.

Plug and Play

Some Linux distributions detect so-called ISA "Plug and Play" (PnP) soundcards during the installation process. If yours did not, or if you're adding a PnP soundcard to your system, you must run the PnP tools pnpdump and isapnp to create and run a PnP configuration file for your soundcard (see the respective man pages for more information regarding the PnP utilities). PnP card detection may also be enabled in the kernel configuration, but the reader should be aware that some cards are more "Plug and Pray" than "Plug and Play", and that you may still need to run the PnP tools to correctly configure your card. Some PnP soundcards are supported by the kernel modules, but you'll find much wider support from the ALSA and OSS/Linux packages.

PCI

The Peripherals Component Interconnect (PCI) bus is considered fast enough for serious audio work, and PCI soundcards are currently the norm in modern desktop computers. PCI allows efficient two-way communication with the host CPU, so PCI soundcards are most easily probed and detected by the kernel and OSS/Linux setup utilities. As with the PnP cards, some PCI audio chipsets have driver modules included with the kernel sources, but again a much wider selection is available from ALSA and OSS/Linux. If you are compiling your own kernel you must be sure to enable PCI support in the section for IDE/ATA/ATAPI block devices.

USB

The Linux kernel configuration help for the USB support option offers this definition of the new bus:

The Universal Serial Bus (USB) is a specification for a serial bus subsystem which offers higher speeds and more features than the traditional PC serial port. The bus supplies power to peripherals and allows for hot swapping. Up to 127 USB peripherals can be connected to a single USB port in a tree structure. The USB port is the root of the tree, the peripherals are the leaves and the inner nodes are special USB devices called hubs.

Few audio devices have yet appeared for the USB interface, but at least one USB audio device (the Swissonic Studio D) is reported to work with a recent Linux kernel running on a Toshiba Satellite 2105CDS laptop. The Linux USB Project lists a variety of USB audio devices running under Linux, including digital speakers, a minidisc recorder (the Sony MZ-R70PC), and a 20-bit digital audio output device (the StereoLink 1200). USB audio is not included in the regular kernel sound configuration: you must configure the kernel for both general USB support and USB audio.

Miscellany: PCMCIA Cards And Serial Port MIDI

Yes, the Personal Computer Memory Card International Association (PCMCIA) has a bus. PCMCIA card slots are primarily found on laptop and notebook computers, but soundcard support is sparse under Linux. As of March 9 2001 David Hinds listed no soundcards in his list of "officially" supported PCMCIA cards. Werner Heuser's list of "unofficially" supported cards includes only five soundcards, and only one is verified as working (under the kernel modules, I assume). However, one exceptional PCMCIA audio card is available with an independently maintained Linux driver: the Communication Automation Corporation's Bullet3 is a rather remarkable card that includes a Texas Instrument TMS320C32 DSP and a Crystal Semiconductor CS4231A multimedia codec. A free and unsupported Linux driver is available from CAC's ftp site.

The Linux Soundcard Driver

Introduction

Inside the Driver

The Future of Linux Audio Driver Support

The standard RS232 serial port is found on most desktop computers, including most laptops. It is not generally regarded as an option for audio interfacing, but it has found some application as an alternative external MIDI port. The KEY MIDIator MS-124W MIDI interface is known to run with Linux: drivers are available from George Hansper's MIDI Axis, John Stone's MIDI on UNIX page, and Dave Topper's MIDIator hack page.

Other Considerations

The following table compares the major sound driver sources for cost, ease of installation and configuration, technical support, and availability of source code:

 

Cost:

Ease (0-5):

Support:

Sources available:

kernel:

free

4

no

yes

ALSA:

free

4.5

mail list

yes

OSS/Linux:

commercial

5

yes

no

Armed with the information you've gathered here you should be able to make a wise decision in your choice of sound card drivers. The next section deals with the more technical aspects of a Linux soundcard driver and some examples of applications programming code for the device driver.

Next: Inside the Driver

Copyright © 2009 O'Reilly Media, Inc.