24 |
#include <linux/init.h> |
#include <linux/init.h> |
25 |
#include "au88x0_eq.h" |
#include "au88x0_eq.h" |
26 |
|
|
|
#define vortex_t_magic 0x12345678 |
|
|
|
|
27 |
/* |
/* |
28 |
#ifndef PCI_VENDOR_ID_AUREAL |
#ifndef PCI_VENDOR_ID_AUREAL |
29 |
#define PCI_VENDOR_ID_AUREAL 0x12eb |
#define PCI_VENDOR_ID_AUREAL 0x12eb |
52 |
#define MPU401_ENTER_UART 0x3f |
#define MPU401_ENTER_UART 0x3f |
53 |
#define MPU401_ACK 0xfe |
#define MPU401_ACK 0xfe |
54 |
|
|
55 |
#define SRC_RATIO(x) ((((x<<15)/48000) + 1)/2) |
// Get src register value to convert from x to y. |
56 |
#define SRC_RATIO2(x) ((((48000<<15)/x) + 1)/2) |
#define SRC_RATIO(x,y) ((((x<<15)/y) + 1)/2) |
|
|
|
57 |
|
|
58 |
/* FIFO software state constants. */ |
/* FIFO software state constants. */ |
59 |
#define FIFO_STOP 0 |
#define FIFO_STOP 0 |
68 |
#define VORTEX_RESOURCE_A3D 0x00000004 |
#define VORTEX_RESOURCE_A3D 0x00000004 |
69 |
#define VORTEX_RESOURCE_LAST 0x00000005 |
#define VORTEX_RESOURCE_LAST 0x00000005 |
70 |
|
|
71 |
|
/* Check for SDAC bit in "Extended audio ID" AC97 register */ |
72 |
|
#define VORTEX_IS_QUAD(x) ((x->codec == NULL) ? 0 : (x->codec->ext_id|0x80)) |
73 |
|
|
74 |
|
/* PCM devices */ |
75 |
|
#define VORTEX_PCM_ADB 0 |
76 |
|
#define VORTEX_PCM_SPDIF 1 |
77 |
|
#define VORTEX_PCM_I2S 2 |
78 |
|
#define VORTEX_PCM_A3D 3 |
79 |
|
#define VORTEX_PCM_WT 4 |
80 |
|
#define VORTEX_PCM_LAST 5 |
81 |
|
|
82 |
#define MIX_CAPT(x) (vortex->mixcapt[x]) |
#define MIX_CAPT(x) (vortex->mixcapt[x]) |
83 |
#define MIX_PLAYB(x) (vortex->mixplayb[x]) |
#define MIX_PLAYB(x) (vortex->mixplayb[x]) |
84 |
#define VORTEX_IS_QUAD(x) ((x->codec == NULL) ? 0 : (x->codec->ext_id|0x80)) |
#define MIX_SPDIF(x) (vortex->mixspdif[x]) |
|
/* Structs */ |
|
85 |
|
|
86 |
|
/* Structs */ |
87 |
typedef struct { |
typedef struct { |
88 |
int fifo_enabled; /* this_24 */ |
int fifo_enabled; /* this_24 */ |
89 |
int fifo_status; /* this_1c */ |
int fifo_status; /* this_1c */ |
93 |
int cfg1; |
int cfg1; |
94 |
|
|
95 |
int nr_ch; /* Nr of PCM channels */ |
int nr_ch; /* Nr of PCM channels */ |
96 |
int dma; /* Hardware Stream index. */ |
int type; /* Output type (ac97, spdif, i2s, dsp)*/ |
97 |
|
int dma; /* Hardware DMA index. */ |
98 |
int dir; /* Stream Direction. */ |
int dir; /* Stream Direction. */ |
99 |
u32 resources[5]; |
u32 resources[5]; |
100 |
|
|
112 |
struct snd_vortex { |
struct snd_vortex { |
113 |
/* ALSA structs. */ |
/* ALSA structs. */ |
114 |
snd_card_t *card; |
snd_card_t *card; |
115 |
snd_pcm_t *pcm_adb; |
snd_pcm_t *pcm[VORTEX_PCM_LAST]; |
116 |
snd_pcm_t *pcm_wt; |
|
117 |
snd_rawmidi_t *rmidi; /* Legacy Midi interface. */ |
snd_rawmidi_t *rmidi; /* Legacy Midi interface. */ |
118 |
ac97_t *codec; |
ac97_t *codec; |
119 |
|
|
120 |
/* Stream structs. */ |
/* Stream structs. */ |
121 |
stream_t dma_adb[NR_ADB]; |
stream_t dma_adb[NR_ADB]; |
122 |
|
int spdif_sr; |
123 |
#ifndef CHIP_AU8810 |
#ifndef CHIP_AU8810 |
124 |
stream_t dma_wt[NR_WT]; |
stream_t dma_wt[NR_WT]; |
125 |
unsigned char mixwt[6]; /* WT mixin objects */ |
unsigned char mixwt[6]; /* WT mixin objects */ |
127 |
/* Global resources */ |
/* Global resources */ |
128 |
unsigned char mixcapt[2]; |
unsigned char mixcapt[2]; |
129 |
unsigned char mixplayb[4]; |
unsigned char mixplayb[4]; |
130 |
|
unsigned char mixspdif[2]; |
131 |
u32 fixed_res[5]; |
u32 fixed_res[5]; |
132 |
|
|
133 |
/* Hardware equalizer structs */ |
/* Hardware equalizer structs */ |
134 |
eqlzr_t eq; |
eqlzr_t eq; |
135 |
snd_kcontrol_t *eqctrl[20]; |
|
136 |
snd_kcontrol_t *eqlvs[20]; |
/* Extra controls */ |
137 |
|
//snd_kcontrol_t *eqctrl[20]; |
138 |
|
|
139 |
/* Gameport stuff. */ |
/* Gameport stuff. */ |
140 |
struct gameport *gameport; |
struct gameport *gameport; |
183 |
void vortex_codec_init(vortex_t *vortex); |
void vortex_codec_init(vortex_t *vortex); |
184 |
void vortex_codec_write(ac97_t *codec, unsigned short addr,unsigned short data); |
void vortex_codec_write(ac97_t *codec, unsigned short addr,unsigned short data); |
185 |
unsigned short vortex_codec_read(ac97_t *codec, unsigned short addr); |
unsigned short vortex_codec_read(ac97_t *codec, unsigned short addr); |
186 |
|
void vortex_spdif_init(vortex_t *vortex, int spdif_sr, int spdif_mode); |
187 |
|
|
188 |
int vortex_core_init(vortex_t *card); |
int vortex_core_init(vortex_t *card); |
189 |
int vortex_core_shutdown(vortex_t *card); |
int vortex_core_shutdown(vortex_t *card); |
193 |
|
|
194 |
/* Connection stuff. */ |
/* Connection stuff. */ |
195 |
void vortex_connect_default(vortex_t *vortex, int en); |
void vortex_connect_default(vortex_t *vortex, int en); |
196 |
int vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir); |
int vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir, int type); |
197 |
int vortex_wt_allocroute(vortex_t *vortex, int dma, int nr_ch); |
int vortex_wt_allocroute(vortex_t *vortex, int dma, int nr_ch); |
198 |
int vortex_adb_checkinout(vortex_t *vortex, int resmap[], int out, int restype); |
int vortex_adb_checkinout(vortex_t *vortex, int resmap[], int out, int restype); |
199 |
void vortex_connect_wt(vortex_t *vortex, int en, unsigned char mixers[]); |
void vortex_wt_connect(vortex_t *vortex, int en, unsigned char mixers[]); |
200 |
void vortex_InitializeWTRegs(vortex_t * vortex); |
void vortex_wt_InitializeWTRegs(vortex_t * vortex); |
201 |
|
|
202 |
/* Driver stuff. */ |
/* Driver stuff. */ |
203 |
int __devinit vortex_gameport_register(vortex_t *card); |
int __devinit vortex_gameport_register(vortex_t *card); |