/*
*/
-typedef struct snd_azx azx_t;
-typedef struct snd_azx_rb azx_rb_t;
-typedef struct snd_azx_dev azx_dev_t;
-
-struct snd_azx_dev {
+struct azx_dev {
u32 *bdl; /* virtual address of the BDL */
dma_addr_t bdl_addr; /* physical address of the BDL */
volatile u32 *posbuf; /* position buffer pointer */
u32 sd_int_sta_mask; /* stream int status mask */
/* pcm support */
- snd_pcm_substream_t *substream; /* assigned substream, set in PCM open */
+ struct snd_pcm_substream *substream; /* assigned substream, set in PCM open */
unsigned int format_val; /* format value to be set in the controller and the codec */
unsigned char stream_tag; /* assigned stream */
unsigned char index; /* stream index */
};
/* CORB/RIRB */
-struct snd_azx_rb {
+struct azx_rb {
u32 *buf; /* CORB/RIRB buffer
* Each CORB entry is 4byte, RIRB is 8byte
*/
u32 res; /* last read value */
};
-struct snd_azx {
- snd_card_t *card;
+struct azx {
+ struct snd_card *card;
struct pci_dev *pci;
/* chip type specific */
struct semaphore open_mutex;
/* streams (x num_streams) */
- azx_dev_t *azx_dev;
+ struct azx_dev *azx_dev;
/* PCM */
unsigned int pcm_devs;
- snd_pcm_t *pcm[AZX_MAX_PCMS];
+ struct snd_pcm *pcm[AZX_MAX_PCMS];
/* HD codec */
unsigned short codec_mask;
struct hda_bus *bus;
/* CORB/RIRB */
- azx_rb_t corb;
- azx_rb_t rirb;
+ struct azx_rb corb;
+ struct azx_rb rirb;
/* BDL, CORB/RIRB and position buffers */
struct snd_dma_buffer bdl;
readb((dev)->sd_addr + ICH6_REG_##reg)
/* for pcm support */
-#define get_azx_dev(substream) (azx_dev_t*)(substream->runtime->private_data)
+#define get_azx_dev(substream) (substream->runtime->private_data)
/* Get the upper 32bit of the given dma_addr_t
* Compiler should optimize and eliminate the code if dma_addr_t is 32bit
/*
* CORB / RIRB interface
*/
-static int azx_alloc_cmd_io(azx_t *chip)
+static int azx_alloc_cmd_io(struct azx *chip)
{
int err;
return 0;
}
-static void azx_init_cmd_io(azx_t *chip)
+static void azx_init_cmd_io(struct azx *chip)
{
/* CORB set up */
chip->corb.addr = chip->rb.addr;
chip->rirb.rp = chip->rirb.cmds = 0;
}
-static void azx_free_cmd_io(azx_t *chip)
+static void azx_free_cmd_io(struct azx *chip)
{
/* disable ringbuffer DMAs */
azx_writeb(chip, RIRBCTL, 0);
static int azx_send_cmd(struct hda_codec *codec, hda_nid_t nid, int direct,
unsigned int verb, unsigned int para)
{
- azx_t *chip = codec->bus->private_data;
+ struct azx *chip = codec->bus->private_data;
unsigned int wp;
u32 val;
#define ICH6_RIRB_EX_UNSOL_EV (1<<4)
/* retrieve RIRB entry - called from interrupt handler */
-static void azx_update_rirb(azx_t *chip)
+static void azx_update_rirb(struct azx *chip)
{
unsigned int rp, wp;
u32 res, res_ex;
/* receive a response */
static unsigned int azx_get_response(struct hda_codec *codec)
{
- azx_t *chip = codec->bus->private_data;
+ struct azx *chip = codec->bus->private_data;
int timeout = 50;
while (chip->rirb.cmds) {
static int azx_send_cmd(struct hda_codec *codec, hda_nid_t nid, int direct,
unsigned int verb, unsigned int para)
{
- azx_t *chip = codec->bus->private_data;
+ struct azx *chip = codec->bus->private_data;
u32 val;
int timeout = 50;
/* receive a response */
static unsigned int azx_get_response(struct hda_codec *codec)
{
- azx_t *chip = codec->bus->private_data;
+ struct azx *chip = codec->bus->private_data;
int timeout = 50;
while (timeout--) {
#endif /* USE_CORB_RIRB */
/* reset codec link */
-static int azx_reset(azx_t *chip)
+static int azx_reset(struct azx *chip)
{
int count;
*/
/* enable interrupts */
-static void azx_int_enable(azx_t *chip)
+static void azx_int_enable(struct azx *chip)
{
/* enable controller CIE and GIE */
azx_writel(chip, INTCTL, azx_readl(chip, INTCTL) |
}
/* disable interrupts */
-static void azx_int_disable(azx_t *chip)
+static void azx_int_disable(struct azx *chip)
{
int i;
/* disable interrupts in stream descriptor */
for (i = 0; i < chip->num_streams; i++) {
- azx_dev_t *azx_dev = &chip->azx_dev[i];
+ struct azx_dev *azx_dev = &chip->azx_dev[i];
azx_sd_writeb(azx_dev, SD_CTL,
azx_sd_readb(azx_dev, SD_CTL) & ~SD_INT_MASK);
}
}
/* clear interrupts */
-static void azx_int_clear(azx_t *chip)
+static void azx_int_clear(struct azx *chip)
{
int i;
/* clear stream status */
for (i = 0; i < chip->num_streams; i++) {
- azx_dev_t *azx_dev = &chip->azx_dev[i];
+ struct azx_dev *azx_dev = &chip->azx_dev[i];
azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
}
}
/* start a stream */
-static void azx_stream_start(azx_t *chip, azx_dev_t *azx_dev)
+static void azx_stream_start(struct azx *chip, struct azx_dev *azx_dev)
{
/* enable SIE */
azx_writeb(chip, INTCTL,
}
/* stop a stream */
-static void azx_stream_stop(azx_t *chip, azx_dev_t *azx_dev)
+static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev)
{
/* stop DMA */
azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) &
/*
* initialize the chip
*/
-static void azx_init_chip(azx_t *chip)
+static void azx_init_chip(struct azx *chip)
{
unsigned char reg;
*/
static irqreturn_t azx_interrupt(int irq, void* dev_id, struct pt_regs *regs)
{
- azx_t *chip = dev_id;
- azx_dev_t *azx_dev;
+ struct azx *chip = dev_id;
+ struct azx_dev *azx_dev;
u32 status;
int i;
/*
* set up BDL entries
*/
-static void azx_setup_periods(azx_dev_t *azx_dev)
+static void azx_setup_periods(struct azx_dev *azx_dev)
{
u32 *bdl = azx_dev->bdl;
dma_addr_t dma_addr = azx_dev->substream->runtime->dma_addr;
/*
* set up the SD for streaming
*/
-static int azx_setup_controller(azx_t *chip, azx_dev_t *azx_dev)
+static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
{
unsigned char val;
int timeout;
* Codec initialization
*/
-static int __devinit azx_codec_create(azx_t *chip, const char *model)
+static int __devinit azx_codec_create(struct azx *chip, const char *model)
{
struct hda_bus_template bus_temp;
int c, codecs, err;
*/
/* assign a stream for the PCM */
-static inline azx_dev_t *azx_assign_device(azx_t *chip, int stream)
+static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream)
{
int dev, i, nums;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
}
/* release the assigned stream */
-static inline void azx_release_device(azx_dev_t *azx_dev)
+static inline void azx_release_device(struct azx_dev *azx_dev)
{
azx_dev->opened = 0;
}
-static snd_pcm_hardware_t azx_pcm_hw = {
+static struct snd_pcm_hardware azx_pcm_hw = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID |
};
struct azx_pcm {
- azx_t *chip;
+ struct azx *chip;
struct hda_codec *codec;
struct hda_pcm_stream *hinfo[2];
};
-static int azx_pcm_open(snd_pcm_substream_t *substream)
+static int azx_pcm_open(struct snd_pcm_substream *substream)
{
struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
- azx_t *chip = apcm->chip;
- azx_dev_t *azx_dev;
- snd_pcm_runtime_t *runtime = substream->runtime;
+ struct azx *chip = apcm->chip;
+ struct azx_dev *azx_dev;
+ struct snd_pcm_runtime *runtime = substream->runtime;
unsigned long flags;
int err;
return 0;
}
-static int azx_pcm_close(snd_pcm_substream_t *substream)
+static int azx_pcm_close(struct snd_pcm_substream *substream)
{
struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
- azx_t *chip = apcm->chip;
- azx_dev_t *azx_dev = get_azx_dev(substream);
+ struct azx *chip = apcm->chip;
+ struct azx_dev *azx_dev = get_azx_dev(substream);
unsigned long flags;
down(&chip->open_mutex);
return 0;
}
-static int azx_pcm_hw_params(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *hw_params)
+static int azx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params)
{
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
}
-static int azx_pcm_hw_free(snd_pcm_substream_t *substream)
+static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
- azx_dev_t *azx_dev = get_azx_dev(substream);
+ struct azx_dev *azx_dev = get_azx_dev(substream);
struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
/* reset BDL address */
return snd_pcm_lib_free_pages(substream);
}
-static int azx_pcm_prepare(snd_pcm_substream_t *substream)
+static int azx_pcm_prepare(struct snd_pcm_substream *substream)
{
struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
- azx_t *chip = apcm->chip;
- azx_dev_t *azx_dev = get_azx_dev(substream);
+ struct azx *chip = apcm->chip;
+ struct azx_dev *azx_dev = get_azx_dev(substream);
struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
- snd_pcm_runtime_t *runtime = substream->runtime;
+ struct snd_pcm_runtime *runtime = substream->runtime;
azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream);
azx_dev->fragsize = snd_pcm_lib_period_bytes(substream);
azx_dev->format_val, substream);
}
-static int azx_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
+static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
- azx_dev_t *azx_dev = get_azx_dev(substream);
- azx_t *chip = apcm->chip;
+ struct azx_dev *azx_dev = get_azx_dev(substream);
+ struct azx *chip = apcm->chip;
int err = 0;
spin_lock(&chip->reg_lock);
return err;
}
-static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream)
+static snd_pcm_uframes_t azx_pcm_pointer(struct snd_pcm_substream *substream)
{
struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
- azx_t *chip = apcm->chip;
- azx_dev_t *azx_dev = get_azx_dev(substream);
+ struct azx *chip = apcm->chip;
+ struct azx_dev *azx_dev = get_azx_dev(substream);
unsigned int pos;
if (chip->position_fix == POS_FIX_POSBUF) {
return bytes_to_frames(substream->runtime, pos);
}
-static snd_pcm_ops_t azx_pcm_ops = {
+static struct snd_pcm_ops azx_pcm_ops = {
.open = azx_pcm_open,
.close = azx_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
.pointer = azx_pcm_pointer,
};
-static void azx_pcm_free(snd_pcm_t *pcm)
+static void azx_pcm_free(struct snd_pcm *pcm)
{
kfree(pcm->private_data);
}
-static int __devinit create_codec_pcm(azx_t *chip, struct hda_codec *codec,
+static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec,
struct hda_pcm *cpcm, int pcm_dev)
{
int err;
- snd_pcm_t *pcm;
+ struct snd_pcm *pcm;
struct azx_pcm *apcm;
snd_assert(cpcm->stream[0].substreams || cpcm->stream[1].substreams, return -EINVAL);
return 0;
}
-static int __devinit azx_pcm_create(azx_t *chip)
+static int __devinit azx_pcm_create(struct azx *chip)
{
struct list_head *p;
struct hda_codec *codec;
/*
* mixer creation - all stuff is implemented in hda module
*/
-static int __devinit azx_mixer_create(azx_t *chip)
+static int __devinit azx_mixer_create(struct azx *chip)
{
return snd_hda_build_controls(chip->bus);
}
/*
* initialize SD streams
*/
-static int __devinit azx_init_stream(azx_t *chip)
+static int __devinit azx_init_stream(struct azx *chip)
{
int i;
*/
for (i = 0; i < chip->num_streams; i++) {
unsigned int off = sizeof(u32) * (i * AZX_MAX_FRAG * 4);
- azx_dev_t *azx_dev = &chip->azx_dev[i];
+ struct azx_dev *azx_dev = &chip->azx_dev[i];
azx_dev->bdl = (u32 *)(chip->bdl.area + off);
azx_dev->bdl_addr = chip->bdl.addr + off;
azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
/*
* power management
*/
-static int azx_suspend(snd_card_t *card, pm_message_t state)
+static int azx_suspend(struct snd_card *card, pm_message_t state)
{
- azx_t *chip = card->pm_private_data;
+ struct azx *chip = card->pm_private_data;
int i;
for (i = 0; i < chip->pcm_devs; i++)
return 0;
}
-static int azx_resume(snd_card_t *card)
+static int azx_resume(struct snd_card *card)
{
- azx_t *chip = card->pm_private_data;
+ struct azx *chip = card->pm_private_data;
pci_enable_device(chip->pci);
pci_set_master(chip->pci);
/*
* destructor
*/
-static int azx_free(azx_t *chip)
+static int azx_free(struct azx *chip)
{
if (chip->initialized) {
int i;
return 0;
}
-static int azx_dev_free(snd_device_t *device)
+static int azx_dev_free(struct snd_device *device)
{
return azx_free(device->device_data);
}
/*
* constructor
*/
-static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
+static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
int posfix, int driver_type,
- azx_t **rchip)
+ struct azx **rchip)
{
- azx_t *chip;
+ struct azx *chip;
int err = 0;
- static snd_device_ops_t ops = {
+ static struct snd_device_ops ops = {
.dev_free = azx_dev_free,
};
static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
{
- snd_card_t *card;
- azx_t *chip;
+ struct snd_card *card;
+ struct azx *chip;
int err = 0;
card = snd_card_new(index, id, THIS_MODULE, 0);