X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Fau88x0%2Fau88x0.h;h=5ccf0b1ec670f7ed27baecc1f96ece3a9c11c335;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=2ab68cfb614883f0dfa8dc039b5173dc18e4ec1c;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h index 2ab68cfb6..5ccf0b1ec 100644 --- a/sound/pci/au88x0/au88x0.h +++ b/sound/pci/au88x0/au88x0.h @@ -17,8 +17,8 @@ #ifndef __SOUND_AU88X0_H #define __SOUND_AU88X0_H +#ifdef __KERNEL__ #include -#include #include #include #include @@ -28,6 +28,8 @@ #include #include +#endif + #ifndef CHIP_AU8820 #include "au88x0_eq.h" #include "au88x0_a3d.h" @@ -36,10 +38,8 @@ #include "au88x0_wt.h" #endif -#define VORTEX_DMA_MASK 0xffffffff - -#define hwread(x,y) readl((x)+((y)>>2)) -#define hwwrite(x,y,z) writel((z),(x)+((y)>>2)) +#define hwread(x,y) readl((x)+(y)) +#define hwwrite(x,y,z) writel((z),(x)+(y)) /* Vortex MPU401 defines. */ #define MIDI_CLOCK_DIV 0x61 @@ -69,20 +69,28 @@ #define IRQ_MODEM 0x4000 /* ADB Resource */ -#define VORTEX_RESOURCE_DMA 0x00000000 -#define VORTEX_RESOURCE_SRC 0x00000001 +#define VORTEX_RESOURCE_DMA 0x00000000 +#define VORTEX_RESOURCE_SRC 0x00000001 #define VORTEX_RESOURCE_MIXIN 0x00000002 #define VORTEX_RESOURCE_MIXOUT 0x00000003 -#define VORTEX_RESOURCE_A3D 0x00000004 +#define VORTEX_RESOURCE_A3D 0x00000004 #define VORTEX_RESOURCE_LAST 0x00000005 +/* codec io: VORTEX_CODEC_IO bits */ +#define VORTEX_CODEC_ID_SHIFT 24 +#define VORTEX_CODEC_WRITE 0x00800000 +#define VORTEX_CODEC_ADDSHIFT 16 +#define VORTEX_CODEC_ADDMASK 0x7f0000 +#define VORTEX_CODEC_DATSHIFT 0 +#define VORTEX_CODEC_DATMASK 0xffff + /* Check for SDAC bit in "Extended audio ID" AC97 register */ -#define VORTEX_IS_QUAD(x) ((x->codec == NULL) ? 0 : (x->codec->ext_id|0x80)) +//#define VORTEX_IS_QUAD(x) (((x)->codec == NULL) ? 0 : ((x)->codec->ext_id&0x80)) +#define VORTEX_IS_QUAD(x) ((x)->isquad) /* Check if chip has bug. */ #define IS_BAD_CHIP(x) (\ - (x->rev < 3 && x->device == PCI_DEVICE_ID_AUREAL_VORTEX) || \ - (x->rev < 0xfe && x->device == PCI_DEVICE_ID_AUREAL_VORTEX2) || \ - (x->rev < 0xfe && x->device == PCI_DEVICE_ID_AUREAL_ADVANTAGE)) + (x->rev == 0xfe && x->device == PCI_DEVICE_ID_AUREAL_VORTEX_2) || \ + (x->rev == 0xfe && x->device == PCI_DEVICE_ID_AUREAL_ADVANTAGE)) /* PCM devices */ @@ -104,7 +112,7 @@ typedef struct { //int this_08; /* Still unknown */ int fifo_enabled; /* this_24 */ int fifo_status; /* this_1c */ - int dma_ctrl; /* this_78 (ADB), this_7c (WT) */ + u32 dma_ctrl; /* this_78 (ADB), this_7c (WT) */ int dma_unknown; /* this_74 (ADB), this_78 (WT). WDM: +8 */ int cfg0; int cfg1; @@ -118,21 +126,21 @@ typedef struct { /* Virtual page extender stuff */ int nr_periods; int period_bytes; - snd_pcm_sgbuf_t *sgbuf; /* DMA Scatter Gather struct */ + struct snd_sg_buf *sgbuf; /* DMA Scatter Gather struct */ int period_real; int period_virt; - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; } stream_t; typedef struct snd_vortex vortex_t; struct snd_vortex { /* ALSA structs. */ - snd_card_t *card; - snd_pcm_t *pcm[VORTEX_PCM_LAST]; + struct snd_card *card; + struct snd_pcm *pcm[VORTEX_PCM_LAST]; - snd_rawmidi_t *rmidi; /* Legacy Midi interface. */ - ac97_t *codec; + struct snd_rawmidi *rmidi; /* Legacy Midi interface. */ + struct snd_ac97 *codec; /* Stream structs. */ stream_t dma_adb[NR_ADB]; @@ -144,12 +152,12 @@ struct snd_vortex { #endif /* Global resources */ - char mixcapt[2]; - char mixplayb[4]; + s8 mixcapt[2]; + s8 mixplayb[4]; #ifndef CHIP_AU8820 - char mixspdif[2]; - char mixa3d[2]; /* mixers which collect all a3d streams. */ - char mixxtlk[2]; /* crosstalk canceler mixer inputs. */ + s8 mixspdif[2]; + s8 mixa3d[2]; /* mixers which collect all a3d streams. */ + s8 mixxtlk[2]; /* crosstalk canceler mixer inputs. */ #endif u32 fixed_res[5]; @@ -162,12 +170,14 @@ struct snd_vortex { int xt_mode; /* 1: speakers, 0:headphones. */ #endif + int isquad; /* cache of extended ID codec flag. */ + /* Gameport stuff. */ struct gameport *gameport; /* PCI hardware resources */ unsigned long io; - unsigned long *mmio; + void __iomem *mmio; unsigned int irq; spinlock_t lock; @@ -178,8 +188,6 @@ struct snd_vortex { u8 rev; }; -#define chip_t vortex_t - /* Functions. */ /* SRC */ @@ -188,18 +196,18 @@ static void vortex_adb_setsrc(vortex_t * vortex, int adbdma, /* DMA Engines. */ static void vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma, - snd_pcm_sgbuf_t * sgbuf, int size, + struct snd_sg_buf * sgbuf, int size, int count); static void vortex_adbdma_setmode(vortex_t * vortex, int adbdma, int ie, int dir, int fmt, int d, - unsigned long offset); + u32 offset); static void vortex_adbdma_setstartbuffer(vortex_t * vortex, int adbdma, int sb); #ifndef CHIP_AU8810 static void vortex_wtdma_setbuffers(vortex_t * vortex, int wtdma, - snd_pcm_sgbuf_t * sgbuf, int size, + struct snd_sg_buf * sgbuf, int size, int count); static void vortex_wtdma_setmode(vortex_t * vortex, int wtdma, int ie, int fmt, int d, /*int e, */ - unsigned long offset); + u32 offset); static void vortex_wtdma_setstartbuffer(vortex_t * vortex, int wtdma, int sb); #endif @@ -208,6 +216,7 @@ static void vortex_adbdma_startfifo(vortex_t * vortex, int adbdma); static void vortex_adbdma_pausefifo(vortex_t * vortex, int adbdma); static void vortex_adbdma_resumefifo(vortex_t * vortex, int adbdma); static int inline vortex_adbdma_getlinearpos(vortex_t * vortex, int adbdma); +static void vortex_adbdma_resetup(vortex_t *vortex, int adbdma); #ifndef CHIP_AU8810 static void vortex_wtdma_startfifo(vortex_t * vortex, int wtdma); @@ -219,16 +228,15 @@ static int inline vortex_wtdma_getlinearpos(vortex_t * vortex, int wtdma); /* global stuff. */ static void vortex_codec_init(vortex_t * vortex); -static void vortex_codec_write(ac97_t * codec, unsigned short addr, +static void vortex_codec_write(struct snd_ac97 * codec, unsigned short addr, unsigned short data); -static unsigned short vortex_codec_read(ac97_t * codec, unsigned short addr); +static unsigned short vortex_codec_read(struct snd_ac97 * codec, unsigned short addr); static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode); static int vortex_core_init(vortex_t * card); static int vortex_core_shutdown(vortex_t * card); static void vortex_enable_int(vortex_t * card); -static irqreturn_t vortex_interrupt(int irq, void *dev_id, - struct pt_regs *regs); +static irqreturn_t vortex_interrupt(int irq, void *dev_id); static int vortex_alsafmt_aspfmt(int alsafmt); /* Connection stuff. */ @@ -261,20 +269,21 @@ static void vortex_mix_setvolumebyte(vortex_t * vortex, unsigned char mix, /* A3D functions. */ #ifndef CHIP_AU8820 -static void vortex_Vort3D(vortex_t * v, int en); +static void vortex_Vort3D_enable(vortex_t * v); +static void vortex_Vort3D_disable(vortex_t * v); static void vortex_Vort3D_connect(vortex_t * vortex, int en); static void vortex_Vort3D_InitializeSource(a3dsrc_t * a, int en); #endif /* Driver stuff. */ -static int __devinit vortex_gameport_register(vortex_t * card); -static int __devexit vortex_gameport_unregister(vortex_t * card); +static int vortex_gameport_register(vortex_t * card); +static void vortex_gameport_unregister(vortex_t * card); #ifndef CHIP_AU8820 -static int __devinit vortex_eq_init(vortex_t * vortex); -static int __devexit vortex_eq_free(vortex_t * vortex); +static int vortex_eq_init(vortex_t * vortex); +static int vortex_eq_free(vortex_t * vortex); #endif /* ALSA stuff. */ -static int __devinit snd_vortex_new_pcm(vortex_t * vortex, int idx, int nr); -static int __devinit snd_vortex_mixer(vortex_t * vortex); -static int __devinit snd_vortex_midi(vortex_t * vortex); +static int snd_vortex_new_pcm(vortex_t * vortex, int idx, int nr); +static int snd_vortex_mixer(vortex_t * vortex); +static int snd_vortex_midi(vortex_t * vortex); #endif