Difference between revisions of "Script for configuring the CS4239 sound chip in PnP mode"

From ThinkWiki
Jump to: navigation, search
m (CS4239 in PnP mode moved to Script for configuring the CS4239 sound chip in PnP mode)
Line 1: Line 1:
To configure the [[CS4239]] sound chip via PnP, use the following script (Tested on a Thinkpad {{600E}}). It is meant to be used as <tt>install</tt> script with modprobe. An example modprobe.conf snippet follows.
+
To configure the [[CS4239]] sound chip via PnP, use the following script{{footnote|1}} (Tested on a ThinkPad {{600E}}). It is meant to be used as <tt>install</tt> script with <tt>modprobe</tt>. An example {{path|modprobe.conf}} snippet follows.
  
Save this script as <tt>/usr/local/sbin/soundcard-on</tt>
+
Save this script as {{path|/usr/local/sbin/soundcard-on}}.
  
 +
===The Script===
 
  #!/bin/bash
 
  #!/bin/bash
 
   
 
   
Line 57: Line 58:
 
  modprobe --ignore-install snd-cs4236 port=$port cport=$cport fm_port=$oplport irq=$irq dma1=$dma1 dma2=$dma2 isapnp=0 index=0 && /lib/alsa/modprobe-post-install snd-cs4236
 
  modprobe --ignore-install snd-cs4236 port=$port cport=$cport fm_port=$oplport irq=$irq dma1=$dma1 dma2=$dma2 isapnp=0 index=0 && /lib/alsa/modprobe-post-install snd-cs4236
  
Use these lines in <tt>modprobe.conf</tt> or <tt>/etc/modprobe.d/cs4236pnp</tt>:
+
===modprobe Configuration===
 
+
Add these lines to {{path|/etc/modprobe.conf}} or {{path|/etc/modprobe.d/cs4236pnp}}:
 
  # Kill any attempts from hotplug or discover to load the PCI driver
 
  # Kill any attempts from hotplug or discover to load the PCI driver
 
  install snd-cs46xx /bin/true
 
  install snd-cs46xx /bin/true
Line 64: Line 65:
 
  install snd-cs4236 /usr/local/bin/soundcard-on
 
  install snd-cs4236 /usr/local/bin/soundcard-on
  
--[[User:Mkarcher|Mkarcher]] 23:20, 22 January 2006 (CET)
+
 
 +
{{footnotes|
 +
#provided by [[User:Mkarcher|Mkarcher]] 23:20, 22 January 2006 (CET)
 +
}}
 +
 
 +
 
 
[[Category:Scripts]]
 
[[Category:Scripts]]

Revision as of 01:10, 23 January 2006

To configure the CS4239 sound chip via PnP, use the following script1 (Tested on a ThinkPad 600E). It is meant to be used as install script with modprobe. An example modprobe.conf snippet follows.

Save this script as /usr/local/sbin/soundcard-on.

The Script

#!/bin/bash

# Sound-via-pnp-script for Thinkpad 600E and possibly other computers with onboard
# CS4239/CS4610 that to not work with the PCI driver and are not recognized by the
# PnP code of snd-cs4236

# search sound card pnp device

for dev in /sys/bus/pnp/devices/*
do
  grep CSC0100 $dev/id > /dev/null && WSSDEV=$dev
  grep CSC0110 $dev/id > /dev/null && CTLDEV=$dev
done

# activate devices (Thinkpad boots with devices disabled unless "fast boot" is turned off)

echo activate > $WSSDEV/resources
echo activate > $CTLDEV/resources

# parse resource settings

{ read
 read bla port1
 read bla port2
 read bla port3
 read bla irq
 read bla dma1
 read bla dma2
 # Hack: with PnPBIOS: ports are: port1: WSS, port2: OPL, port3: sb (unneeded)
 #       with ACPI-PnP:ports are: port1: OPL, port2: sb, port3: WSS
 # (ACPI bios seems to be wrong here, the PnP-card-code in snd-cs4236.c uses the
 #  PnPBIOS port order)
 # Detect port order using the fixed OPL port as reference
 if [ ${port2%%-*} = 0x388 ]
 then
   # PnPBIOS: usual order
   port=${port1%%-*}
   oplport=${port2%%-*}
 else
   # ACPI: mixed-up order
   port=${port3%%-*}
   oplport=${port1%%-*}
 fi
 } < $WSSDEV/resources

{ read
 read bla port1
 cport=${port1%%-*}
} < $CTLDEV/resources

# load the module

modprobe --ignore-install snd-cs4236 port=$port cport=$cport fm_port=$oplport irq=$irq dma1=$dma1 dma2=$dma2 isapnp=0 index=0 && /lib/alsa/modprobe-post-install snd-cs4236

modprobe Configuration

Add these lines to /etc/modprobe.conf or /etc/modprobe.d/cs4236pnp:

# Kill any attempts from hotplug or discover to load the PCI driver
install snd-cs46xx /bin/true
# Set up PnP before loading ISA driver
install snd-cs4236 /usr/local/bin/soundcard-on



FOOTNOTES [Δ]
  1. provided by Mkarcher 23:20, 22 January 2006 (CET)