ebullient·works

[ About · Archive ]

Fixing Sound/Suspend-Resume on IBM T23 for Gentoo

ALSA does work, as I mentioned here, but it seems to have problems across a suspend-resume, i.e. it doesn’t work post-resume.

Previously used patches don’t seem to apply to newer Alsa modules.

Gentoo installs apmd_proxy in /etc/apm, with suspend.d and resume.d directories for handling special suspend/resume operations. Even better, event.d handles both.

So, based on some searching around, I ended up adding apmd to the list of services to start (rc-update add apmd default), and added the following script to get alsa to behave on resume:

/etc/apm/event.d/alsa:

#!/bin/sh
<br />
case "$1" in
resume)
    /usr/sbin/alsactl power off
    /usr/sbin/alsactl power on
    ;;
suspend|standby)
    ;;
esac 

Found this lovely snippet that answers why apm -s works better than Fn-F4 [emphasis added]:

The APM BIOS rejects suspend (or hibernate) requests under certain conditions: e.g., on my TP600, when my Xircom Ethernet/modem card is inserted and the machine is on AC power. If I do “apm —suspend” then the kernel apm driver hears about the request first and tells apmd which runs apmd_proxy which runs the scripts in /etc/apm/event.d which do things like eject the PCMCIA cards; only then does the apm driver pass the request on to the BIOS. (I think.) If I do “tpctl —suspend” on the other hand, the BIOS hears about the request first and, if the PCMCIA card is still inserted, it rejects the request with a couple of beeps (high—-low). apm —suspend” is therefore to be preferred to “tpctl —suspend”. Unfortunately there is no alternative to “tpctl —hibernate” : the apm program and the kernel apm driver don’t know how to ask for hibernation. Solution: write a little script that does “cardctl eject ; tpctl —hib”. Fn-F4 does the same as “tpctl —suspend” and Fn-F12 does the same as “tpctl —hibernate”.

The mention of the BIOS rejecting the suspend request when a PCMCIA card is inserted is exactly what I was seeing – I’m using my wireless card right now.

So after all that, I learned that I should suspend using apm -s and not with the thinkpad buttons if I have a pcmcia card active. With no PCMCIA card, the suspend request will be handled correctly by APM and apmd, and everything should be happy.

References:

  1. Why doesn’t my Thinkpad hibernate? | Linux-ThinkPad FAQ

Various records of Linux Installation attempts:

  1. How to set up an IBM Thinkpad T30 Debian GNU/Linux
  2. Debian GNU/Linux on an IBM Thinkpad T23
  3. Linux on A30p – Sound
  4. SuSE Linux 8.0 on IBM T30 Thinkpad
  5. Re: ThinkPad 600, kernel 2.2.17pre6, and hibernation
  6. APMD and Standby on the TP-T21
  7. artsshell permissions

Older Alsa drivers:

  1. Installing & Running Linux on an IBM T23 Laptop
  2. Patch to cards/card-intel8×0.c for suspend/resume

Information for Linux on IBM Laptops

  1. LinuxCareIBM T23 certification
  2. Linux on IBM Laptops
  3. Linux-ThinkPad FAQ

APM / Other tools

  1. The Linux APM Daemon
  2. deb2targz

Everywhere I looked, things would reference debian’s /etc/apm/event.d/alsa script. Thing is, I don’t run debian, and I’ll be damned if I could find the contents of the script anywhere…

For future reference, I’ve attached the source here.