Problem with broken sound on some ThinkPads

From ThinkWiki
Revision as of 17:17, 15 February 2006 by Tonko (Talk | contribs) (do NOT link to unrelated models, it causes linkbacks from those model pages, and causes confusion)
Jump to: navigation, search

Information about the phenomena of broken sound on some ThinkPad models.

Problem description

Even though the sound chip is a Crystal SoundFusion 4610, you'll have to use the cs4236 driver to enable sound on this machine, since this driver supports the CS4239 emulation that the 4610 chip offers.

Affected Models

Status

The PCI chip that you see in lspci (in my 770x case 4610) is the DSP half of the soundcard. You also need a codec to do conversion between digital and analog, audio routing, etc. The CS46xx driver expects to find an AC'97-compatible chip addressible through the PCI Cirrus logic chip to do these tasks.

However, in the affected laptops there is no AC'97 chip. Instead the sound chip has an integrated ISA-based soundcard to do these tasks as well as providing legacy app support. The cs46xx driver cannot find the AC'97 chip, nor can it support the ISA part for codec duties, so it dies with an error. The current solution is to ignore the PCI part entirely and use sound though the legacy ISA part only, either through the ALSA snd-cs4236 or OSS cs4232 driver.

Alternatively, I have tried removing the dependency on the existence of an AC'97 codec in the cs46xx driver, theory being that it may be possible to use the cs4236 driver for the mixing functions. This resulted in the driver loading and detecting all the resources of the cs4610, however interrupt issues seemed to be preventing it from outputting sound.

A good thread on the problem can be found in the alsa-devel mailing list

Here's some more information about sound hardware in the 600 series: The 600 series has not one, not two, but THREE chips that look like sound cards to Linux. The actual Crystal chip is one of them, the mwave is another, and the video chipset has a DSP that can be used as sound circuitry if a designer opted to do so.

Solutions

Activating the devices

First you must make sure that the sound devices are activated.

Disable "Quick Boot" in your ThinkPad BIOS, otherwise the sound devices will not be activated by the BIOS. To enter the BIOS, power cycle your ThinkPad and press F1 when the ThinkPad screen shows.

You can also manually activate the sound card once booted:

  • With apm and pnpbios, this is done with setpnp from the pcmcia package:
 # setpnp 0x0e on
 # setpnp 0x0f on
  • With acpi and pnpacpi, use these commands:
 # echo 'activate' > /sys/devices/pnp0/00:05/resources
 # echo 'activate' > /sys/devices/pnp0/00:06/resources

It seems that with very new kernels and ACPI enabled, you will need to manually enable the device even if you have correctly disabled "Quick Boot".

This only works with newer kernels that fully support pnpacpi, and provided that this patch has been applied (applied to Linus' tree in july 2005).

It seems that the default dma numbers change when pnpacpi is used (to dma1=1 dma2=3, for instance).

If you're using acpi and pnpacpi, you can see which resources the sound card is using like this:

 # cat /sys/devices/pnp0/00:05/resources
 # cat /sys/devices/pnp0/00:06/resources

Using ALSA

Compile the sound driver as a module and load it after everything else. You can add the following line to a boot script, ie. rc.local for that:

/sbin/modprobe snd-cs4236 index=0 port=0x530 cport=0x538 irq=5 dma1=1 dma2=0 isapnp=0

This is reported to work at least with kernel 2.6.9, 2.6.13 and 2.6.15.

There is a nice script which can do all this for you, including activation of the device and detecting the correct resource settings to use.

Using OSS

Add the following line to a boot script, ie. rc.local:

modprobe sound
insmod ad1848
insmod uart401
insmod cs4232 io=0x530 irq=5 dma=1 dma2=0

In case an insmod or modprobe of cs4232 fails with the following error appearing at the console, via dmesg, or in /var/log/messages, double-check you have quick boot disabled!

modprobe: FATAL: Error inserting cs4232: No such device

Audio loops

If your OSS module loads like it should, but audio loops or sounds choppy then reloading the module should help: # rmmod cs4232 && modprobe cs4232

(For the modprobe command to work without IRQ/IO/DMA parameters, you'll probably want to add the correct parameters as an "options" clause in /etc/modprobe.conf).