Difference between revisions of "Problem with broken sound on some ThinkPads"

From ThinkWiki
Jump to: navigation, search
(Updated explanation of the problem)
(Activating the devices)
 
(32 intermediate revisions by 9 users not shown)
Line 1: Line 1:
Information about the phenomena of broken sound on 600/E type ThinkPads.
+
Information about the phenomena of broken sound on some ThinkPad models.
  
==Problem description==
+
==Dual sound chip problem description==
 +
There are two sound chips in these machines, a PCI based [[CS4610|Crystal SoundFusion 4610]], and an ISA based [[CS4239|Crystal SoundFusion 4239]].
  
The following is not true with a Fedora Core Devel kernel 2.6.10-1.1109_FC4 (and probably other kernels) on IBM ThinkPad 600X machines. Just use the CS4610 drivers and sound will work fine. Trent Jarvi, tjarvi at qbang.org
+
The Linux drivers for the CS4610 (both OSS and ALSA) expect to find it paired with an AC'97 codec chip, while instead the CS4610 is paired with the ISA CS4239. This was done, because at the time this allowed DOS games to output sound using SoundBlaster Pro emulation.
  
First of all, be aware that 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.
+
To get sound under Linux you will have to use the OSS cs4232 or ALSA snd-cs4236 driver for the ISA soundchip instead.
  
Done that you might experience the phenomena that your sound goes into a loop after about a second just like a scratched record.
+
A good thread on the problem can be found in the [http://www.mail-archive.com/alsa-devel@lists.sourceforge.net/msg01181.html alsa-devel mailing list]
 +
 
 +
===Affected Models===
 +
*ThinkPad {{600E}}
 +
*ThinkPad {{770X}}, {{770Z}}
  
==Affected Models==
+
===Solutions===
*ThinkPad {{600}}, {{600E}}
+
====Activating the devices====
*ThinkPad {{770Z}}
+
{{Todo|This should no longer be necessary with any recent distribution, if anyone can validate, and if so remove this section}}
 +
First you must make sure that the sound devices are activated.
  
==Affected Operating Systems==
+
Disable "Quick Boot" in your ThinkPad BIOS, otherwise the sound devices will not be activated by the BIOS.
*Linux, all flavours
+
To enter the BIOS, press F1 before switching the ThinkPad on and until the first beep is heard.
  
==Status==
+
You can also manually activate the sound card once booted:
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 [http://www.intel.com/design/chipsets/audio/ AC'97-compatible] chip addressible through the PCI Cirrus logic chip to do these tasks.
+
* With apm and pnpbios, this is done with setpnp from the pcmcia package:
 +
:{{cmdroot|setpnp 0x0e on}}
 +
:{{cmdroot|setpnp 0x0f on}}
  
However, in the affected laptops there is no AC'97 chip.  Instead there is an older, 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 soundcard for codec duties, so closes finding no soundcards.  The current solution is to ignore this PCI chip and use sound though the legacy ISA chip only, either through the cs4236 or cs4232 driver.
+
* With acpi and pnpacpi, use these commands:
 +
:{{cmdroot|echo 'activate' > /sys/devices/pnp0/00:05/resources}}
 +
:{{cmdroot|echo 'activate' > /sys/devices/pnp0/00:06/resources}}
  
Alternatively, I have tried removing the dependency on the existence on a 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.
+
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".
  
A good thread on the problem can be found in the [http://www.mail-archive.com/alsa-devel@lists.sourceforge.net/msg01181.html alsa-devel mailing list]
+
This only works with newer kernels that fully support pnpacpi, and provided that [http://bugzilla.kernel.org/show_bug.cgi?id=3912 this patch] has been applied (applied to Linus' tree in july 2005).
  
Here's an older explanation of what happens:
+
It seems that the default dma numbers change when pnpacpi is used (to dma1=1 dma2=3, for instance).
  
The problem with the 600 series is that there is not one, not two, but THREE
+
If you're using acpi and pnpacpi, you can see which resources the sound card is using like this:
chips that look like sound cards to Linux. The actual Crystal chip is one of
+
:{{cmdroot|cat /sys/devices/pnp0/00:05/resources}}
them, the mwave is another, and the video chipset has a DSP that can be used
+
:{{cmdroot|cat /sys/devices/pnp0/00:06/resources}}
as sound circuitry if a designer opted to do so.
 
  
==Solutions==
+
====Using ALSA====
===Solution #1===
+
Compile the sound driver as a module and load it after everything else.
Compile the sound driver as module and load it after everything else. You can create a boot script with the following line for that:
+
You can add the following line to a boot script, ie. {{path|rc.local}} for that:
 
  /sbin/modprobe snd-cs4236 index=0 port=0x530 cport=0x538 irq=5 dma1=1 dma2=0 isapnp=0
 
  /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.
 
 
If the above line fails, quick boot is probably activated in the bios. In that case you need to manually activate the sound card:
 
*With apm and pnpbios, this is done with setpnp from the pcmcia package: {{cmdroot|setpnp 0x0e on&& setpnp 0x0f on}}
 
*With acpi and pnpacpi, the command is: {{cmdroot|echo 'activate' >/sys/devices/pnp0/00:05/resources && echo 'activate' >/sys/devices/pnp0/00:06/resources}}
 
  
This only works with a kernel that fully supports pnpacpi, and provided that [http://bugzilla.kernel.org/show_bug.cgi?id=3912 this patch] has been applied. It seems that the dma numbers change with pnpacpi (dma1=1, dma2=5 for instance).
+
This is reported to work at least with kernel 2.6.15.
  
===Solution #2===
+
On the 770x using kernel 2.6.16/2.6.17 you may try this:
Make sure that the bios quick boot feature is disabled. <br />
+
  /sbin/modprobe snd-cs4232 port=0x530 cport=0x120 irq=5 dma1=1 dma2=0 isapnp=0
Add the following lines to one of your init process files, i.e, {{path|rc.local}}:
 
  modprobe sound
 
insmod ad1848
 
insmod uart401
 
insmod cs4232 io=0x530 irq=5 dma=1 dma2=0
 
  
===Solution #3===
+
There is a [[Script for configuring the CS4239 sound chip in PnP mode|nice script]] which can do all this for you, including activation of the device and detecting the correct resource settings to use.
If your module loads like it should, but audio loops or sounds choppy then reloading module should help:
 
:{{cmdroot|rmmod cs4232 && modprobe cs4232}}
 

Latest revision as of 21:25, 9 August 2014

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

Dual sound chip problem description

There are two sound chips in these machines, a PCI based Crystal SoundFusion 4610, and an ISA based Crystal SoundFusion 4239.

The Linux drivers for the CS4610 (both OSS and ALSA) expect to find it paired with an AC'97 codec chip, while instead the CS4610 is paired with the ISA CS4239. This was done, because at the time this allowed DOS games to output sound using SoundBlaster Pro emulation.

To get sound under Linux you will have to use the OSS cs4232 or ALSA snd-cs4236 driver for the ISA soundchip instead.

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

Affected Models

Solutions

Activating the devices

TODO
This should no longer be necessary with any recent distribution, if anyone can validate, and if so remove this section

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, press F1 before switching the ThinkPad on and until the first beep is heard.

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.15.

On the 770x using kernel 2.6.16/2.6.17 you may try this:

/sbin/modprobe snd-cs4232 port=0x530 cport=0x120 irq=5 dma1=1 dma2=0 isapnp=0

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.