#ifndef __SOUND_AU88X0_H
#define __SOUND_AU88X0_H
+#ifdef __KERNEL__
#include <sound/driver.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <sound/hwdep.h>
#include <sound/ac97_codec.h>
+#endif
+
#ifndef CHIP_AU8820
#include "au88x0_eq.h"
#include "au88x0_a3d.h"
#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 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 */
/* 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];
#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];
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;
+ unsigned long __iomem *mmio;
unsigned int irq;
spinlock_t lock;
u8 rev;
};
-#define chip_t vortex_t
-
/* Functions. */
/* SRC */
/* 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,
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);
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);
/* 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);
/* Driver stuff. */
static int __devinit vortex_gameport_register(vortex_t * card);
-static int __devexit vortex_gameport_unregister(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);