[Q] TP 560E Sound in OpenLinux 2.2

Rob Mayoff linux-thinkpad@www.bm-soft.com
Tue, 13 Jul 1999 22:27:26 -0500 (CDT)


| When I compiled sound into the kernel not as module the sound works
| but apm related stuff does not work correctly, for example after resume from
| suspended state the sound works like echo. The problem I want to solve
| is how to load sound module properly ? I'm using Kernel 2.2.5.
| When I load sound using 'modprobe sb' then it says "device or resource
| busy". Are there any way to avoid this ?

Try to unload the sound drivers and reload them.  That might help.  I
get the same problem on my 770Z.

If you install apmd version 3.0beta8, you can automatically run a script
when you suspend and resume. You can have the script unload the sound
drivers on suspend, and reload them on resume. My script is appended. It
does several things to try to ensure an orderly suspend/resume:

- "eject" the PCMCIA cards, because my wireless ethernet card doesn't
resume properly otherwise

- kill any processes that are using audio, and then unload the sound
drivers.  You can't unload the drivers if any process has a sound device
open.

- switch to virtual screen #1 if the lid is closed, because the 770Z
(and 770X) doesn't resume properly if you just close the lid. This
workaround only works if there are no PC Cards active, because if there
are any PC Cards active, closing the lid doesn't send a suspend signal.
I never purposely try to suspend by closing the lid, but sometimes it
happens accidentally.

Anyway, here's my script.  You'll probably have to change the first line
if you want to use it, because you might not have ksh installed.

/*--------------------------------------------------------------------*/
#!/bin/ksh

logger "apmd_proxy: $*"

case "$*" in

	suspend*)
		cardctl eject & # may take a moment
		lsof -t /dev/{audio,dsp,midi,mixer,music,sequencer,sndstat} | xargs kill
		sleep 1
		rmmod -s cs4232
		rmmod -s ad1848 uart401
		rmmod -s sound
		rmmod -s soundcore
		wait # for cardctl
		lid="$(/usr/local/bin/tpctl --is | grep Lid)"
		case "$lid" in
			*Y)
				# Lid is closed - possibly unsafe to resume if X is running.
				# Try to dodge the problem.
				chvt 1
				;;
		esac
		;;

	resume*)
		cardctl insert
		modprobe sound
		;;

esac

exit 0