1
2Documentation for the Cirrus Logic/Crystal SoundFusion cs46xx/cs4280 audio 
3controller chips (2001/05/11)
4
5The cs46xx audio driver supports the DSP line of Cirrus controllers. 
6Specifically, the cs4610, cs4612, cs4614, cs4622, cs4624, cs4630 and the cs4280
7products.  This driver uses the generic ac97_codec driver for AC97 codec
8support.  
9
10
11Features:
12
13Full Duplex Playback/Capture supported from 8k-48k.
1416Bit Signed LE & 8Bit Unsigned, with Mono or Stereo supported.
15
16APM/PM - 2.2.x PM is enabled and functional. APM can also
17be enabled for 2.4.x by modifying the CS46XX_ACPI_SUPPORT macro
18definition.
19
20DMA playback buffer size is configurable from 16k (defaultorder=2) up to 2Meg 
21(defaultorder=11).  DMA capture buffer size is fixed at a single 4k page as
22two 2k fragments.
23
24MMAP seems to work well with QuakeIII, and test XMMS plugin.
25
26Myth2 works, but the polling logic is not fully correct, but is functional.
27
28The 2.4.4-ac6 gameport code in the cs461x joystick driver has been tested 
29with a Microsoft Sidewinder joystick (cs461x.o and sidewinder.o).  This 
30audio driver must be loaded prior to the joystick driver to enable the
31DSP task image supporting the joystick device.
32
33
34Limitations:
35
36SPDIF is currently not supported.
37
38Primary codec support only.  No secondary codec support is implemented.
39
40
41
42NOTES:
43
44Hercules Game Theatre XP - the EGPIO2 pin controls the external Amp,
45and has been tested.
46Module parameter hercules_egpio_disable set to 1, will force a 0 to EGPIODR
47to disable the external amplifier.
48
49VTB Santa Cruz - the GPIO7/GPIO8 on the Secondary Codec control
50the external amplifier for the "back" speakers, since we do not
51support the secondary codec then this external amp is not
52turned on.  The primary codec external amplifier is supported but
53note that the AC97 EAPD bit is inverted logic (amp_voyetra()).
54
55DMA buffer size - there are issues with many of the Linux applications
56concerning the optimal buffer size.  Several applications request a 
57certain fragment size and number and then do not verify that the driver
58has the ability to support the requested configuration.  
59SNDCTL_DSP_SETFRAGMENT ioctl is used to request a fragment size and
60number of fragments.  Some applications exit if an error is returned
61on this particular ioctl. Therefore, in alignment with the other OSS audio 
62drivers, no error is returned when a SETFRAGs IOCTL is received, but the 
63values passed from the app are not used in any buffer calculation 
64(ossfragshift/ossmaxfrags are not used).
65Use the "defaultorder=N" module parameter to change the buffer size if
66you have an application that requires a specific number of fragments
67or a specific buffer size (see below).
68
69Debug Interface
70---------------
71There is an ioctl debug interface to allow runtime modification of the 
72debug print levels.  This debug interface code can be disabled from the 
73compilation process with commenting the following define:
74#define CSDEBUG_INTERFACE 1
75There is also a debug print methodolgy to select printf statements from
76different areas of the driver.  A debug print level is also used to allow
77additional printfs to be active.  Comment out the following line in the
78driver to disable compilation of the CS_DBGOUT print statements:
79#define CSDEBUG 1
80 
81Please see the defintions for cs_debuglevel and cs_debugmask for additional
82information on the debug levels and sections.
83
84There is also a csdbg executable to allow runtime manipulation of these 
85parameters.  for a copy email: twoller@crystal.cirrus.com
86
87
88
89MODULE_PARMS definitions
90------------------------
91MODULE_PARM(defaultorder, "i");
92defaultorder=N
93where N is a value from 1 to 12
94The buffer order determines the size of the dma buffer for the driver.
95under Linux, a smaller buffer allows more responsiveness from many of the 
96applications (e.g. games).  A larger buffer allows some of the apps (esound) 
97to not underrun the dma buffer as easily.  As default, use 32k (order=3)
98rather than 64k as some of the games work more responsively.
99(2^N) * PAGE_SIZE = allocated buffer size
100
101MODULE_PARM(cs_debuglevel, "i");
102MODULE_PARM(cs_debugmask, "i");
103cs_debuglevel=N
104cs_debugmask=0xMMMMMMMM
105where N is a value from 0 (no debug printfs), to 9 (maximum)
1060xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source).
107
108MODULE_PARM(hercules_egpio_disable, "i");
109hercules_egpio_disable=N
110where N is a 0 (enable egpio), or a 1 (disable egpio support)
111
112MODULE_PARM(initdelay, "i");
113initdelay=N
114This value is used to determine the millescond delay during the initialization
115code prior to powering up the PLL.  On laptops this value can be used to
116assist with errors on resume, mostly with IBM laptops.  Basically, if the 
117system is booted under battery power then the mdelay()/udelay() functions fail to 
118properly delay the required time.  Also, if the system is booted under AC power
119and then the power removed, the mdelay()/udelay() functions will not delay properly.
120 
121MODULE_PARM(powerdown, "i");
122powerdown=N
123where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown)
124
125
126MODULE_PARM(external_amp, "i");
127external_amp=1
128if N is set to 1, then force enabling the EAPD support in the primary AC97 codec.
129override the detection logic and force the external amp bit in the AC97 0x26 register
130to be reset (0).  EAPD should be 0 for powerup, and 1 for powerdown.  The VTB Santa Cruz
131card has inverted logic, so there is a special function for these cards.
132
133MODULE_PARM(thinkpad, "i");
134thinkpad=1
135if N is set to 1, then force enabling the clkrun functionality.
136Currently, when the part is being used, then clkrun is disabled for the entire system,
137but re-enabled when the driver is released or there is no outstanding open count.
138
139