Comment 33 for bug 100114

Revision history for this message
TJ (tj) wrote :

Nice work-around Willem!

I've enhanced your script to make it more modular. Users can install this script and not have to check and set the PCI device ID as the script will figure it out.

#!/bin/bash
# this file is /etc/acpi/resume.d/66-snd-hda-intel.sh
# workaround for HDA resume bug on 2.6.20 (fixed in .22)
# see https://bugs.launchpad.net/ubuntu/+bug/100114
# this requires xserver-xorg-core to be installed, which is usually the case

DEVICEPATH="`ls -d /sys/module/snd_hda_intel/drivers/pci\:HDA\ Intel/0*`"
if [ "x$DEVICEPATH" != "x" ]; then
 # extract PCI device ID from path
 PCI=`expr match "$DEVICEPATH" '.*\/[0-9]\+:\(.*$\)'`
 # replace dot with colon
 PCI=`echo $PCI | tr "." ":"`
 # read the register
 TCSEL=`pcitweak -r $PCI 0x44`
 echo "TCSEL=$TCSEL"
 # test TCSEL against required value
 if [ "$TCSEL" != "0x00000000" ]; then
  echo "HDA TCSEL register needs correcting"
  pcitweak -w $PCI 0x44 0
 else
  echo "HDA TCSEL register okay"
 fi
fi