Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
sonicvibes.c File Reference
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/gameport.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/mpu401.h>
#include <sound/opl3.h>
#include <sound/initval.h>
#include <asm/io.h>

Go to the source code of this file.

Data Structures

struct  sonicvibes
 

Macros

#define SV_REG(sonic, x)   ((sonic)->enh_port + SV_REG_##x)
 
#define SV_REG_CONTROL   0x00 /* R/W: CODEC/Mixer control register */
 
#define SV_ENHANCED   0x01 /* audio mode select - enhanced mode */
 
#define SV_TEST   0x02 /* test bit */
 
#define SV_REVERB   0x04 /* reverb enable */
 
#define SV_WAVETABLE   0x08 /* wavetable active / FM active if not set */
 
#define SV_INTA   0x20 /* INTA driving - should be always 1 */
 
#define SV_RESET   0x80 /* reset chip */
 
#define SV_REG_IRQMASK   0x01 /* R/W: CODEC/Mixer interrupt mask register */
 
#define SV_DMAA_MASK   0x01 /* mask DMA-A interrupt */
 
#define SV_DMAC_MASK   0x04 /* mask DMA-C interrupt */
 
#define SV_SPEC_MASK   0x08 /* special interrupt mask - should be always masked */
 
#define SV_UD_MASK   0x40 /* Up/Down button interrupt mask */
 
#define SV_MIDI_MASK   0x80 /* mask MIDI interrupt */
 
#define SV_REG_STATUS   0x02 /* R/O: CODEC/Mixer status register */
 
#define SV_DMAA_IRQ   0x01 /* DMA-A interrupt */
 
#define SV_DMAC_IRQ   0x04 /* DMA-C interrupt */
 
#define SV_SPEC_IRQ   0x08 /* special interrupt */
 
#define SV_UD_IRQ   0x40 /* Up/Down interrupt */
 
#define SV_MIDI_IRQ   0x80 /* MIDI interrupt */
 
#define SV_REG_INDEX   0x04 /* R/W: CODEC/Mixer index address register */
 
#define SV_MCE   0x40 /* mode change enable */
 
#define SV_TRD   0x80 /* DMA transfer request disabled */
 
#define SV_REG_DATA   0x05 /* R/W: CODEC/Mixer index data register */
 
#define SV_IREG_LEFT_ADC   0x00 /* Left ADC Input Control */
 
#define SV_IREG_RIGHT_ADC   0x01 /* Right ADC Input Control */
 
#define SV_IREG_LEFT_AUX1   0x02 /* Left AUX1 Input Control */
 
#define SV_IREG_RIGHT_AUX1   0x03 /* Right AUX1 Input Control */
 
#define SV_IREG_LEFT_CD   0x04 /* Left CD Input Control */
 
#define SV_IREG_RIGHT_CD   0x05 /* Right CD Input Control */
 
#define SV_IREG_LEFT_LINE   0x06 /* Left Line Input Control */
 
#define SV_IREG_RIGHT_LINE   0x07 /* Right Line Input Control */
 
#define SV_IREG_MIC   0x08 /* MIC Input Control */
 
#define SV_IREG_GAME_PORT   0x09 /* Game Port Control */
 
#define SV_IREG_LEFT_SYNTH   0x0a /* Left Synth Input Control */
 
#define SV_IREG_RIGHT_SYNTH   0x0b /* Right Synth Input Control */
 
#define SV_IREG_LEFT_AUX2   0x0c /* Left AUX2 Input Control */
 
#define SV_IREG_RIGHT_AUX2   0x0d /* Right AUX2 Input Control */
 
#define SV_IREG_LEFT_ANALOG   0x0e /* Left Analog Mixer Output Control */
 
#define SV_IREG_RIGHT_ANALOG   0x0f /* Right Analog Mixer Output Control */
 
#define SV_IREG_LEFT_PCM   0x10 /* Left PCM Input Control */
 
#define SV_IREG_RIGHT_PCM   0x11 /* Right PCM Input Control */
 
#define SV_IREG_DMA_DATA_FMT   0x12 /* DMA Data Format */
 
#define SV_IREG_PC_ENABLE   0x13 /* Playback/Capture Enable Register */
 
#define SV_IREG_UD_BUTTON   0x14 /* Up/Down Button Register */
 
#define SV_IREG_REVISION   0x15 /* Revision */
 
#define SV_IREG_ADC_OUTPUT_CTRL   0x16 /* ADC Output Control */
 
#define SV_IREG_DMA_A_UPPER   0x18 /* DMA A Upper Base Count */
 
#define SV_IREG_DMA_A_LOWER   0x19 /* DMA A Lower Base Count */
 
#define SV_IREG_DMA_C_UPPER   0x1c /* DMA C Upper Base Count */
 
#define SV_IREG_DMA_C_LOWER   0x1d /* DMA C Lower Base Count */
 
#define SV_IREG_PCM_RATE_LOW   0x1e /* PCM Sampling Rate Low Byte */
 
#define SV_IREG_PCM_RATE_HIGH   0x1f /* PCM Sampling Rate High Byte */
 
#define SV_IREG_SYNTH_RATE_LOW   0x20 /* Synthesizer Sampling Rate Low Byte */
 
#define SV_IREG_SYNTH_RATE_HIGH   0x21 /* Synthesizer Sampling Rate High Byte */
 
#define SV_IREG_ADC_CLOCK   0x22 /* ADC Clock Source Selection */
 
#define SV_IREG_ADC_ALT_RATE   0x23 /* ADC Alternative Sampling Rate Selection */
 
#define SV_IREG_ADC_PLL_M   0x24 /* ADC PLL M Register */
 
#define SV_IREG_ADC_PLL_N   0x25 /* ADC PLL N Register */
 
#define SV_IREG_SYNTH_PLL_M   0x26 /* Synthesizer PLL M Register */
 
#define SV_IREG_SYNTH_PLL_N   0x27 /* Synthesizer PLL N Register */
 
#define SV_IREG_MPU401   0x2a /* MPU-401 UART Operation */
 
#define SV_IREG_DRIVE_CTRL   0x2b /* Drive Control */
 
#define SV_IREG_SRS_SPACE   0x2c /* SRS Space Control */
 
#define SV_IREG_SRS_CENTER   0x2d /* SRS Center Control */
 
#define SV_IREG_WAVE_SOURCE   0x2e /* Wavetable Sample Source Select */
 
#define SV_IREG_ANALOG_POWER   0x30 /* Analog Power Down Control */
 
#define SV_IREG_DIGITAL_POWER   0x31 /* Digital Power Down Control */
 
#define SV_IREG_ADC_PLL   SV_IREG_ADC_PLL_M
 
#define SV_IREG_SYNTH_PLL   SV_IREG_SYNTH_PLL_M
 
#define SV_DMA_ADDR0   0x00
 
#define SV_DMA_ADDR1   0x01
 
#define SV_DMA_ADDR2   0x02
 
#define SV_DMA_ADDR3   0x03
 
#define SV_DMA_COUNT0   0x04
 
#define SV_DMA_COUNT1   0x05
 
#define SV_DMA_COUNT2   0x06
 
#define SV_DMA_MODE   0x0b
 
#define SV_DMA_RESET   0x0d
 
#define SV_DMA_MASK   0x0f
 
#define SV_RECSRC_RESERVED   (0x00<<5)
 
#define SV_RECSRC_CD   (0x01<<5)
 
#define SV_RECSRC_DAC   (0x02<<5)
 
#define SV_RECSRC_AUX2   (0x03<<5)
 
#define SV_RECSRC_LINE   (0x04<<5)
 
#define SV_RECSRC_AUX1   (0x05<<5)
 
#define SV_RECSRC_MIC   (0x06<<5)
 
#define SV_RECSRC_OUT   (0x07<<5)
 
#define SV_FULLRATE   48000
 
#define SV_REFFREQUENCY   24576000
 
#define SV_ADCMULT   512
 
#define SV_MODE_PLAY   1
 
#define SV_MODE_CAPTURE   2
 
#define SONICVIBES_MUX(xname, xindex)
 
#define SONICVIBES_SINGLE(xname, xindex, reg, shift, mask, invert)
 
#define SONICVIBES_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert)
 

Functions

 MODULE_AUTHOR ("Jaroslav Kysela <[email protected]>")
 
 MODULE_DESCRIPTION ("S3 SonicVibes PCI")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_SUPPORTED_DEVICE ("{{S3,SonicVibes PCI}}")
 
 module_param_array (index, int, NULL, 0444)
 
 MODULE_PARM_DESC (index,"Index value for S3 SonicVibes soundcard.")
 
 module_param_array (id, charp, NULL, 0444)
 
 MODULE_PARM_DESC (id,"ID string for S3 SonicVibes soundcard.")
 
 module_param_array (enable, bool, NULL, 0444)
 
 MODULE_PARM_DESC (enable,"Enable S3 SonicVibes soundcard.")
 
 module_param_array (reverb, bool, NULL, 0444)
 
 MODULE_PARM_DESC (reverb,"Enable reverb (SRAM is present) for S3 SonicVibes soundcard.")
 
 module_param_array (mge, bool, NULL, 0444)
 
 MODULE_PARM_DESC (mge,"MIC Gain Enable for S3 SonicVibes soundcard.")
 
 module_param (dmaio, uint, 0444)
 
 MODULE_PARM_DESC (dmaio,"DDMA i/o base address for S3 SonicVibes soundcard.")
 
 MODULE_DEVICE_TABLE (pci, snd_sonic_ids)
 
 module_pci_driver (sonicvibes_driver)
 

Macro Definition Documentation

#define SONICVIBES_DOUBLE (   xname,
  xindex,
  left_reg,
  right_reg,
  shift_left,
  shift_right,
  mask,
  invert 
)
Value:
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
.info = snd_sonicvibes_info_double, \
.get = snd_sonicvibes_get_double, .put = snd_sonicvibes_put_double, \
.private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }

Definition at line 1020 of file sonicvibes.c.

#define SONICVIBES_MUX (   xname,
  xindex 
)
Value:
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
.info = snd_sonicvibes_info_mux, \
.get = snd_sonicvibes_get_mux, .put = snd_sonicvibes_put_mux }

Definition at line 910 of file sonicvibes.c.

#define SONICVIBES_SINGLE (   xname,
  xindex,
  reg,
  shift,
  mask,
  invert 
)
Value:
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
.info = snd_sonicvibes_info_single, \
.get = snd_sonicvibes_get_single, .put = snd_sonicvibes_put_single, \
.private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }

Definition at line 964 of file sonicvibes.c.

#define SV_ADCMULT   512

Definition at line 189 of file sonicvibes.c.

#define SV_DMA_ADDR0   0x00

Definition at line 159 of file sonicvibes.c.

#define SV_DMA_ADDR1   0x01

Definition at line 160 of file sonicvibes.c.

#define SV_DMA_ADDR2   0x02

Definition at line 161 of file sonicvibes.c.

#define SV_DMA_ADDR3   0x03

Definition at line 162 of file sonicvibes.c.

#define SV_DMA_COUNT0   0x04

Definition at line 163 of file sonicvibes.c.

#define SV_DMA_COUNT1   0x05

Definition at line 164 of file sonicvibes.c.

#define SV_DMA_COUNT2   0x06

Definition at line 165 of file sonicvibes.c.

#define SV_DMA_MASK   0x0f

Definition at line 168 of file sonicvibes.c.

#define SV_DMA_MODE   0x0b

Definition at line 166 of file sonicvibes.c.

#define SV_DMA_RESET   0x0d

Definition at line 167 of file sonicvibes.c.

#define SV_DMAA_IRQ   0x01 /* DMA-A interrupt */

Definition at line 93 of file sonicvibes.c.

#define SV_DMAA_MASK   0x01 /* mask DMA-A interrupt */

Definition at line 87 of file sonicvibes.c.

#define SV_DMAC_IRQ   0x04 /* DMA-C interrupt */

Definition at line 94 of file sonicvibes.c.

#define SV_DMAC_MASK   0x04 /* mask DMA-C interrupt */

Definition at line 88 of file sonicvibes.c.

#define SV_ENHANCED   0x01 /* audio mode select - enhanced mode */

Definition at line 80 of file sonicvibes.c.

#define SV_FULLRATE   48000

Definition at line 187 of file sonicvibes.c.

#define SV_INTA   0x20 /* INTA driving - should be always 1 */

Definition at line 84 of file sonicvibes.c.

#define SV_IREG_ADC_ALT_RATE   0x23 /* ADC Alternative Sampling Rate Selection */

Definition at line 139 of file sonicvibes.c.

#define SV_IREG_ADC_CLOCK   0x22 /* ADC Clock Source Selection */

Definition at line 138 of file sonicvibes.c.

#define SV_IREG_ADC_OUTPUT_CTRL   0x16 /* ADC Output Control */

Definition at line 129 of file sonicvibes.c.

#define SV_IREG_ADC_PLL   SV_IREG_ADC_PLL_M

Definition at line 152 of file sonicvibes.c.

#define SV_IREG_ADC_PLL_M   0x24 /* ADC PLL M Register */

Definition at line 140 of file sonicvibes.c.

#define SV_IREG_ADC_PLL_N   0x25 /* ADC PLL N Register */

Definition at line 141 of file sonicvibes.c.

#define SV_IREG_ANALOG_POWER   0x30 /* Analog Power Down Control */

Definition at line 149 of file sonicvibes.c.

#define SV_IREG_DIGITAL_POWER   0x31 /* Digital Power Down Control */

Definition at line 150 of file sonicvibes.c.

#define SV_IREG_DMA_A_LOWER   0x19 /* DMA A Lower Base Count */

Definition at line 131 of file sonicvibes.c.

#define SV_IREG_DMA_A_UPPER   0x18 /* DMA A Upper Base Count */

Definition at line 130 of file sonicvibes.c.

#define SV_IREG_DMA_C_LOWER   0x1d /* DMA C Lower Base Count */

Definition at line 133 of file sonicvibes.c.

#define SV_IREG_DMA_C_UPPER   0x1c /* DMA C Upper Base Count */

Definition at line 132 of file sonicvibes.c.

#define SV_IREG_DMA_DATA_FMT   0x12 /* DMA Data Format */

Definition at line 125 of file sonicvibes.c.

#define SV_IREG_DRIVE_CTRL   0x2b /* Drive Control */

Definition at line 145 of file sonicvibes.c.

#define SV_IREG_GAME_PORT   0x09 /* Game Port Control */

Definition at line 116 of file sonicvibes.c.

#define SV_IREG_LEFT_ADC   0x00 /* Left ADC Input Control */

Definition at line 107 of file sonicvibes.c.

#define SV_IREG_LEFT_ANALOG   0x0e /* Left Analog Mixer Output Control */

Definition at line 121 of file sonicvibes.c.

#define SV_IREG_LEFT_AUX1   0x02 /* Left AUX1 Input Control */

Definition at line 109 of file sonicvibes.c.

#define SV_IREG_LEFT_AUX2   0x0c /* Left AUX2 Input Control */

Definition at line 119 of file sonicvibes.c.

#define SV_IREG_LEFT_CD   0x04 /* Left CD Input Control */

Definition at line 111 of file sonicvibes.c.

#define SV_IREG_LEFT_LINE   0x06 /* Left Line Input Control */

Definition at line 113 of file sonicvibes.c.

#define SV_IREG_LEFT_PCM   0x10 /* Left PCM Input Control */

Definition at line 123 of file sonicvibes.c.

#define SV_IREG_LEFT_SYNTH   0x0a /* Left Synth Input Control */

Definition at line 117 of file sonicvibes.c.

#define SV_IREG_MIC   0x08 /* MIC Input Control */

Definition at line 115 of file sonicvibes.c.

#define SV_IREG_MPU401   0x2a /* MPU-401 UART Operation */

Definition at line 144 of file sonicvibes.c.

#define SV_IREG_PC_ENABLE   0x13 /* Playback/Capture Enable Register */

Definition at line 126 of file sonicvibes.c.

#define SV_IREG_PCM_RATE_HIGH   0x1f /* PCM Sampling Rate High Byte */

Definition at line 135 of file sonicvibes.c.

#define SV_IREG_PCM_RATE_LOW   0x1e /* PCM Sampling Rate Low Byte */

Definition at line 134 of file sonicvibes.c.

#define SV_IREG_REVISION   0x15 /* Revision */

Definition at line 128 of file sonicvibes.c.

#define SV_IREG_RIGHT_ADC   0x01 /* Right ADC Input Control */

Definition at line 108 of file sonicvibes.c.

#define SV_IREG_RIGHT_ANALOG   0x0f /* Right Analog Mixer Output Control */

Definition at line 122 of file sonicvibes.c.

#define SV_IREG_RIGHT_AUX1   0x03 /* Right AUX1 Input Control */

Definition at line 110 of file sonicvibes.c.

#define SV_IREG_RIGHT_AUX2   0x0d /* Right AUX2 Input Control */

Definition at line 120 of file sonicvibes.c.

#define SV_IREG_RIGHT_CD   0x05 /* Right CD Input Control */

Definition at line 112 of file sonicvibes.c.

#define SV_IREG_RIGHT_LINE   0x07 /* Right Line Input Control */

Definition at line 114 of file sonicvibes.c.

#define SV_IREG_RIGHT_PCM   0x11 /* Right PCM Input Control */

Definition at line 124 of file sonicvibes.c.

#define SV_IREG_RIGHT_SYNTH   0x0b /* Right Synth Input Control */

Definition at line 118 of file sonicvibes.c.

#define SV_IREG_SRS_CENTER   0x2d /* SRS Center Control */

Definition at line 147 of file sonicvibes.c.

#define SV_IREG_SRS_SPACE   0x2c /* SRS Space Control */

Definition at line 146 of file sonicvibes.c.

#define SV_IREG_SYNTH_PLL   SV_IREG_SYNTH_PLL_M

Definition at line 153 of file sonicvibes.c.

#define SV_IREG_SYNTH_PLL_M   0x26 /* Synthesizer PLL M Register */

Definition at line 142 of file sonicvibes.c.

#define SV_IREG_SYNTH_PLL_N   0x27 /* Synthesizer PLL N Register */

Definition at line 143 of file sonicvibes.c.

#define SV_IREG_SYNTH_RATE_HIGH   0x21 /* Synthesizer Sampling Rate High Byte */

Definition at line 137 of file sonicvibes.c.

#define SV_IREG_SYNTH_RATE_LOW   0x20 /* Synthesizer Sampling Rate Low Byte */

Definition at line 136 of file sonicvibes.c.

#define SV_IREG_UD_BUTTON   0x14 /* Up/Down Button Register */

Definition at line 127 of file sonicvibes.c.

#define SV_IREG_WAVE_SOURCE   0x2e /* Wavetable Sample Source Select */

Definition at line 148 of file sonicvibes.c.

#define SV_MCE   0x40 /* mode change enable */

Definition at line 99 of file sonicvibes.c.

#define SV_MIDI_IRQ   0x80 /* MIDI interrupt */

Definition at line 97 of file sonicvibes.c.

#define SV_MIDI_MASK   0x80 /* mask MIDI interrupt */

Definition at line 91 of file sonicvibes.c.

#define SV_MODE_CAPTURE   2

Definition at line 192 of file sonicvibes.c.

#define SV_MODE_PLAY   1

Definition at line 191 of file sonicvibes.c.

#define SV_RECSRC_AUX1   (0x05<<5)

Definition at line 179 of file sonicvibes.c.

#define SV_RECSRC_AUX2   (0x03<<5)

Definition at line 177 of file sonicvibes.c.

#define SV_RECSRC_CD   (0x01<<5)

Definition at line 175 of file sonicvibes.c.

#define SV_RECSRC_DAC   (0x02<<5)

Definition at line 176 of file sonicvibes.c.

#define SV_RECSRC_LINE   (0x04<<5)

Definition at line 178 of file sonicvibes.c.

#define SV_RECSRC_MIC   (0x06<<5)

Definition at line 180 of file sonicvibes.c.

#define SV_RECSRC_OUT   (0x07<<5)

Definition at line 181 of file sonicvibes.c.

#define SV_RECSRC_RESERVED   (0x00<<5)

Definition at line 174 of file sonicvibes.c.

#define SV_REFFREQUENCY   24576000

Definition at line 188 of file sonicvibes.c.

#define SV_REG (   sonic,
  x 
)    ((sonic)->enh_port + SV_REG_##x)

Definition at line 77 of file sonicvibes.c.

#define SV_REG_CONTROL   0x00 /* R/W: CODEC/Mixer control register */

Definition at line 79 of file sonicvibes.c.

#define SV_REG_DATA   0x05 /* R/W: CODEC/Mixer index data register */

Definition at line 101 of file sonicvibes.c.

#define SV_REG_INDEX   0x04 /* R/W: CODEC/Mixer index address register */

Definition at line 98 of file sonicvibes.c.

#define SV_REG_IRQMASK   0x01 /* R/W: CODEC/Mixer interrupt mask register */

Definition at line 86 of file sonicvibes.c.

#define SV_REG_STATUS   0x02 /* R/O: CODEC/Mixer status register */

Definition at line 92 of file sonicvibes.c.

#define SV_RESET   0x80 /* reset chip */

Definition at line 85 of file sonicvibes.c.

#define SV_REVERB   0x04 /* reverb enable */

Definition at line 82 of file sonicvibes.c.

#define SV_SPEC_IRQ   0x08 /* special interrupt */

Definition at line 95 of file sonicvibes.c.

#define SV_SPEC_MASK   0x08 /* special interrupt mask - should be always masked */

Definition at line 89 of file sonicvibes.c.

#define SV_TEST   0x02 /* test bit */

Definition at line 81 of file sonicvibes.c.

#define SV_TRD   0x80 /* DMA transfer request disabled */

Definition at line 100 of file sonicvibes.c.

#define SV_UD_IRQ   0x40 /* Up/Down interrupt */

Definition at line 96 of file sonicvibes.c.

#define SV_UD_MASK   0x40 /* Up/Down button interrupt mask */

Definition at line 90 of file sonicvibes.c.

#define SV_WAVETABLE   0x08 /* wavetable active / FM active if not set */

Definition at line 83 of file sonicvibes.c.

Function Documentation

MODULE_AUTHOR ( "Jaroslav Kysela <[email protected]>"  )
MODULE_DESCRIPTION ( "S3 SonicVibes PCI )
MODULE_DEVICE_TABLE ( pci  ,
snd_sonic_ids   
)
MODULE_LICENSE ( "GPL"  )
module_param ( dmaio  ,
uint  ,
0444   
)
module_param_array ( index  ,
int  ,
NULL  ,
0444   
)
module_param_array ( id  ,
charp  ,
NULL  ,
0444   
)
module_param_array ( enable  ,
bool  ,
NULL  ,
0444   
)
module_param_array ( reverb  ,
bool  ,
NULL  ,
0444   
)
module_param_array ( mge  ,
bool  ,
NULL  ,
0444   
)
MODULE_PARM_DESC ( index  ,
"Index value for S3 SonicVibes soundcard."   
)
MODULE_PARM_DESC ( id  ,
"ID string for S3 SonicVibes soundcard."   
)
MODULE_PARM_DESC ( enable  ,
"Enable S3 SonicVibes soundcard."   
)
MODULE_PARM_DESC ( reverb  ,
"Enable reverb (SRAM is present) for S3 SonicVibes soundcard."   
)
MODULE_PARM_DESC ( mge  ,
"MIC Gain Enable for S3 SonicVibes soundcard."   
)
MODULE_PARM_DESC ( dmaio  ,
"DDMA i/o base address for S3 SonicVibes soundcard."   
)
module_pci_driver ( sonicvibes_driver  )
MODULE_SUPPORTED_DEVICE ( "{{S3,SonicVibes PCI}}"  )