[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Thinkpad 770X / woody sound now working - the solution



Hello,

I now have a solution to my audio woes, in no small way due to all those who
responded to my original email. To summarise, the problem was that the sound
was not working in any shape or form for my Thinkpad 770X running woody with
either kernel 2.2.20 or 2.4.18. In the spirit of putting something back,
here's what I have done to fix the problem (I talk about kernel 2.4.18-ac3,
PnP bus resources, and ALSA configuration amongst other things).

Note that this is a pragmatic solution. If you have any comments or pearls
of wisdom or answers to my questions at the end then I'm only too happy to
hear them.

Craig
======================================================

Kernel & PNP
------------
I was pointed to kernel 2.4.18-ac3 (thanks David). I downloaded, compiled,
and installed.

I then did a 'lspnp -v'. That was very interesting since it showed that the
PNP resources that interest me in this case relating to sound (id's 0e, 0f,
10, 11) were all disabled. Curious. I then enabled them one by one, i.e.

# setpnp 0e on
# setpnp 0f on
# setpnp 10 on
# setpnp 11 on

Interestingly and promisingly enough, once I had done this, and looked at
their bus-resources via 'lspnp -v' once more, each device had taken the
"right values" automatically, i.e. those values that are typically seen for
these devices, namely:

0e CSC0100 multimedia controller: audio
	io 0x0530-0x0537
	io 0x0388-0x038b
	io 0x0220-0x0233
	irq 5
	dma 1
	dma 0

0f CSC0110 multimedia controller: audio
	io 0x0538-0x053f

10 CSC0101 multimedia controller: audio
	io 0x0200-0x0207

11 CSC0103 multimedia controller: audio
	io 0x0330-0x0333
	irq 9

Unfortunately, for a reason unknown to me, on each reboot, these settings
are completely lost. To fix this I created /etc/init.d/rc.local and entered
the four setpnp commands above, and then:

# ln /etc/rcS.d/S99rc.local /etc/init.d/rc.local

In order to make sure that these values are set up correctly on reboot.

[Note: I am guessing that the kernel 2.4.18-ac3 is important because it
contains "PnP BIOS updates" (as of 2.4.18rc2-ac2)... ???]


Kernel cs4232.o module
----------------------
>From this point, making the sound work with the cs4232 module that I built
with the kernel was as simple as:

modprobe cs4232 io=0x530 irq=5 dma=1 dma2=0

I then updated /etc/modules.conf and everything worked.


ALSA sound
----------
I've never, ever, ever managed to get ALSA working with any version of Linux
but spurred on by these minor successes I decided to give it a go. I'm using
the alsa 0.9 versions in woody at the moment; if I remember correctly that's
0.9.0beta10.

The ALSA HOWTO has comprehensive details about how to set up
/etc/modules.conf. However, the *crucial point* for my setup, and not
mentioned in any documentation whatsoever that I've come across, is the need
to pass the snd_isapnp=0 parameter (there's a definite PnP thread here...)

Thus, my /etc/modutils/alsa:

//------------------------------------------------------------------
# ALSA portion
alias char-major-116 snd

# OSS/Free portion
alias char-major-14 soundcore

# ALSA
# [gid 29 = audio]
options snd snd_major=116 snd_cards_limit=1 snd_device_gid=29
snd_device_uid=0

# 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

# ALSA portion
alias snd-card-0 snd-card-cs4232

# OSS/Free portion
alias sound-slot-0 snd-card-0


#Alsa Settings for cs4232 chip
options snd-card-cs4232 snd_port=0x530 snd_cport=0x538 snd_fm_port=0x388
snd_irq=5 snd_dma1=1 snd_dma2=0 snd_mpu_port=0x330 snd_mpu_irq=9
snd_isapnp=0
//------------------------------------------------------------------

A quick 'update-modules', followed by
- unmuting and setting up the volume levels with alsamixer
- set-up of KDE sound server (Sound I/O in preferences -> "ALSA" and *not*
full-duplex)
- installation of alsa modules for KDE arts system
- installation of alsa output plugin for XMMS
and I had alsaplayer, KDE system messages, and xmms all working.

I then rebooted and ... nothing worked! No sound whatsover... KDE ran ok
just no sound ... alsaplayer tried to play but seemingly was stuck at the
beginning of the track ... ditto XMMS ...


ALSA initialisation & PCMCIA
----------------------------

... and yet, everything looked OK as far as I could tell from the various
settings. I mean, 'lspnp -v' was as expected, and all the alsa modules were
correctly loaded (lsmod). I did find however that if I did a
'/etc/init.d/alsa restart' then alsaplayer would work, followed by KDE once
aRts was restarted.

After much playing around, I have concluded that it is down to some
mysterious interaction with PCMCIA (I'm using 3.1.33). When I had my PCMCIA
card inserted (a wireless ethernet card) and rebooted the sound failed,
though when the card was not inserted at startup the sound would work. The
best solution I have found is to make sure that ** ALSA configuration occurs
after PCMCIA initialisation **.

My system starts up in run level 2, so to ensure that ALSA initialisation
occurs after PCMCIA initialisation, I simply did the following:

# mv /etc/rc2.d/S20alsa /etc/rc2.d/S21alsa

... which ensures that alsa is run after pcmcia (S20pcmcia).

Sound courteously works after reboots now without further persuasion.


Summary
--------
1. I still don't know why I've had to jump through these hoops to get audio
working on my system. I can only presume that there are many ThinkPad 770
users out there running sound on Linux happily. My solution is not pretty, I
don't have any deep understanding why I need to do it like that (I'm
listening...) but it works.
2. I'm curious to know why it is that sometimes "all the settings" seem
correct (IRQs, DMAs, I/O regions + driver modules) and yet the sound will
not work. In other words there must be something else that is not correctly
setup.... But what? and is there a way to tell (from the command line I
mean!)?
3. I can now do some real work.
4. ... and listen to music at the same time :-)




-----Original Message-----
From: Craig Morrison [mailto:craig.morrison@noos.fr]
Sent: 24 March 2002 18:48
To: Debian-Laptop
Subject: Thinkpad 770X / woody - sound not working


Hello,

I'm a recent convert to debian and since installing woody I've been unable
to make the sound work. I've trawled the internet, HOWTOs etc but so far to
no avail. I am therefore asking you for help.

Below I've explained the various steps I've gone through to try to make the
sound work to (a) avoid unnecessary questions, and (b) enable you to point
out any flaws in my logic.

Thanks in advance for any help/suggestions,

Craig

-----------------------------------------------------------------------

My configuration
----------------
ThinkPad 770X (Pentium II, 320 Mb RAM), dual boot with XP.
The sound card is the Crystal CS4232.

I've tried two kernels thus far:

2.2.20
 This is the kernel which was (net-)installed with woody (so I think a stock
debian kernel)

2.4.18
 "Hand-built" by myself, source from kernel.org, configured I believe to be
correctly e.g. OSS sound, the cs4232.o module.

I've been trying to make this work more on 2.4.18 as I need USB support.


Initial attempts to make the sound work
---------------------------------------
I've had sound working before, in my RedHat (6.2 - 7.2) days. It was as
simple as adding the following lines to /etc/modules.conf:

alias sound-slot-0 cs4232
options cs4232 io=0x530 irq=5 dma=1 dma2=0

I then tried building the latest ALSA drivers with 2.4.18 - that didn't work
either. Attempts to use the snd-card-cs4232 comes back with the same error
message as the cs4232 driver:

/lib/modules/2.4.18/kernel/drivers/sound/cs4232.o: init_module: No such
device
Hint: insmod errors can be caused by incorrect module parameters, including
invalid IO or IRQ parameters
/lib/modules/2.4.18/kernel/drivers/sound/cs4232.o: insmod
/lib/modules/2.4.18/kernel/drivers/sound/cs4232.o failed
/lib/modules/2.4.18/kernel/drivers/sound/cs4232.o: insmod cs4232 failed


Further attemps to make the sound work
--------------------------------------
Using the 'lspnp' command I started investigating the bus resource
assignments. To my surprise, I found that the sound card had different
settings than I was expecting (since I was expecting them to match those of
the 'options' statement above):

IO 0x530-0x537, ... (as expected) IRQ=11 DMA 03 DMA 00 (not as expected)

OK, I thought, the bus resources are differences, so I just have to change
the parameters to the cs4232 module, i.e. modprobe cs4232 io=0x530, irq=11,
dma=3, dma2=0. That didn't work.

Then I thought that maybe it will only work if the sound card is using IRQ 5
etc. So I did:

# setpnp 0e irq 5 dma 1 dma 0
# modprobe cs4232 io=0x530 irq=5 dma=1 dma2=0

That didn't work either. (Checking lspnp I was careful to ensure that
nothing else was using the same IRQ or DMA channels.)

That's where I am now.


Other information
-----------------
1. Windows98 / Windows XP

The one major difference that I see between now and when the sound was
working with RedHat is that then I was dual-booting with Windows 98.
Curiously enough Windows 98 wouldn't let me have the modem and infrared
ports enabled at the same time though XP will. I mention that because I
don't know if XP is having an effect her, whether it is persisting resource
assignments that somehow affect Linux. Is this relevant?

In XP, the audio is being assigned IRQ 11, dma 3, dma 0. The modem is
assigned IRQ 3. The infrared port is assigned IRQ 5.

2. setpnp

Interestingly enough the setpnp changes have persisted across reboots which
surprises me as I didn't do a 'setpnp -b'. Is there anyway to "undo" such
changes?

3. Here's the result of 'lspnp -v'. Seems odd that some of the audio related
settings seem disabled (devices 11 & 12). Is this problem?

Here's the output of lspnp.

00 PNP0000 AT programmable interrupt controller
	io 0x0020-0x0021
	io 0x00a0-0x00a1
	irq 2

01 PNP0200 AT DMA controller
	io 0x0000-0x000f
	io 0x0080-0x008f
	io 0x00c0-0x00df
	dma 4

02 PNP0100 AT system timer
	irq 0
	io 0x0040-0x0043

03 PNP0b00 AT real-time clock
	irq 8
	io 0x0070-0x0073

04 PNP0800 AT-style speaker sound
	io 0x0061-0x0061

05 PNP0303 IBM enhanced keyboard (101/102-key, PS/2 mouse support)
	irq 1
	io 0x0060-0x0060
	io 0x0064-0x0064

06 IBM3780 PS/2 TrackPoint
	irq 12

07 PNP0c04 Math coprocessor
	io 0x00f0-0x00ff
	irq 13

08 PNP0700 PC standard floppy disk controller
	irq 6
	io 0x03f0-0x03f5
	dma 2

09 PNP0a03 PCI bus
	io 0x0cf8-0x0cff

0a PNP0c02 Motherboard resources
	io 0x0022-0x0022
	io 0x002e-0x002f
	io 0x0092-0x0092
	io 0x00b2-0x00b3
	io 0x04d0-0x04d1
	io 0x15e0-0x15ef
	io 0xef00-0xefaf
	mem 0x00000000-0x0009ffff
	mem 0x000f0000-0x000fffff
	mem 0x00100000-0x13ffffff
	mem 0xffff0000-0xffffffff

0b PNP0400 Standard LPT printer port
	irq 7
	io 0x03bc-0x03bf

0d PNP0501 16550A-compatible COM port
	irq disabled
	io disabled

0e CSC0100 multimedia controller: audio
	io 0x0530-0x0537
	io 0x0388-0x038b
	io 0x0220-0x0233
	irq 5
	dma 1
	dma 0

0f CSC0110 multimedia controller: audio
	io 0x0538-0x053f

10 CSC0101 multimedia controller: audio
	io 0x0200-0x0207

11 CSC0103 multimedia controller: audio
	io disabled
	irq disabled

12 IBM3765 multimedia controller: audio
	io 0x0130-0x013f
	io disabled
	irq disabled
	irq 10
	dma 7

13 IBM0071 IBM Thinkpad infrared port
	irq disabled
	io disabled
	dma disabled

14 PNP0e03 Intel 82365-compatible CardBus controller
	io 0x0000-0x0001

17 PNP0680 Standard bus mastering IDE hard disk controller
	irq 14
	io 0x01f0-0x01f7
	io 0x03f6-0x03f7
	io 0xfcf0-0xfcf7

19 PNP0680 Standard bus mastering IDE hard disk controller
	irq 15
	io 0x0170-0x0177
	io 0x0376-0x0376
	io 0xfcf8-0xfcff

1b PNP0c02 Motherboard resources
	io 0x2100-0x217f
	io 0x2180-0x21ff
	mem disabled



--
To UNSUBSCRIBE, email to debian-laptop-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org





-- 
To UNSUBSCRIBE, email to debian-laptop-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: