diff options
author | Jaroslav Kysela <perex@suse.cz> | 2004-05-22 14:16:19 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2004-05-22 14:16:19 +0200 |
commit | 15fe2ede78c1531205f34efbaa55ecdd6c7a5450 (patch) | |
tree | b672619142e254eebbbaa84fa39c5d333dba53eb /Documentation | |
parent | ddac3ee38e2ffb6d486202796836ab44892aaec4 (diff) | |
parent | aabea325147a05eb97d4f74a4a6d44d8ff9ed124 (diff) | |
download | history-15fe2ede78c1531205f34efbaa55ecdd6c7a5450.tar.gz |
Merge suse.cz:/home/perex/bk/linux-sound/linux-2.5
into suse.cz:/home/perex/bk/linux-sound/linux-sound
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/sound/alsa/ALSA-Configuration.txt | 33 | ||||
-rw-r--r-- | Documentation/sound/alsa/Audigy-mixer.txt | 345 | ||||
-rw-r--r-- | Documentation/sound/alsa/CMIPCI.txt | 4 | ||||
-rw-r--r-- | Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 239 | ||||
-rw-r--r-- | Documentation/sound/alsa/Procfile.txt | 6 |
5 files changed, 442 insertions, 185 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index addec50998e6b8..10c5bed26b1c01 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt @@ -416,7 +416,8 @@ Module parameters * Creative Card w/Digital out + Digital I/O 2 [0x0fc3/0x1f0f] * Creative Card w/Digital CD in + Digital I/O 2 [0x0fcf/0x1f0f] * Creative Card 5.1/w Digital out + LiveDrive [0x3fc3/0x1fff] - * Creative Card all ins and outs [0x3fff/0x1fff] + * Creative Card 5.1 (c) 2003 [0x3fc3/0x7cff] + * Creative Card all ins and outs [0x3fff/0x7fff] Module snd-ens1370 ------------------ @@ -609,6 +610,10 @@ Module parameters * Hoontech SoundTrack DSP 24 Media 7.1 * Digigram VX442 + model - Use the given board model, one of the following: + delta1010, dio2496, delta66, delta44, audiophile, delta410, + delta1010lt, vx442, ewx2496, ews88mt, ews88mt_new, ews88d, + dmx6fire, dsp24, dsp24_71, ez8 omni - Omni I/O support for MidiMan M-Audio Delta44/66 cs8427_timeout - reset timeout for the CS8427 chip (S/PDIF transciever) in msec resolution, default value is 500 (0.5 sec) @@ -625,6 +630,9 @@ Module parameters * AMP Ltd AUDIO2000 * TerraTec Aureon Sky-5.1, Space-7.1 + model - Use the given board model, one of the following: + revo71, amp2000, prodigy71, aureon51, aureon71 + Module supports up to 8 cards and autoprobe. Module snd-intel8x0 @@ -787,6 +795,8 @@ Module parameters Module supports autoprobe and multiple chips (max 8). + The power-management is supported. + Note: on some notebooks the buffer address cannot be detected automatically, or causes hang-up during initialization. In such a case, specify the buffer top address explicity via @@ -796,9 +806,24 @@ Module parameters Sony F270: buffer_top=0x272800 The driver supports only ac97 codec. It's possible to force to initialize/use ac97 although it's not detected. In such a - case, use force_ac97=1 option. - - The power-management is supported. + case, use force_ac97=1 option - but *NO* guarantee whether it + works! + + Note: The NM256 chip can be linked internally with non-AC97 + codecs. This driver supports only the AC97 codec, and won't work + with machines with other (most likely CS423x or OPL3SAx) chips, + even though the device is detected in lspci. In such a case, try + other drivers, e.g. snd-cs4232 or snd-opl3sa2. Some has ISA-PnP + but some doesn't have ISA PnP. You'll need to speicfy isapnp=0 + and proper hardware parameters in the case without ISA PnP. + + Note: This driver is really crappy. It's a porting from the + OSS driver, which is a result of black-magic reverse engineering. + The detection of codec will fail if the driver is loaded *after* + X-server as described above. You might be able to force to load + the module, but it may result in hang-up. Hence, make sure that + you load this module *before* X if you encounter this kind of + problem. Module snd-opl3sa2 ------------------ diff --git a/Documentation/sound/alsa/Audigy-mixer.txt b/Documentation/sound/alsa/Audigy-mixer.txt new file mode 100644 index 00000000000000..5132fd95e07435 --- /dev/null +++ b/Documentation/sound/alsa/Audigy-mixer.txt @@ -0,0 +1,345 @@ + + Sound Blaster Audigy mixer / default DSP code + =========================================== + +This is based on SB-Live-mixer.txt. + +The EMU10K2 chips have a DSP part which can be programmed to support +various ways of sample processing, which is described here. +(This acticle does not deal with the overall functionality of the +EMU10K2 chips. See the manuals section for further details.) + +The ALSA driver programs this portion of chip by default code +(can be altered later) which offers the following functionality: + + +1) Digital mixer controls +------------------------- + +These controls are built using the DSP instructions. They offer extended +functionality. Only the default build-in code in the ALSA driver is described +here. Note that the controls work as attenuators: the maximum value is the +neutral position leaving the signal unchanged. Note that if the same destination +is mentioned in multiple controls, the signal is accumulated and can be wrapped +(set to maximal or minimal value without checking of overflow). + + +Explanation of used abbreviations: + +DAC - digital to analog converter +ADC - analog to digital converter +I2S - one-way three wire serial bus for digital sound by Philips Semiconductors + (this standard is used for connecting standalone DAC and ADC converters) +LFE - low frequency effects (subwoofer signal) +AC97 - a chip containing an analog mixer, DAC and ADC converters +IEC958 - S/PDIF +FX-bus - the EMU10K2 chip has an effect bus containing 64 accumulators. + Each of the synthesizer voices can feed its output to these accumulators + and the DSP microcontroller can operate with the resulting sum. + +name='PCM Front Playback Volume',index=0 + +This control is used to attenuate samples for left and right front PCM FX-bus +accumulators. ALSA uses accumulators 8 and 9 for left and right front PCM +samples for 5.1 playback. The result samples are forwarded to the front DAC PCM +slots of the Philips DAC. + +name='PCM Surround Playback Volume',index=0 + +This control is used to attenuate samples for left and right surround PCM FX-bus +accumulators. ALSA uses accumulators 2 and 3 for left and right surround PCM +samples for 5.1 playback. The result samples are forwarded to the surround DAC PCM +slots of the Philips DAC. + +name='PCM Center Playback Volume',index=0 + +This control is used to attenuate samples for center PCM FX-bus accumulator. +ALSA uses accumulator 6 for center PCM sample for 5.1 playback. The result sample +is forwarded to the center DAC PCM slot of the Philips DAC. + +name='PCM LFE Playback Volume',index=0 + +This control is used to attenuate sample for LFE PCM FX-bus accumulator. +ALSA uses accumulator 7 for LFE PCM sample for 5.1 playback. The result sample +is forwarded to the LFE DAC PCM slot of the Philips DAC. + +name='PCM Playback Volume',index=0 + +This control is used to attenuate samples for left and right PCM FX-bus +accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples for +stereo playback. The result samples are forwarded to the front DAC PCM slots +of the Philips DAC. + +name='PCM Capture Volume',index=0 + +This control is used to attenuate samples for left and right PCM FX-bus +accumulator. ALSA uses accumulators 0 and 1 for left and right PCM. +The result is forwarded to the ADC capture FIFO (thus to the standard capture +PCM device). + +name='Music Playback Volume',index=0 + +This control is used to attenuate samples for left and right MIDI FX-bus +accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples. +The result samples are forwarded to the front DAC PCM slots of the AC97 codec. + +name='Music Capture Volume',index=0 + +These controls are used to attenuate samples for left and right MIDI FX-bus +accumulator. ALSA uses accumulators 4 and 5 for left and right PCM. +The result is forwarded to the ADC capture FIFO (thus to the standard capture +PCM device). + +name='Mic Playback Volume',index=0 + +This control is used to attenuate samples for left and right Mic input. +For Mic input is used AC97 codec. The result samples are forwarded to +the front DAC PCM slots of the Philips DAC. Samples are forwarded to Mic +capture FIFO (device 1 - 16bit/8KHz mono) too without volume control. + +name='Mic Capture Volume',index=0 + +This control is used to attenuate samples for left and right Mic input. +The result is forwarded to the ADC capture FIFO (thus to the standard capture +PCM device). + +name='Audigy CD Playback Volume',index=0 + +This control is used to attenuate samples from left and right IEC958 TTL +digital inputs (usually used by a CDROM drive). The result samples are +forwarded to the front DAC PCM slots of the Philips DAC. + +name='Audigy CD Capture Volume',index=0 + +This control is used to attenuate samples from left and right IEC958 TTL +digital inputs (usually used by a CDROM drive). The result samples are +forwarded to the ADC capture FIFO (thus to the standard capture PCM device). + +name='IEC958 Optical Playback Volume',index=0 + +This control is used to attenuate samples from left and right IEC958 optical +digital input. The result samples are forwarded to the front DAC PCM slots +of the Philips DAC. + +name='IEC958 Optical Capture Volume',index=0 + +This control is used to attenuate samples from left and right IEC958 optical +digital inputs. The result samples are forwarded to the ADC capture FIFO +(thus to the standard capture PCM device). + +name='Line2 Playback Volume',index=0 + +This control is used to attenuate samples from left and right I2S ADC +inputs (on the AudigyDrive). The result samples are forwarded to the front +DAC PCM slots of the Philips DAC. + +name='Line2 Capture Volume',index=1 + +This control is used to attenuate samples from left and right I2S ADC +inputs (on the AudigyDrive). The result samples are forwarded to the ADC +capture FIFO (thus to the standard capture PCM device). + +name='Analog Mix Playback Volume',index=0 + +This control is used to attenuate samples from left and right I2S ADC +inputs from Philips ADC. The result samples are forwarded to the front +DAC PCM slots of the Philips DAC. This contains mix from analog sources +like CD, Line In, Aux, .... + +name='Analog Mix Capture Volume',index=1 + +This control is used to attenuate samples from left and right I2S ADC +inputs Philips ADC. The result samples are forwarded to the ADC +capture FIFO (thus to the standard capture PCM device). + +name='Aux2 Playback Volume',index=0 + +This control is used to attenuate samples from left and right I2S ADC +inputs (on the AudigyDrive). The result samples are forwarded to the front +DAC PCM slots of the Philips DAC. + +name='Aux2 Capture Volume',index=1 + +This control is used to attenuate samples from left and right I2S ADC +inputs (on the AudigyDrive). The result samples are forwarded to the ADC +capture FIFO (thus to the standard capture PCM device). + +name='Front Playback Volume',index=0 + +All stereo signals are mixed together and mirrored to surround, center and LFE. +This control is used to attenuate samples for left and right front speakers of +this mix. + +name='Surround Playback Volume',index=0 + +All stereo signals are mixed together and mirrored to surround, center and LFE. +This control is used to attenuate samples for left and right surround speakers of +this mix. + +name='Center Playback Volume',index=0 + +All stereo signals are mixed together and mirrored to surround, center and LFE. +This control is used to attenuate sample for center speaker of this mix. + +name='LFE Playback Volume',index=0 + +All stereo signals are mixed together and mirrored to surround, center and LFE. +This control is used to attenuate sample for LFE speaker of this mix. + +name='Tone Control - Switch',index=0 + +This control turns the tone control on or off. The samples for front, rear +and center / LFE outputs are affected. + +name='Tone Control - Bass',index=0 + +This control sets the bass intensity. There is no neutral value!! +When the tone control code is activated, the samples are always modified. +The closest value to pure signal is 20. + +name='Tone Control - Treble',index=0 + +This control sets the treble intensity. There is no neutral value!! +When the tone control code is activated, the samples are always modified. +The closest value to pure signal is 20. + +name='Master Playback Volume',index=0 + +This control is used to attenuate samples for front, surround, center and +LFE outputs. + +name='IEC958 Optical Raw Playback Switch',index=0 + +If this switch is on, then the samples for the IEC958 (S/PDIF) digital +output are taken only from the raw FX8010 PCM, otherwise standard front +PCM samples are taken. + + +2) PCM stream related controls +------------------------------ + +name='EMU10K1 PCM Volume',index 0-31 + +Channel volume attenuation in range 0-0xffff. The maximum value (no +attenuation) is default. The channel mapping for three values is +as follows: + + 0 - mono, default 0xffff (no attenuation) + 1 - left, default 0xffff (no attenuation) + 2 - right, default 0xffff (no attenuation) + +name='EMU10K1 PCM Send Routing',index 0-31 + +This control specifies the destination - FX-bus accumulators. There 24 +values with this mapping: + + 0 - mono, A destination (FX-bus 0-63), default 0 + 1 - mono, B destination (FX-bus 0-63), default 1 + 2 - mono, C destination (FX-bus 0-63), default 2 + 3 - mono, D destination (FX-bus 0-63), default 3 + 4 - mono, E destination (FX-bus 0-63), default 0 + 5 - mono, F destination (FX-bus 0-63), default 0 + 6 - mono, G destination (FX-bus 0-63), default 0 + 7 - mono, H destination (FX-bus 0-63), default 0 + 8 - left, A destination (FX-bus 0-63), default 0 + 9 - left, B destination (FX-bus 0-63), default 1 + 10 - left, C destination (FX-bus 0-63), default 2 + 11 - left, D destination (FX-bus 0-63), default 3 + 12 - left, E destination (FX-bus 0-63), default 0 + 13 - left, F destination (FX-bus 0-63), default 0 + 14 - left, G destination (FX-bus 0-63), default 0 + 15 - left, H destination (FX-bus 0-63), default 0 + 16 - right, A destination (FX-bus 0-63), default 0 + 17 - right, B destination (FX-bus 0-63), default 1 + 18 - right, C destination (FX-bus 0-63), default 2 + 19 - right, D destination (FX-bus 0-63), default 3 + 20 - right, E destination (FX-bus 0-63), default 0 + 21 - right, F destination (FX-bus 0-63), default 0 + 22 - right, G destination (FX-bus 0-63), default 0 + 23 - right, H destination (FX-bus 0-63), default 0 + +Don't forget that it's illegal to assign a channel to the same FX-bus accumulator +more than once (it means 0=0 && 1=0 is an invalid combination). + +name='EMU10K1 PCM Send Volume',index 0-31 + +It specifies the attenuation (amount) for given destination in range 0-255. +The channel mapping is following: + + 0 - mono, A destination attn, default 255 (no attenuation) + 1 - mono, B destination attn, default 255 (no attenuation) + 2 - mono, C destination attn, default 0 (mute) + 3 - mono, D destination attn, default 0 (mute) + 4 - mono, E destination attn, default 0 (mute) + 5 - mono, F destination attn, default 0 (mute) + 6 - mono, G destination attn, default 0 (mute) + 7 - mono, H destination attn, default 0 (mute) + 8 - left, A destination attn, default 255 (no attenuation) + 9 - left, B destination attn, default 0 (mute) + 10 - left, C destination attn, default 0 (mute) + 11 - left, D destination attn, default 0 (mute) + 12 - left, E destination attn, default 0 (mute) + 13 - left, F destination attn, default 0 (mute) + 14 - left, G destination attn, default 0 (mute) + 15 - left, H destination attn, default 0 (mute) + 16 - right, A destination attn, default 0 (mute) + 17 - right, B destination attn, default 255 (no attenuation) + 18 - right, C destination attn, default 0 (mute) + 19 - right, D destination attn, default 0 (mute) + 20 - right, E destination attn, default 0 (mute) + 21 - right, F destination attn, default 0 (mute) + 22 - right, G destination attn, default 0 (mute) + 23 - right, H destination attn, default 0 (mute) + + + +4) MANUALS/PATENTS: +------------------- + +ftp://opensource.creative.com/pub/doc +------------------------------------- + + Files: + LM4545.pdf AC97 Codec + + m2049.pdf The EMU10K1 Digital Audio Processor + + hog63.ps FX8010 - A DSP Chip Architecture for Audio Effects + + +WIPO Patents +------------ + Patent numbers: + WO 9901813 (A1) Audio Effects Processor with multiple asynchronous (Jan. 14, 1999) + streams + + WO 9901814 (A1) Processor with Instruction Set for Audio Effects (Jan. 14, 1999) + + WO 9901953 (A1) Audio Effects Processor having Decoupled Instruction + Execution and Audio Data Sequencing (Jan. 14, 1999) + + +US Patents (http://www.uspto.gov/) +---------------------------------- + + US 5925841 Digital Sampling Instrument employing cache memory (Jul. 20, 1999) + + US 5928342 Audio Effects Processor integrated on a single chip (Jul. 27, 1999) + with a multiport memory onto which multiple asynchronous + digital sound samples can be concurrently loaded + + US 5930158 Processor with Instruction Set for Audio Effects (Jul. 27, 1999) + + US 6032235 Memory initialization circuit (Tram) (Feb. 29, 2000) + + US 6138207 Interpolation looping of audio samples in cache connected to (Oct. 24, 2000) + system bus with prioritization and modification of bus transfers + in accordance with loop ends and minimum block sizes + + US 6151670 Method for conserving memory storage using a (Nov. 21, 2000) + pool of short term memory registers + + US 6195715 Interrupt control for multiple programs communicating with (Feb. 27, 2001) + a common interrupt by associating programs to GP registers, + defining interrupt register, polling GP registers, and invoking + callback routine associated with defined interrupt register diff --git a/Documentation/sound/alsa/CMIPCI.txt b/Documentation/sound/alsa/CMIPCI.txt index f7e5ff7ba34142..4a7df771b806c7 100644 --- a/Documentation/sound/alsa/CMIPCI.txt +++ b/Documentation/sound/alsa/CMIPCI.txt @@ -180,8 +180,8 @@ Similarly the following switches are off: "IEC958 Mix Analog" and device automatically to the previous state. On the model 033, AC3 is implemented by the software conversion in -the driver. This prevents the mmap support. If you need mmap -support, pass the "soft_ac3=0" module option. This doesn't matter +the alsa-lib. If you need to bypass the software conversion of IEC958 +subframes, pass the "soft_ac3=0" module option. This doesn't matter on the newer models. diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 63a46fd2b52737..934a49a595fbea 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl @@ -511,7 +511,7 @@ } // (7) - pci_set_drvdata(pci, chip); + pci_set_drvdata(pci, card); dev++; return 0; } @@ -519,10 +519,7 @@ // destructor -- see "Destructor" sub-section static void __devexit snd_mychip_remove(struct pci_dev *pci) { - mychip_t *chip = snd_magic_cast(mychip_t, - pci_get_drvdata(pci), return); - if (chip) - snd_card_free(chip->card); + snd_card_free(pci_get_drvdata(pci)); pci_set_drvdata(pci, NULL); } ]]> @@ -691,21 +688,16 @@ <informalexample> <programlisting> <![CDATA[ - pci_set_drvdata(pci, chip); + pci_set_drvdata(pci, card); dev++; return 0; ]]> </programlisting> </informalexample> - In the above, the chip record is stored. This pointer is + In the above, the card record is stored. This pointer is referred in the remove callback and power-management callbacks, too. - If the card doesn't support the suspend/resume, you can store - the card pointer instead of the chip pointer, so that - <function>snd_card_free</function> can be called directly - without cast in the remove callback. But anyway, be sure - which pointer is used. </para> </section> </section> @@ -726,21 +718,15 @@ <![CDATA[ static void __devexit snd_mychip_remove(struct pci_dev *pci) { - mychip_t *chip = snd_magic_cast(mychip_t, - pci_get_drvdata(pci), return); - if (chip) - snd_card_free(chip->card); + snd_card_free(pci_get_drvdata(pci)); pci_set_drvdata(pci, NULL); } ]]> </programlisting> </informalexample> - The above code assumes that the chip is allocated - with snd_magic stuff and - has the field to hold the card pointer (see <link - linkend="card-management"><citetitle>the next - section</citetitle></link>). + The above code assumes that the card pointer is set to the PCI + driver data. </para> </section> @@ -1355,16 +1341,7 @@ // initialization of the module static int __init alsa_card_mychip_init(void) { - int err; - - if ((err = pci_module_init(&driver)) < 0) { - #ifdef MODULE - printk(KERN_ERR "My chip soundcard not found " - "or device busy\n"); - #endif - return err; - } - return 0; + return pci_module_init(&driver); } // clean up the module @@ -1781,16 +1758,7 @@ <![CDATA[ static int __init alsa_card_mychip_init(void) { - int err; - - if ((err = pci_module_init(&driver)) < 0) { - #ifdef MODULE - printk(KERN_ERR "My chip soundcard not found" - " or device busy\n"); - #endif - return err; - } - return 0; + return pci_module_init(&driver); } static void __exit alsa_card_mychip_exit(void) @@ -5254,47 +5222,23 @@ struct _snd_pcm_runtime { </para> <para> - Basic jobs of suspend/resume are done in - <structfield>suspend</structfield> and - <structfield>resume</structfield> callbacks of - <structname>pci_driver</structname> struct. Unfortunately, the - API of these callbacks was changed at the middle time of Linux - 2.4.x, if you want to keep the support for older kernels, you - have to write two different callbacks. The example below is the - skeleton callbacks which just call the real suspend and resume - functions. + ALSA provides the common power-management layer. Each card driver + needs to have only low-level suspend and resume callbacks. <informalexample> <programlisting> <![CDATA[ - #ifndef PCI_OLD_SUSPEND - static int snd_my_suspend(struct pci_dev *dev, u32 state) + #ifdef CONFIG_PM + static int snd_my_suspend(snd_card_t *card, unsigned int state) { - mychip_t *chip = snd_magic_cast(mychip_t, - pci_get_drvdata(dev), return -ENXIO); - mychip_suspend(chip); + .... // do things for suspsend return 0; } - static int snd_my_resume(struct pci_dev *dev) + static int snd_my_resume(snd_card_t *card, unsigned int state) { - mychip_t *chip = snd_magic_cast(mychip_t, - pci_get_drvdata(dev), return -ENXIO); - mychip_resume(chip); + .... // do things for suspsend return 0; } - #else - static void snd_my_suspend(struct pci_dev *dev) - { - mychip_t *chip = snd_magic_cast(mychip_t, - pci_get_drvdata(dev), return); - mychip_suspend(chip); - } - static void snd_mychip_resume(struct pci_dev *dev) - { - mychip_t *chip = snd_magic_cast(mychip_t, - pci_get_drvdata(dev), return); - mychip_resume(chip); - } #endif ]]> </programlisting> @@ -5302,17 +5246,10 @@ struct _snd_pcm_runtime { </para> <para> - For keeping the readability of 2.6 source code, it's recommended to - separate the above ifdef condition as the patch file in alsa-driver - directory. - See <filename>alsa-driver/pci/ali5451.c</filename> for example. - </para> - - <para> The scheme of the real suspend job is as following. <orderedlist> - <listitem><para>Check whether the power-state is already D3hot. If yes, skip the job.</para></listitem> + <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem> <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem> <listitem><para>Save the register values if necessary.</para></listitem> <listitem><para>Stop the hardware if necessary.</para></listitem> @@ -5326,12 +5263,11 @@ struct _snd_pcm_runtime { <informalexample> <programlisting> <![CDATA[ - static void mychip_suspend(mychip_t *chip) + static int mychip_suspend(snd_card_t *card, unsigned int state) { - snd_card_t *card = chip->card; // (1) - if (card->power_state == SNDRV_CTL_POWER_D3hot) - return; + mychip_t *chip = snd_magic_cast(mychip_t, card->pm_private_data, + return -ENXIO); // (2) snd_pcm_suspend_all(chip->pcm); // (3) @@ -5340,6 +5276,7 @@ struct _snd_pcm_runtime { snd_mychip_stop_hardware(chip); // (5) snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + return 0; } ]]> </programlisting> @@ -5350,8 +5287,7 @@ struct _snd_pcm_runtime { The scheme of the real resume job is as following. <orderedlist> - <listitem><para>Check whether the power-state is already D0. - If yes, skip the job.</para></listitem> + <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem> <listitem><para>Enable the pci device again by calling <function>pci_enable_device()</function>.</para></listitem> <listitem><para>Re-initialize the chip.</para></listitem> @@ -5372,10 +5308,9 @@ struct _snd_pcm_runtime { <![CDATA[ static void mychip_resume(mychip_t *chip) { - snd_card_t *card = chip->card; // (1) - if (card->power_state == SNDRV_CTL_POWER_D0) - return; + mychip_t *chip = snd_magic_cast(mychip_t, card->pm_private_data, + return -ENXIO); // (2) pci_enable_device(chip->pci); // (3) @@ -5388,38 +5323,6 @@ struct _snd_pcm_runtime { snd_mychip_restart_chip(chip); // (7) snd_power_change_state(card, SNDRV_CTL_POWER_D0); - } -]]> - </programlisting> - </informalexample> - </para> - - <para> - In addition to the callbacks above, you should define a callback - for the changes via the ALSA control interface. It's defined - like below: - - <informalexample> - <programlisting> -<![CDATA[ - static int snd_mychip_set_power_state(snd_card_t *card, - unsigned int power_state) - { - mychip_t *chip = snd_magic_cast(mychip_t, - card->power_state_private_data, return -ENXIO); - switch (power_state) { - case SNDRV_CTL_POWER_D0: - case SNDRV_CTL_POWER_D1: - case SNDRV_CTL_POWER_D2: - mychip_resume(chip); - break; - case SNDRV_CTL_POWER_D3hot: - case SNDRV_CTL_POWER_D3cold: - mychip_suspend(chip); - break; - default: - return -EINVAL; - } return 0; } ]]> @@ -5439,41 +5342,42 @@ struct _snd_pcm_runtime { { .... snd_card_t *card; + mychip_t *chip; .... - #ifdef CONFIG_PM - card->set_power_state = snd_mychip_set_power_state; - card->power_state_private_data = chip; - #endif + snd_card_set_pm_callback(card, snd_my_suspend, snd_my_resume, chip); .... } ]]> </programlisting> </informalexample> + + Here you don't have to put ifdef CONFIG_PM around, since it's already + checked in the header and expanded to empty if not needed. </para> <para> If you need a space for saving the registers, you'll need to - allocate the buffer for it here, too, since you cannot call - <function>kmalloc()</function> with - <constant>GFP_KERNEL</constant> flag or - <function>vmalloc()</function> in the suspend callback. + allocate the buffer for it here, too, since it would be fatal + if you cannot allocate a memory in the suspend phase. The allocated buffer should be released in the corresponding destructor. </para> <para> And next, set suspend/resume callbacks to the pci_driver, + This can be done by passing a macro SND_PCI_PM_CALLBACKS + in the pci_driver struct. This macro is expanded to the correct + (global) callbacks if CONFIG_PM is set. <informalexample> <programlisting> <![CDATA[ static struct pci_driver driver = { .name = "My Chip", - .... - #ifdef CONFIG_PM - .suspend = snd_mychip_suspend, - .resume = snd_mychip_resume, - #endif + .id_table = snd_my_ids, + .probe = snd_my_probe, + .remove = __devexit_p(snd_my_remove), + SND_PCI_PM_CALLBACKS }; ]]> </programlisting> @@ -5521,7 +5425,8 @@ struct _snd_pcm_runtime { <para> The module parameters must be declared with the standard - <function>MODULE_PARM()</function> and + <function>module_param()()</function>, + <function>module_param_array()()</function> and <function>MODULE_PARM_DESC()</function> macros. The ALSA provides an additional macro, <function>MODULE_PARM_SYNTAX()</function>, for describing its syntax. The strings will be written to @@ -5545,18 +5450,22 @@ struct _snd_pcm_runtime { <![CDATA[ #define CARD_NAME "My Chip" - MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); + static int boot_devs; + module_param_array(index, int, boot_devs, 0444); MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC); - MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s"); + module_param_array(id, charp, boot_devs, 0444); MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC); - MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); + module_param_array(enable, bool, boot_devs, 0444); MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC); ]]> </programlisting> </informalexample> + + Here boot_devs is passed but simply ignored since we don't care + the number of parsed parameters. </para> <para> @@ -5577,39 +5486,6 @@ struct _snd_pcm_runtime { </informalexample> </para> - <para> - For building the driver into kernel, you should define the - <function>setup()</function> function in addition, too. - ALSA provides <function>get_id()</function> function to retrieve - a string argument from the kernel boot parameters. - - <informalexample> - <programlisting> -<![CDATA[ - #ifndef MODULE - - /* format is: snd-mychip=enable,index,id */ - - static int __init alsa_card_mychip_setup(char *str) - { - static unsigned __initdata nr_dev = 0; - - if (nr_dev >= SNDRV_CARDS) - return 0; - (void)(get_option(&str,&enable[nr_dev]) == 2 && - get_option(&str,&index[nr_dev]) == 2 && - get_id(&str,&id[nr_dev]) == 2); - nr_dev++; - return 1; - } - - __setup("snd-mychip=", alsa_card_mychip_setup); - - #endif /* ifndef MODULE */ -]]> - </programlisting> - </informalexample> - </para> </chapter> @@ -5631,10 +5507,14 @@ struct _snd_pcm_runtime { Suppose that you'll create a new PCI driver for the card <quote>xyz</quote>. The card module name would be snd-xyz. The new driver is usually put into alsa-driver - tree. Then the driver is evaluated, audited and tested + tree, <filename>alsa-driver/pci</filename> directory in + the case of PCI cards. + Then the driver is evaluated, audited and tested by developers and users. After a certain time, the driver - will go to alsa-kernel tree and eventually integrated into - Linux 2.6 tree. + will go to alsa-kernel tree (to the corresponding directory, + such as <filename>alsa-kernel/pci</filename>) and eventually + integrated into Linux 2.6 tree (the directory would be + <filename>linux/sound/pci</filename>). </para> <para> @@ -5661,7 +5541,7 @@ struct _snd_pcm_runtime { <programlisting> <![CDATA[ snd-xyz-objs := xyz.o - extra-obj-$(CONFIG_SND_XYZ) += snd-xyz.o + obj-$(CONFIG_SND_XYZ) += snd-xyz.o ]]> </programlisting> </informalexample> @@ -5678,8 +5558,8 @@ struct _snd_pcm_runtime { <informalexample> <programlisting> <![CDATA[ - config SND_BT87X - tristate "Foobar XYX" + config SND_XYZ + tristate "Foobar XYZ" depends on SND select SND_PCM help @@ -5730,7 +5610,8 @@ struct _snd_pcm_runtime { <orderedlist> <listitem> <para> - Add a new directory (xyz) to extra-subdir-y list in alsa-driver/pci/Makefile + Add a new directory (<filename>xyz</filename>) in + <filename>alsa-driver/pci/Makefile</filename> like below <informalexample> <programlisting> @@ -5744,7 +5625,7 @@ struct _snd_pcm_runtime { <listitem> <para> - Under the directory xyz, create a Makefile + Under the directory <filename>xyz</filename>, create a Makefile <example> <title>Sample Makefile for a driver xyz</title> diff --git a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt index d686ea3c39eb59..25c5d648aef6c2 100644 --- a/Documentation/sound/alsa/Procfile.txt +++ b/Documentation/sound/alsa/Procfile.txt @@ -131,6 +131,12 @@ card*/codec97#*/ac97#?-? card*/codec97#0/ac97#?-?+regs Shows the AC97 register dump. Useful for debugging. + When CONFIG_SND_DEBUG is enabled, you can write to this file for + changing an AC97 register directly. Pass two hex numbers. + For example, + + # echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs + Sequencer Information --------------------- |