Linux Laptop Sound Configurationby Dave Phillips
Configuring sound for laptops running Linux can be a very tricky process. Drivers may be difficult to find or install, reference materials may be incomplete or misleading, and even after careful configuration, your system may still emit no more than the beep from its internal speaker. In other words, setting up sound on a Linux laptop can quickly become an unwanted exercise in patience and frustration.
The following article describes my experiences installing and configuring a sound system for an HP Omnibook 4150. I used the standard-issue kernel modules (OSS/Free), the commercial OSS/Linux package, and the ALSA drivers. I must stress that there is no typical configuration for sound on Linux laptops, and you must be prepared to do some research to find the necessary information about your machine's particular audio chipset and its capabilities.
I purchased my Omnibook from an online vendor. It arrived safely with a 366 MHz PII, a 6 GB hard disk, 96 MB of memory, and no operating system. I installed a Debian 2.2 stable system with a 2.2.19 kernel, and then I immediately began configuring my new machine for sound.
The potential for confusion existed at the very start of my adventure. At least two very different versions of the 4150 exist: apparently standard Windows got one version while NT got the other. Fortunately, the Omnibooks are well-documented by Hewlett-Packard, and some adventurous Linux users have placed valuable setup material online, so I had no trouble getting technical and other details for this machine. Be advised: if you are considering a laptop for audio use under Linux, I urge you to first visit the Linux On Laptops site, and then read the Linux Laptop HOWTO. These pages contain information about almost every aspect of whatever machine you are considering, including audio and video capabilities. Google is also an excellent resource for finding manufacturer's documentation, and Google's Deja newsgroup searches can discover more user-mode information.
HP Omnibooks with "4150" after their serial numbers (like mine) contain a NeoMagic NM2200 multimedia chipset (aka NM256 A/V), the sound side of which seems to be a combination of the Analog Devices AD1848, the Crystal Semiconductor CS4232, and/or the Yamaha OPL3SA2 audio chipsets. Omnibooks that have "4150 B" after their serial numbers utilize the ESS Maestro audio chipset. The ESS Maestro has its own set of difficulties, and the information presented here does not apply to the 4150 B.
The reference guide states that the 4150 provides support for 16-bit stereo sound capability equivalent to the SoundBlaster Pro soundcard. It also mentions "3D-enhanced PCI bus audio," but I was unable to verify its availability in current Linux sound drivers (nor was I able to learn exactly what "3D-enhanced PCI bus audio" means). (Note: As this article went to press, I learned that the 3D enhancement is a feature of the OPL3SA2 chipset, but I did not have time to investigate its significance.)
The 4150 comes equipped with an internal microphone, a pair of internal speakers, and jacks for audio line out/headphone out, external microphone in, and audio line in. The output jack is stereo-only, and the manual clearly states that using a mono plug can damage the channel hardware. This is true for many laptop audio input/output jacks, so take care to use the proper connectors.
The sound quality of the Omnibook's internal speaker system is adequate in a quiet environment, but at peak volume their output is not strong. Happily, even inexpensive headphones sound good, and when the line out is run to external speakers, the sound quality is at least as good as the audio output from the original SoundBlaster Pro. The internal microphone works well and is fairly sensitive, but its limited frequency response restricts its utility primarily to relatively low-quality speech input. My machine also has a physical volume control manipulated by the Fn key and the up/down arrow keys (I like this feature a lot).
Using The Kernel Modules (OSS/Free)
Following the advice of other 4150 owners, I first set up the OSS/Free sound modules built from the 2.2.19 kernel sources. I configured the audio system by adding these lines to /etc/modules.conf:
alias sound-slot-0 ad1848 options sound dmabuf=1 alias synth0 opl3 options opl3 io=0x388 options ad1848 io=0x530 irq=5 dma=1 dma2=0
This configuration gave me PCM and CD audio, along with the well-known OPL3 FM synthesizer.
Incidentally, I verified these values by looking at the 4150's BIOS before loading Linux. Pressing the F2 function key during boot-up took me to the BIOS settings, where I found a helpful report on the on-board audio chipset, including its on/off status, port addresses, and IRQ values. In the absence of other documentation, your machine's BIOS may be able to provide information critical to setting up audio, video, communications, and other devices, so watch the screen carefully during the initial boot sequence for instructions on accessing the machine's BIOS. Typically, you'll press the Delete key or one of the function keys (F1-F12), but your access procedure may vary.
If for some reason you cannot access your machine's BIOS, or if it does not provide a summary of its audio chipset, you can still use the
lspci command to at least determine the type of chipset used. For instance, on my machine running
lspci returns this information about my the internal audio device:
01:00.1 Multimedia audio controller: Neomagic Corporation [MagicMedia 256AV] (rev 20)
Talk about confusing ... I asked ALSA developer Takashi Iwai about this variance in perceived identity. He said that the chipsets are siblings and described their relationship in this manner:
AD1848 --> CS4231 --> CS4232 --> CS4236 | +--------> OPL3SA2
Apparently many chipsets integrate the CS423x chips (as does the NM256AV), so the lesson learned here is that an audio chipset may be a sort of "amalgamated" device, and you may need to try a variety of drivers to find the one that works best for your machine.
Anyway, now I could record and play back full-duplex audio, and I could access the FM synth via MIDI players such as
playmidi and TiMidity++. All in all, I was satisified with the default audio system for this machine running kernel 2.2.19.
Alas, the kernel sound modules will not resume operation after putting the machine into suspension (
apm suspend). Furthermore, I upgraded the kernel to 2.4.18 and discovered that my configuration for the 2.2 kernel no longer worked. So, on to the next stage ...