aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound/pci/atiixp.c295
-rw-r--r--sound/pci/atiixp_modem.c259
2 files changed, 295 insertions, 259 deletions
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 36395d0f3d8..5ead66610ed 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -197,24 +197,18 @@ module_param(enable, bool, 0444);
#define ATI_MAX_DESCRIPTORS 256 /* max number of descriptor packets */
-/*
- */
-
-typedef struct snd_atiixp atiixp_t;
-typedef struct snd_atiixp_dma atiixp_dma_t;
-typedef struct snd_atiixp_dma_ops atiixp_dma_ops_t;
-
+struct atiixp;
/*
* DMA packate descriptor
*/
-typedef struct atiixp_dma_desc {
+struct atiixp_dma_desc {
u32 addr; /* DMA buffer address */
u16 status; /* status bits */
u16 size; /* size of the packet in dwords */
u32 next; /* address of the next packet descriptor */
-} atiixp_dma_desc_t;
+};
/*
* stream enum
@@ -229,22 +223,25 @@ enum { ATI_PCMDEV_ANALOG, ATI_PCMDEV_DIGITAL, NUM_ATI_PCMDEVS }; /* pcm devices
/*
* constants and callbacks for each DMA type
*/
-struct snd_atiixp_dma_ops {
+struct atiixp_dma_ops {
int type; /* ATI_DMA_XXX */
unsigned int llp_offset; /* LINKPTR offset */
unsigned int dt_cur; /* DT_CUR offset */
- void (*enable_dma)(atiixp_t *chip, int on); /* called from open callback */
- void (*enable_transfer)(atiixp_t *chip, int on); /* called from trigger (START/STOP) */
- void (*flush_dma)(atiixp_t *chip); /* called from trigger (STOP only) */
+ /* called from open callback */
+ void (*enable_dma)(struct atiixp *chip, int on);
+ /* called from trigger (START/STOP) */
+ void (*enable_transfer)(struct atiixp *chip, int on);
+ /* called from trigger (STOP only) */
+ void (*flush_dma)(struct atiixp *chip);
};
/*
* DMA stream
*/
-struct snd_atiixp_dma {
- const atiixp_dma_ops_t *ops;
+struct atiixp_dma {
+ const struct atiixp_dma_ops *ops;
struct snd_dma_buffer desc_buf;
- snd_pcm_substream_t *substream; /* assigned PCM substream */
+ struct snd_pcm_substream *substream; /* assigned PCM substream */
unsigned int buf_addr, buf_bytes; /* DMA buffer address, bytes */
unsigned int period_bytes, periods;
int opened;
@@ -258,22 +255,22 @@ struct snd_atiixp_dma {
/*
* ATI IXP chip
*/
-struct snd_atiixp {
- snd_card_t *card;
+struct atiixp {
+ struct snd_card *card;
struct pci_dev *pci;
unsigned long addr;
void __iomem *remap_addr;
int irq;
- ac97_bus_t *ac97_bus;
- ac97_t *ac97[NUM_ATI_CODECS];
+ struct snd_ac97_bus *ac97_bus;
+ struct snd_ac97 *ac97[NUM_ATI_CODECS];
spinlock_t reg_lock;
- atiixp_dma_t dmas[NUM_ATI_DMAS];
+ struct atiixp_dma dmas[NUM_ATI_DMAS];
struct ac97_pcm *pcms[NUM_ATI_PCMS];
- snd_pcm_t *pcmdevs[NUM_ATI_PCMDEVS];
+ struct snd_pcm *pcmdevs[NUM_ATI_PCMDEVS];
int max_channels; /* max. channels for PCM out */
@@ -304,7 +301,7 @@ MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
* update the bits of the given register.
* return 1 if the bits changed.
*/
-static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
+static int snd_atiixp_update_bits(struct atiixp *chip, unsigned int reg,
unsigned int mask, unsigned int value)
{
void __iomem *addr = chip->remap_addr + reg;
@@ -336,7 +333,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
*/
#define ATI_DESC_LIST_SIZE \
- PAGE_ALIGN(ATI_MAX_DESCRIPTORS * sizeof(atiixp_dma_desc_t))
+ PAGE_ALIGN(ATI_MAX_DESCRIPTORS * sizeof(struct atiixp_dma_desc))
/*
* build packets ring for the given buffer size.
@@ -347,10 +344,10 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
*
* the ring is built in this function, and is set up to the hardware.
*/
-static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
- snd_pcm_substream_t *substream,
- unsigned int periods,
- unsigned int period_bytes)
+static int atiixp_build_dma_packets(struct atiixp *chip, struct atiixp_dma *dma,
+ struct snd_pcm_substream *substream,
+ unsigned int periods,
+ unsigned int period_bytes)
{
unsigned int i;
u32 addr, desc_addr;
@@ -360,8 +357,10 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
return -ENOMEM;
if (dma->desc_buf.area == NULL) {
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
- ATI_DESC_LIST_SIZE, &dma->desc_buf) < 0)
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
+ snd_dma_pci_data(chip->pci),
+ ATI_DESC_LIST_SIZE,
+ &dma->desc_buf) < 0)
return -ENOMEM;
dma->period_bytes = dma->periods = 0; /* clear */
}
@@ -380,11 +379,12 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
addr = (u32)substream->runtime->dma_addr;
desc_addr = (u32)dma->desc_buf.addr;
for (i = 0; i < periods; i++) {
- atiixp_dma_desc_t *desc = &((atiixp_dma_desc_t *)dma->desc_buf.area)[i];
+ struct atiixp_dma_desc *desc;
+ desc = &((struct atiixp_dma_desc *)dma->desc_buf.area)[i];
desc->addr = cpu_to_le32(addr);
desc->status = 0;
desc->size = period_bytes >> 2; /* in dwords */
- desc_addr += sizeof(atiixp_dma_desc_t);
+ desc_addr += sizeof(struct atiixp_dma_desc);
if (i == periods - 1)
desc->next = cpu_to_le32((u32)dma->desc_buf.addr);
else
@@ -404,7 +404,8 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
/*
* remove the ring buffer and release it if assigned
*/
-static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_substream_t *substream)
+static void atiixp_clear_dma_packets(struct atiixp *chip, struct atiixp_dma *dma,
+ struct snd_pcm_substream *substream)
{
if (dma->desc_buf.area) {
writel(0, chip->remap_addr + dma->ops->llp_offset);
@@ -416,7 +417,7 @@ static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_
/*
* AC97 interface
*/
-static int snd_atiixp_acquire_codec(atiixp_t *chip)
+static int snd_atiixp_acquire_codec(struct atiixp *chip)
{
int timeout = 1000;
@@ -430,7 +431,7 @@ static int snd_atiixp_acquire_codec(atiixp_t *chip)
return 0;
}
-static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec, unsigned short reg)
+static unsigned short snd_atiixp_codec_read(struct atiixp *chip, unsigned short codec, unsigned short reg)
{
unsigned int data;
int timeout;
@@ -458,7 +459,8 @@ static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec
}
-static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigned short reg, unsigned short val)
+static void snd_atiixp_codec_write(struct atiixp *chip, unsigned short codec,
+ unsigned short reg, unsigned short val)
{
unsigned int data;
@@ -471,23 +473,25 @@ static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigne
}
-static unsigned short snd_atiixp_ac97_read(ac97_t *ac97, unsigned short reg)
+static unsigned short snd_atiixp_ac97_read(struct snd_ac97 *ac97,
+ unsigned short reg)
{
- atiixp_t *chip = ac97->private_data;
+ struct atiixp *chip = ac97->private_data;
return snd_atiixp_codec_read(chip, ac97->num, reg);
}
-static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
+static void snd_atiixp_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
+ unsigned short val)
{
- atiixp_t *chip = ac97->private_data;
+ struct atiixp *chip = ac97->private_data;
snd_atiixp_codec_write(chip, ac97->num, reg, val);
}
/*
* reset AC link
*/
-static int snd_atiixp_aclink_reset(atiixp_t *chip)
+static int snd_atiixp_aclink_reset(struct atiixp *chip)
{
int timeout;
@@ -507,7 +511,7 @@ static int snd_atiixp_aclink_reset(atiixp_t *chip)
atiixp_update(chip, CMD, ATI_REG_CMD_AC_SYNC|ATI_REG_CMD_AC_RESET,
ATI_REG_CMD_AC_SYNC);
atiixp_read(chip, CMD);
- msleep(1);
+ mdelay(1);
atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET);
if (--timeout) {
snd_printk(KERN_ERR "atiixp: codec reset timeout\n");
@@ -523,7 +527,7 @@ static int snd_atiixp_aclink_reset(atiixp_t *chip)
}
#ifdef CONFIG_PM
-static int snd_atiixp_aclink_down(atiixp_t *chip)
+static int snd_atiixp_aclink_down(struct atiixp *chip)
{
// if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */
// return -EBUSY;
@@ -548,7 +552,7 @@ static int snd_atiixp_aclink_down(atiixp_t *chip)
ATI_REG_ISR_CODEC2_NOT_READY)
#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME)
-static int snd_atiixp_codec_detect(atiixp_t *chip)
+static int snd_atiixp_codec_detect(struct atiixp *chip)
{
int timeout;
@@ -557,7 +561,7 @@ static int snd_atiixp_codec_detect(atiixp_t *chip)
/* wait for the interrupts */
timeout = 50;
while (timeout-- > 0) {
- msleep(1);
+ mdelay(1);
if (chip->codec_not_ready_bits)
break;
}
@@ -574,7 +578,7 @@ static int snd_atiixp_codec_detect(atiixp_t *chip)
/*
* enable DMA and irqs
*/
-static int snd_atiixp_chip_start(atiixp_t *chip)
+static int snd_atiixp_chip_start(struct atiixp *chip)
{
unsigned int reg;
@@ -604,7 +608,7 @@ static int snd_atiixp_chip_start(atiixp_t *chip)
/*
* disable DMA and IRQs
*/
-static int snd_atiixp_chip_stop(atiixp_t *chip)
+static int snd_atiixp_chip_stop(struct atiixp *chip)
{
/* clear interrupt source */
atiixp_write(chip, ISR, atiixp_read(chip, ISR));
@@ -623,11 +627,11 @@ static int snd_atiixp_chip_stop(atiixp_t *chip)
* position. when SG-buffer is implemented, the offset must be calculated
* correctly...
*/
-static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream)
+static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- snd_pcm_runtime_t *runtime = substream->runtime;
- atiixp_dma_t *dma = (atiixp_dma_t *)runtime->private_data;
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ struct atiixp_dma *dma = runtime->private_data;
unsigned int curptr;
int timeout = 1000;
@@ -648,7 +652,7 @@ static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream)
/*
* XRUN detected, and stop the PCM substream
*/
-static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma)
+static void snd_atiixp_xrun_dma(struct atiixp *chip, struct atiixp_dma *dma)
{
if (! dma->substream || ! dma->running)
return;
@@ -659,7 +663,7 @@ static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma)
/*
* the period ack. update the substream.
*/
-static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma)
+static void snd_atiixp_update_dma(struct atiixp *chip, struct atiixp_dma *dma)
{
if (! dma->substream || ! dma->running)
return;
@@ -668,7 +672,7 @@ static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma)
/* set BUS_BUSY interrupt bit if any DMA is running */
/* call with spinlock held */
-static void snd_atiixp_check_bus_busy(atiixp_t *chip)
+static void snd_atiixp_check_bus_busy(struct atiixp *chip)
{
unsigned int bus_busy;
if (atiixp_read(chip, CMD) & (ATI_REG_CMD_SEND_EN |
@@ -683,10 +687,10 @@ static void snd_atiixp_check_bus_busy(atiixp_t *chip)
/* common trigger callback
* calling the lowlevel callbacks in it
*/
-static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
+static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_dma *dma = substream->runtime->private_data;
int err = 0;
snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
@@ -730,13 +734,13 @@ static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
*/
/* flush FIFO of analog OUT DMA */
-static void atiixp_out_flush_dma(atiixp_t *chip)
+static void atiixp_out_flush_dma(struct atiixp *chip)
{
atiixp_write(chip, FIFO_FLUSH, ATI_REG_FIFO_OUT_FLUSH);
}
/* enable/disable analog OUT DMA */
-static void atiixp_out_enable_dma(atiixp_t *chip, int on)
+static void atiixp_out_enable_dma(struct atiixp *chip, int on)
{
unsigned int data;
data = atiixp_read(chip, CMD);
@@ -751,21 +755,21 @@ static void atiixp_out_enable_dma(atiixp_t *chip, int on)
}
/* start/stop transfer over OUT DMA */
-static void atiixp_out_enable_transfer(atiixp_t *chip, int on)
+static void atiixp_out_enable_transfer(struct atiixp *chip, int on)
{
atiixp_update(chip, CMD, ATI_REG_CMD_SEND_EN,
on ? ATI_REG_CMD_SEND_EN : 0);
}
/* enable/disable analog IN DMA */
-static void atiixp_in_enable_dma(atiixp_t *chip, int on)
+static void atiixp_in_enable_dma(struct atiixp *chip, int on)
{
atiixp_update(chip, CMD, ATI_REG_CMD_IN_DMA_EN,
on ? ATI_REG_CMD_IN_DMA_EN : 0);
}
/* start/stop analog IN DMA */
-static void atiixp_in_enable_transfer(atiixp_t *chip, int on)
+static void atiixp_in_enable_transfer(struct atiixp *chip, int on)
{
if (on) {
unsigned int data = atiixp_read(chip, CMD);
@@ -784,20 +788,20 @@ static void atiixp_in_enable_transfer(atiixp_t *chip, int on)
}
/* flush FIFO of analog IN DMA */
-static void atiixp_in_flush_dma(atiixp_t *chip)
+static void atiixp_in_flush_dma(struct atiixp *chip)
{
atiixp_write(chip, FIFO_FLUSH, ATI_REG_FIFO_IN_FLUSH);
}
/* enable/disable SPDIF OUT DMA */
-static void atiixp_spdif_enable_dma(atiixp_t *chip, int on)
+static void atiixp_spdif_enable_dma(struct atiixp *chip, int on)
{
atiixp_update(chip, CMD, ATI_REG_CMD_SPDF_DMA_EN,
on ? ATI_REG_CMD_SPDF_DMA_EN : 0);
}
/* start/stop SPDIF OUT DMA */
-static void atiixp_spdif_enable_transfer(atiixp_t *chip, int on)
+static void atiixp_spdif_enable_transfer(struct atiixp *chip, int on)
{
unsigned int data;
data = atiixp_read(chip, CMD);
@@ -809,7 +813,7 @@ static void atiixp_spdif_enable_transfer(atiixp_t *chip, int on)
}
/* flush FIFO of SPDIF OUT DMA */
-static void atiixp_spdif_flush_dma(atiixp_t *chip)
+static void atiixp_spdif_flush_dma(struct atiixp *chip)
{
int timeout;
@@ -828,9 +832,9 @@ static void atiixp_spdif_flush_dma(atiixp_t *chip)
}
/* set up slots and formats for SPDIF OUT */
-static int snd_atiixp_spdif_prepare(snd_pcm_substream_t *substream)
+static int snd_atiixp_spdif_prepare(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
spin_lock_irq(&chip->reg_lock);
if (chip->spdif_over_aclink) {
@@ -855,9 +859,9 @@ static int snd_atiixp_spdif_prepare(snd_pcm_substream_t *substream)
}
/* set up slots and formats for analog OUT */
-static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream)
+static int snd_atiixp_playback_prepare(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
unsigned int data;
spin_lock_irq(&chip->reg_lock);
@@ -900,9 +904,9 @@ static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream)
}
/* set up slots and formats for analog IN */
-static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream)
+static int snd_atiixp_capture_prepare(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
spin_lock_irq(&chip->reg_lock);
atiixp_update(chip, CMD, ATI_REG_CMD_INTERLEAVE_IN,
@@ -915,11 +919,11 @@ static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream)
/*
* hw_params - allocate the buffer and set up buffer descriptors
*/
-static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream,
- snd_pcm_hw_params_t *hw_params)
+static int snd_atiixp_pcm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *hw_params)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_dma *dma = substream->runtime->private_data;
int err;
err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
@@ -953,10 +957,10 @@ static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream,
return err;
}
-static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream)
+static int snd_atiixp_pcm_hw_free(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_dma *dma = substream->runtime->private_data;
if (dma->pcm_open_flag) {
struct ac97_pcm *pcm = chip->pcms[dma->ac97_pcm_type];
@@ -972,7 +976,7 @@ static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream)
/*
* pcm hardware definition, identical for all DMA types
*/
-static snd_pcm_hardware_t snd_atiixp_pcm_hw =
+static struct snd_pcm_hardware snd_atiixp_pcm_hw =
{
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -992,10 +996,11 @@ static snd_pcm_hardware_t snd_atiixp_pcm_hw =
.periods_max = ATI_MAX_DESCRIPTORS,
};
-static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma, int pcm_type)
+static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream,
+ struct atiixp_dma *dma, int pcm_type)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- snd_pcm_runtime_t *runtime = substream->runtime;
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
+ struct snd_pcm_runtime *runtime = substream->runtime;
int err;
snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
@@ -1025,9 +1030,10 @@ static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma
return 0;
}
-static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dma)
+static int snd_atiixp_pcm_close(struct snd_pcm_substream *substream,
+ struct atiixp_dma *dma)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
/* disable DMA bits */
snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
spin_lock_irq(&chip->reg_lock);
@@ -1040,9 +1046,9 @@ static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dm
/*
*/
-static int snd_atiixp_playback_open(snd_pcm_substream_t *substream)
+static int snd_atiixp_playback_open(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
@@ -1058,9 +1064,9 @@ static int snd_atiixp_playback_open(snd_pcm_substream_t *substream)
return 0;
}
-static int snd_atiixp_playback_close(snd_pcm_substream_t *substream)
+static int snd_atiixp_playback_close(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
@@ -1068,21 +1074,21 @@ static int snd_atiixp_playback_close(snd_pcm_substream_t *substream)
return err;
}
-static int snd_atiixp_capture_open(snd_pcm_substream_t *substream)
+static int snd_atiixp_capture_open(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE], 1);
}
-static int snd_atiixp_capture_close(snd_pcm_substream_t *substream)
+static int snd_atiixp_capture_close(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_CAPTURE]);
}
-static int snd_atiixp_spdif_open(snd_pcm_substream_t *substream)
+static int snd_atiixp_spdif_open(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */
@@ -1093,9 +1099,9 @@ static int snd_atiixp_spdif_open(snd_pcm_substream_t *substream)
return err;
}
-static int snd_atiixp_spdif_close(snd_pcm_substream_t *substream)
+static int snd_atiixp_spdif_close(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
if (chip->spdif_over_aclink)
@@ -1107,7 +1113,7 @@ static int snd_atiixp_spdif_close(snd_pcm_substream_t *substream)
}
/* AC97 playback */
-static snd_pcm_ops_t snd_atiixp_playback_ops = {
+static struct snd_pcm_ops snd_atiixp_playback_ops = {
.open = snd_atiixp_playback_open,
.close = snd_atiixp_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1119,7 +1125,7 @@ static snd_pcm_ops_t snd_atiixp_playback_ops = {
};
/* AC97 capture */
-static snd_pcm_ops_t snd_atiixp_capture_ops = {
+static struct snd_pcm_ops snd_atiixp_capture_ops = {
.open = snd_atiixp_capture_open,
.close = snd_atiixp_capture_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1131,7 +1137,7 @@ static snd_pcm_ops_t snd_atiixp_capture_ops = {
};
/* SPDIF playback */
-static snd_pcm_ops_t snd_atiixp_spdif_ops = {
+static struct snd_pcm_ops snd_atiixp_spdif_ops = {
.open = snd_atiixp_spdif_open,
.close = snd_atiixp_spdif_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1178,7 +1184,7 @@ static struct ac97_pcm atiixp_pcm_defs[] __devinitdata = {
},
};
-static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = {
+static struct atiixp_dma_ops snd_atiixp_playback_dma_ops = {
.type = ATI_DMA_PLAYBACK,
.llp_offset = ATI_REG_OUT_DMA_LINKPTR,
.dt_cur = ATI_REG_OUT_DMA_DT_CUR,
@@ -1187,7 +1193,7 @@ static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = {
.flush_dma = atiixp_out_flush_dma,
};
-static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = {
+static struct atiixp_dma_ops snd_atiixp_capture_dma_ops = {
.type = ATI_DMA_CAPTURE,
.llp_offset = ATI_REG_IN_DMA_LINKPTR,
.dt_cur = ATI_REG_IN_DMA_DT_CUR,
@@ -1196,7 +1202,7 @@ static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = {
.flush_dma = atiixp_in_flush_dma,
};
-static atiixp_dma_ops_t snd_atiixp_spdif_dma_ops = {
+static struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = {
.type = ATI_DMA_SPDIF,
.llp_offset = ATI_REG_SPDF_DMA_LINKPTR,
.dt_cur = ATI_REG_SPDF_DMA_DT_CUR,
@@ -1206,10 +1212,10 @@ static atiixp_dma_ops_t snd_atiixp_spdif_dma_ops = {
};
-static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
+static int __devinit snd_atiixp_pcm_new(struct atiixp *chip)
{
- snd_pcm_t *pcm;
- ac97_bus_t *pbus = chip->ac97_bus;
+ struct snd_pcm *pcm;
+ struct snd_ac97_bus *pbus = chip->ac97_bus;
int err, i, num_pcms;
/* initialize constants */
@@ -1238,7 +1244,8 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
}
/* PCM #0: analog I/O */
- err = snd_pcm_new(chip->card, "ATI IXP AC97", ATI_PCMDEV_ANALOG, 1, 1, &pcm);
+ err = snd_pcm_new(chip->card, "ATI IXP AC97",
+ ATI_PCMDEV_ANALOG, 1, 1, &pcm);
if (err < 0)
return err;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_playback_ops);
@@ -1248,7 +1255,8 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
- snd_dma_pci_data(chip->pci), 64*1024, 128*1024);
+ snd_dma_pci_data(chip->pci),
+ 64*1024, 128*1024);
/* no SPDIF support on codec? */
if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates)
@@ -1259,7 +1267,8 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
chip->pcms[ATI_PCM_SPDIF]->rates = SNDRV_PCM_RATE_48000;
/* PCM #1: spdif playback */
- err = snd_pcm_new(chip->card, "ATI IXP IEC958", ATI_PCMDEV_DIGITAL, 1, 0, &pcm);
+ err = snd_pcm_new(chip->card, "ATI IXP IEC958",
+ ATI_PCMDEV_DIGITAL, 1, 0, &pcm);
if (err < 0)
return err;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_spdif_ops);
@@ -1271,12 +1280,15 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
- snd_dma_pci_data(chip->pci), 64*1024, 128*1024);
+ snd_dma_pci_data(chip->pci),
+ 64*1024, 128*1024);
/* pre-select AC97 SPDIF slots 10/11 */
for (i = 0; i < NUM_ATI_CODECS; i++) {
if (chip->ac97[i])
- snd_ac97_update_bits(chip->ac97[i], AC97_EXTENDED_STATUS, 0x03 << 4, 0x03 << 4);
+ snd_ac97_update_bits(chip->ac97[i],
+ AC97_EXTENDED_STATUS,
+ 0x03 << 4, 0x03 << 4);
}
return 0;
@@ -1289,7 +1301,7 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
*/
static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- atiixp_t *chip = dev_id;
+ struct atiixp *chip = dev_id;
unsigned int status;
status = atiixp_read(chip, ISR);
@@ -1344,13 +1356,14 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
{ } /* terminator */
};
-static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock, const char *quirk_override)
+static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock,
+ const char *quirk_override)
{
- ac97_bus_t *pbus;
- ac97_template_t ac97;
+ struct snd_ac97_bus *pbus;
+ struct snd_ac97_template ac97;
int i, err;
int codec_count;
- static ac97_bus_ops_t ops = {
+ static struct snd_ac97_bus_ops ops = {
.write = snd_atiixp_ac97_write,
.read = snd_atiixp_ac97_read,
};
@@ -1402,16 +1415,17 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock, const char
/*
* power management
*/
-static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state)
+static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state)
{
- atiixp_t *chip = card->pm_private_data;
+ struct atiixp *chip = card->pm_private_data;
int i;
for (i = 0; i < NUM_ATI_PCMDEVS; i++)
if (chip->pcmdevs[i]) {
- atiixp_dma_t *dma = &chip->dmas[i];
+ struct atiixp_dma *dma = &chip->dmas[i];
if (dma->substream && dma->running)
- dma->saved_curptr = readl(chip->remap_addr + dma->ops->dt_cur);
+ dma->saved_curptr = readl(chip->remap_addr +
+ dma->ops->dt_cur);
snd_pcm_suspend_all(chip->pcmdevs[i]);
}
for (i = 0; i < NUM_ATI_CODECS; i++)
@@ -1425,9 +1439,9 @@ static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state)
return 0;
}
-static int snd_atiixp_resume(snd_card_t *card)
+static int snd_atiixp_resume(struct snd_card *card)
{
- atiixp_t *chip = card->pm_private_data;
+ struct atiixp *chip = card->pm_private_data;
int i;
pci_enable_device(chip->pci);
@@ -1443,13 +1457,14 @@ static int snd_atiixp_resume(snd_card_t *card)
for (i = 0; i < NUM_ATI_PCMDEVS; i++)
if (chip->pcmdevs[i]) {
- atiixp_dma_t *dma = &chip->dmas[i];
+ struct atiixp_dma *dma = &chip->dmas[i];
if (dma->substream && dma->suspended) {
dma->ops->enable_dma(chip, 1);
dma->substream->ops->prepare(dma->substream);
writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
chip->remap_addr + dma->ops->llp_offset);
- writel(dma->saved_curptr, chip->remap_addr + dma->ops->dt_cur);
+ writel(dma->saved_curptr, chip->remap_addr +
+ dma->ops->dt_cur);
}
}
@@ -1462,18 +1477,19 @@ static int snd_atiixp_resume(snd_card_t *card)
* proc interface for register dump
*/
-static void snd_atiixp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
+static void snd_atiixp_proc_read(struct snd_info_entry *entry,
+ struct snd_info_buffer *buffer)
{
- atiixp_t *chip = entry->private_data;
+ struct atiixp *chip = entry->private_data;
int i;
for (i = 0; i < 256; i += 4)
snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i));
}
-static void __devinit snd_atiixp_proc_init(atiixp_t *chip)
+static void __devinit snd_atiixp_proc_init(struct atiixp *chip)
{
- snd_info_entry_t *entry;
+ struct snd_info_entry *entry;
if (! snd_card_proc_new(chip->card, "atiixp", &entry))
snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read);
@@ -1485,7 +1501,7 @@ static void __devinit snd_atiixp_proc_init(atiixp_t *chip)
* destructor
*/
-static int snd_atiixp_free(atiixp_t *chip)
+static int snd_atiixp_free(struct atiixp *chip)
{
if (chip->irq < 0)
goto __hw_end;
@@ -1493,7 +1509,7 @@ static int snd_atiixp_free(atiixp_t *chip)
synchronize_irq(chip->irq);
__hw_end:
if (chip->irq >= 0)
- free_irq(chip->irq, (void *)chip);
+ free_irq(chip->irq, chip);
if (chip->remap_addr)
iounmap(chip->remap_addr);
pci_release_regions(chip->pci);
@@ -1502,23 +1518,23 @@ static int snd_atiixp_free(atiixp_t *chip)
return 0;
}
-static int snd_atiixp_dev_free(snd_device_t *device)
+static int snd_atiixp_dev_free(struct snd_device *device)
{
- atiixp_t *chip = device->device_data;
+ struct atiixp *chip = device->device_data;
return snd_atiixp_free(chip);
}
/*
* constructor for chip instance
*/
-static int __devinit snd_atiixp_create(snd_card_t *card,
+static int __devinit snd_atiixp_create(struct snd_card *card,
struct pci_dev *pci,
- atiixp_t **r_chip)
+ struct atiixp **r_chip)
{
- static snd_device_ops_t ops = {
+ static struct snd_device_ops ops = {
.dev_free = snd_atiixp_dev_free,
};
- atiixp_t *chip;
+ struct atiixp *chip;
int err;
if ((err = pci_enable_device(pci)) < 0)
@@ -1548,7 +1564,8 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
return -EIO;
}
- if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) {
+ if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ,
+ card->shortname, chip)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
snd_atiixp_free(chip);
return -EBUSY;
@@ -1572,8 +1589,8 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
static int __devinit snd_atiixp_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- snd_card_t *card;
- atiixp_t *chip;
+ struct snd_card *card;
+ struct atiixp *chip;
unsigned char revision;
int err;
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 649a999214e..15be161b0a9 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -176,24 +176,18 @@ module_param(enable, bool, 0444);
#define ATI_MAX_DESCRIPTORS 256 /* max number of descriptor packets */
-/*
- */
-
-typedef struct snd_atiixp atiixp_t;
-typedef struct snd_atiixp_dma atiixp_dma_t;
-typedef struct snd_atiixp_dma_ops atiixp_dma_ops_t;
-
+struct atiixp_modem;
/*
* DMA packate descriptor
*/
-typedef struct atiixp_dma_desc {
+struct atiixp_dma_desc {
u32 addr; /* DMA buffer address */
u16 status; /* status bits */
u16 size; /* size of the packet in dwords */
u32 next; /* address of the next packet descriptor */
-} atiixp_dma_desc_t;
+};
/*
* stream enum
@@ -208,22 +202,25 @@ enum { ATI_PCMDEV_ANALOG, NUM_ATI_PCMDEVS }; /* pcm devices */
/*
* constants and callbacks for each DMA type
*/
-struct snd_atiixp_dma_ops {
+struct atiixp_dma_ops {
int type; /* ATI_DMA_XXX */
unsigned int llp_offset; /* LINKPTR offset */
unsigned int dt_cur; /* DT_CUR offset */
- void (*enable_dma)(atiixp_t *chip, int on); /* called from open callback */
- void (*enable_transfer)(atiixp_t *chip, int on); /* called from trigger (START/STOP) */
- void (*flush_dma)(atiixp_t *chip); /* called from trigger (STOP only) */
+ /* called from open callback */
+ void (*enable_dma)(struct atiixp_modem *chip, int on);
+ /* called from trigger (START/STOP) */
+ void (*enable_transfer)(struct atiixp_modem *chip, int on);
+ /* called from trigger (STOP only) */
+ void (*flush_dma)(struct atiixp_modem *chip);
};
/*
* DMA stream
*/
-struct snd_atiixp_dma {
- const atiixp_dma_ops_t *ops;
+struct atiixp_dma {
+ const struct atiixp_dma_ops *ops;
struct snd_dma_buffer desc_buf;
- snd_pcm_substream_t *substream; /* assigned PCM substream */
+ struct snd_pcm_substream *substream; /* assigned PCM substream */
unsigned int buf_addr, buf_bytes; /* DMA buffer address, bytes */
unsigned int period_bytes, periods;
int opened;
@@ -235,8 +232,8 @@ struct snd_atiixp_dma {
/*
* ATI IXP chip
*/
-struct snd_atiixp {
- snd_card_t *card;
+struct atiixp_modem {
+ struct snd_card *card;
struct pci_dev *pci;
struct resource *res; /* memory i/o */
@@ -244,14 +241,14 @@ struct snd_atiixp {
void __iomem *remap_addr;
int irq;
- ac97_bus_t *ac97_bus;
- ac97_t *ac97[NUM_ATI_CODECS];
+ struct snd_ac97_bus *ac97_bus;
+ struct snd_ac97 *ac97[NUM_ATI_CODECS];
spinlock_t reg_lock;
- atiixp_dma_t dmas[NUM_ATI_DMAS];
+ struct atiixp_dma dmas[NUM_ATI_DMAS];
struct ac97_pcm *pcms[NUM_ATI_PCMS];
- snd_pcm_t *pcmdevs[NUM_ATI_PCMDEVS];
+ struct snd_pcm *pcmdevs[NUM_ATI_PCMDEVS];
int max_channels; /* max. channels for PCM out */
@@ -281,8 +278,8 @@ MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
* update the bits of the given register.
* return 1 if the bits changed.
*/
-static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
- unsigned int mask, unsigned int value)
+static int snd_atiixp_update_bits(struct atiixp_modem *chip, unsigned int reg,
+ unsigned int mask, unsigned int value)
{
void __iomem *addr = chip->remap_addr + reg;
unsigned int data, old_data;
@@ -313,7 +310,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
*/
#define ATI_DESC_LIST_SIZE \
- PAGE_ALIGN(ATI_MAX_DESCRIPTORS * sizeof(atiixp_dma_desc_t))
+ PAGE_ALIGN(ATI_MAX_DESCRIPTORS * sizeof(struct atiixp_dma_desc))
/*
* build packets ring for the given buffer size.
@@ -324,10 +321,11 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
*
* the ring is built in this function, and is set up to the hardware.
*/
-static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
- snd_pcm_substream_t *substream,
- unsigned int periods,
- unsigned int period_bytes)
+static int atiixp_build_dma_packets(struct atiixp_modem *chip,
+ struct atiixp_dma *dma,
+ struct snd_pcm_substream *substream,
+ unsigned int periods,
+ unsigned int period_bytes)
{
unsigned int i;
u32 addr, desc_addr;
@@ -357,11 +355,12 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
addr = (u32)substream->runtime->dma_addr;
desc_addr = (u32)dma->desc_buf.addr;
for (i = 0; i < periods; i++) {
- atiixp_dma_desc_t *desc = &((atiixp_dma_desc_t *)dma->desc_buf.area)[i];
+ struct atiixp_dma_desc *desc;
+ desc = &((struct atiixp_dma_desc *)dma->desc_buf.area)[i];
desc->addr = cpu_to_le32(addr);
desc->status = 0;
desc->size = period_bytes >> 2; /* in dwords */
- desc_addr += sizeof(atiixp_dma_desc_t);
+ desc_addr += sizeof(struct atiixp_dma_desc);
if (i == periods - 1)
desc->next = cpu_to_le32((u32)dma->desc_buf.addr);
else
@@ -381,7 +380,9 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
/*
* remove the ring buffer and release it if assigned
*/
-static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_substream_t *substream)
+static void atiixp_clear_dma_packets(struct atiixp_modem *chip,
+ struct atiixp_dma *dma,
+ struct snd_pcm_substream *substream)
{
if (dma->desc_buf.area) {
writel(0, chip->remap_addr + dma->ops->llp_offset);
@@ -393,7 +394,7 @@ static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_
/*
* AC97 interface
*/
-static int snd_atiixp_acquire_codec(atiixp_t *chip)
+static int snd_atiixp_acquire_codec(struct atiixp_modem *chip)
{
int timeout = 1000;
@@ -407,7 +408,9 @@ static int snd_atiixp_acquire_codec(atiixp_t *chip)
return 0;
}
-static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec, unsigned short reg)
+static unsigned short snd_atiixp_codec_read(struct atiixp_modem *chip,
+ unsigned short codec,
+ unsigned short reg)
{
unsigned int data;
int timeout;
@@ -435,7 +438,9 @@ static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec
}
-static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigned short reg, unsigned short val)
+static void snd_atiixp_codec_write(struct atiixp_modem *chip,
+ unsigned short codec,
+ unsigned short reg, unsigned short val)
{
unsigned int data;
@@ -448,16 +453,18 @@ static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigne
}
-static unsigned short snd_atiixp_ac97_read(ac97_t *ac97, unsigned short reg)
+static unsigned short snd_atiixp_ac97_read(struct snd_ac97 *ac97,
+ unsigned short reg)
{
- atiixp_t *chip = ac97->private_data;
+ struct atiixp_modem *chip = ac97->private_data;
return snd_atiixp_codec_read(chip, ac97->num, reg);
}
-static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
+static void snd_atiixp_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
+ unsigned short val)
{
- atiixp_t *chip = ac97->private_data;
+ struct atiixp_modem *chip = ac97->private_data;
if (reg == AC97_GPIO_STATUS) {
atiixp_write(chip, MODEM_OUT_GPIO,
(val << ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT) | ATI_REG_MODEM_OUT_GPIO_EN);
@@ -469,7 +476,7 @@ static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned sho
/*
* reset AC link
*/
-static int snd_atiixp_aclink_reset(atiixp_t *chip)
+static int snd_atiixp_aclink_reset(struct atiixp_modem *chip)
{
int timeout;
@@ -505,7 +512,7 @@ static int snd_atiixp_aclink_reset(atiixp_t *chip)
}
#ifdef CONFIG_PM
-static int snd_atiixp_aclink_down(atiixp_t *chip)
+static int snd_atiixp_aclink_down(struct atiixp_modem *chip)
{
// if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */
// return -EBUSY;
@@ -530,7 +537,7 @@ static int snd_atiixp_aclink_down(atiixp_t *chip)
ATI_REG_ISR_CODEC2_NOT_READY)
#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME)
-static int snd_atiixp_codec_detect(atiixp_t *chip)
+static int snd_atiixp_codec_detect(struct atiixp_modem *chip)
{
int timeout;
@@ -556,7 +563,7 @@ static int snd_atiixp_codec_detect(atiixp_t *chip)
/*
* enable DMA and irqs
*/
-static int snd_atiixp_chip_start(atiixp_t *chip)
+static int snd_atiixp_chip_start(struct atiixp_modem *chip)
{
unsigned int reg;
@@ -581,7 +588,7 @@ static int snd_atiixp_chip_start(atiixp_t *chip)
/*
* disable DMA and IRQs
*/
-static int snd_atiixp_chip_stop(atiixp_t *chip)
+static int snd_atiixp_chip_stop(struct atiixp_modem *chip)
{
/* clear interrupt source */
atiixp_write(chip, ISR, atiixp_read(chip, ISR));
@@ -600,11 +607,11 @@ static int snd_atiixp_chip_stop(atiixp_t *chip)
* position. when SG-buffer is implemented, the offset must be calculated
* correctly...
*/
-static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream)
+static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- snd_pcm_runtime_t *runtime = substream->runtime;
- atiixp_dma_t *dma = (atiixp_dma_t *)runtime->private_data;
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ struct atiixp_dma *dma = runtime->private_data;
unsigned int curptr;
int timeout = 1000;
@@ -625,7 +632,8 @@ static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream)
/*
* XRUN detected, and stop the PCM substream
*/
-static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma)
+static void snd_atiixp_xrun_dma(struct atiixp_modem *chip,
+ struct atiixp_dma *dma)
{
if (! dma->substream || ! dma->running)
return;
@@ -636,7 +644,8 @@ static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma)
/*
* the period ack. update the substream.
*/
-static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma)
+static void snd_atiixp_update_dma(struct atiixp_modem *chip,
+ struct atiixp_dma *dma)
{
if (! dma->substream || ! dma->running)
return;
@@ -645,7 +654,7 @@ static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma)
/* set BUS_BUSY interrupt bit if any DMA is running */
/* call with spinlock held */
-static void snd_atiixp_check_bus_busy(atiixp_t *chip)
+static void snd_atiixp_check_bus_busy(struct atiixp_modem *chip)
{
unsigned int bus_busy;
if (atiixp_read(chip, CMD) & (ATI_REG_CMD_MODEM_SEND1_EN |
@@ -659,10 +668,10 @@ static void snd_atiixp_check_bus_busy(atiixp_t *chip)
/* common trigger callback
* calling the lowlevel callbacks in it
*/
-static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
+static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_dma *dma = substream->runtime->private_data;
int err = 0;
snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
@@ -700,13 +709,13 @@ static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
*/
/* flush FIFO of analog OUT DMA */
-static void atiixp_out_flush_dma(atiixp_t *chip)
+static void atiixp_out_flush_dma(struct atiixp_modem *chip)
{
atiixp_write(chip, MODEM_FIFO_FLUSH, ATI_REG_MODEM_FIFO_OUT1_FLUSH);
}
/* enable/disable analog OUT DMA */
-static void atiixp_out_enable_dma(atiixp_t *chip, int on)
+static void atiixp_out_enable_dma(struct atiixp_modem *chip, int on)
{
unsigned int data;
data = atiixp_read(chip, CMD);
@@ -721,21 +730,21 @@ static void atiixp_out_enable_dma(atiixp_t *chip, int on)
}
/* start/stop transfer over OUT DMA */
-static void atiixp_out_enable_transfer(atiixp_t *chip, int on)
+static void atiixp_out_enable_transfer(struct atiixp_modem *chip, int on)
{
atiixp_update(chip, CMD, ATI_REG_CMD_MODEM_SEND1_EN,
on ? ATI_REG_CMD_MODEM_SEND1_EN : 0);
}
/* enable/disable analog IN DMA */
-static void atiixp_in_enable_dma(atiixp_t *chip, int on)
+static void atiixp_in_enable_dma(struct atiixp_modem *chip, int on)
{
atiixp_update(chip, CMD, ATI_REG_CMD_MODEM_IN_DMA_EN,
on ? ATI_REG_CMD_MODEM_IN_DMA_EN : 0);
}
/* start/stop analog IN DMA */
-static void atiixp_in_enable_transfer(atiixp_t *chip, int on)
+static void atiixp_in_enable_transfer(struct atiixp_modem *chip, int on)
{
if (on) {
unsigned int data = atiixp_read(chip, CMD);
@@ -748,15 +757,15 @@ static void atiixp_in_enable_transfer(atiixp_t *chip, int on)
}
/* flush FIFO of analog IN DMA */
-static void atiixp_in_flush_dma(atiixp_t *chip)
+static void atiixp_in_flush_dma(struct atiixp_modem *chip)
{
atiixp_write(chip, MODEM_FIFO_FLUSH, ATI_REG_MODEM_FIFO_IN_FLUSH);
}
/* set up slots and formats for analog OUT */
-static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream)
+static int snd_atiixp_playback_prepare(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
unsigned int data;
spin_lock_irq(&chip->reg_lock);
@@ -770,7 +779,7 @@ static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream)
}
/* set up slots and formats for analog IN */
-static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream)
+static int snd_atiixp_capture_prepare(struct snd_pcm_substream *substream)
{
return 0;
}
@@ -778,11 +787,11 @@ static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream)
/*
* hw_params - allocate the buffer and set up buffer descriptors
*/
-static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream,
- snd_pcm_hw_params_t *hw_params)
+static int snd_atiixp_pcm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *hw_params)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_dma *dma = substream->runtime->private_data;
int err;
int i;
@@ -809,10 +818,10 @@ static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream,
return err;
}
-static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream)
+static int snd_atiixp_pcm_hw_free(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_dma *dma = substream->runtime->private_data;
atiixp_clear_dma_packets(chip, dma, substream);
snd_pcm_lib_free_pages(substream);
@@ -823,13 +832,15 @@ static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream)
/*
* pcm hardware definition, identical for all DMA types
*/
-static snd_pcm_hardware_t snd_atiixp_pcm_hw =
+static struct snd_pcm_hardware snd_atiixp_pcm_hw =
{
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID),
.formats = SNDRV_PCM_FMTBIT_S16_LE,
- .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_KNOT,
+ .rates = (SNDRV_PCM_RATE_8000 |
+ SNDRV_PCM_RATE_16000 |
+ SNDRV_PCM_RATE_KNOT),
.rate_min = 8000,
.rate_max = 16000,
.channels_min = 2,
@@ -841,13 +852,14 @@ static snd_pcm_hardware_t snd_atiixp_pcm_hw =
.periods_max = ATI_MAX_DESCRIPTORS,
};
-static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma, int pcm_type)
+static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream,
+ struct atiixp_dma *dma, int pcm_type)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
- snd_pcm_runtime_t *runtime = substream->runtime;
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
+ struct snd_pcm_runtime *runtime = substream->runtime;
int err;
static unsigned int rates[] = { 8000, 9600, 12000, 16000 };
- static snd_pcm_hw_constraint_list_t hw_constraints_rates = {
+ static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
.count = ARRAY_SIZE(rates),
.list = rates,
.mask = 0,
@@ -860,9 +872,12 @@ static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma
dma->substream = substream;
runtime->hw = snd_atiixp_pcm_hw;
dma->ac97_pcm_type = pcm_type;
- if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates)) < 0)
+ if ((err = snd_pcm_hw_constraint_list(runtime, 0,
+ SNDRV_PCM_HW_PARAM_RATE,
+ &hw_constraints_rates)) < 0)
return err;
- if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
+ if ((err = snd_pcm_hw_constraint_integer(runtime,
+ SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
return err;
runtime->private_data = dma;
@@ -875,9 +890,10 @@ static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma
return 0;
}
-static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dma)
+static int snd_atiixp_pcm_close(struct snd_pcm_substream *substream,
+ struct atiixp_dma *dma)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
/* disable DMA bits */
snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
spin_lock_irq(&chip->reg_lock);
@@ -890,9 +906,9 @@ static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dm
/*
*/
-static int snd_atiixp_playback_open(snd_pcm_substream_t *substream)
+static int snd_atiixp_playback_open(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
@@ -903,9 +919,9 @@ static int snd_atiixp_playback_open(snd_pcm_substream_t *substream)
return 0;
}
-static int snd_atiixp_playback_close(snd_pcm_substream_t *substream)
+static int snd_atiixp_playback_close(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
@@ -913,21 +929,21 @@ static int snd_atiixp_playback_close(snd_pcm_substream_t *substream)
return err;
}
-static int snd_atiixp_capture_open(snd_pcm_substream_t *substream)
+static int snd_atiixp_capture_open(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE], 1);
}
-static int snd_atiixp_capture_close(snd_pcm_substream_t *substream)
+static int snd_atiixp_capture_close(struct snd_pcm_substream *substream)
{
- atiixp_t *chip = snd_pcm_substream_chip(substream);
+ struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_CAPTURE]);
}
/* AC97 playback */
-static snd_pcm_ops_t snd_atiixp_playback_ops = {
+static struct snd_pcm_ops snd_atiixp_playback_ops = {
.open = snd_atiixp_playback_open,
.close = snd_atiixp_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -939,7 +955,7 @@ static snd_pcm_ops_t snd_atiixp_playback_ops = {
};
/* AC97 capture */
-static snd_pcm_ops_t snd_atiixp_capture_ops = {
+static struct snd_pcm_ops snd_atiixp_capture_ops = {
.open = snd_atiixp_capture_open,
.close = snd_atiixp_capture_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -950,7 +966,7 @@ static snd_pcm_ops_t snd_atiixp_capture_ops = {
.pointer = snd_atiixp_pcm_pointer,
};
-static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = {
+static struct atiixp_dma_ops snd_atiixp_playback_dma_ops = {
.type = ATI_DMA_PLAYBACK,
.llp_offset = ATI_REG_MODEM_OUT_DMA1_LINKPTR,
.dt_cur = ATI_REG_MODEM_OUT_DMA1_DT_CUR,
@@ -959,7 +975,7 @@ static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = {
.flush_dma = atiixp_out_flush_dma,
};
-static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = {
+static struct atiixp_dma_ops snd_atiixp_capture_dma_ops = {
.type = ATI_DMA_CAPTURE,
.llp_offset = ATI_REG_MODEM_IN_DMA_LINKPTR,
.dt_cur = ATI_REG_MODEM_IN_DMA_DT_CUR,
@@ -968,9 +984,9 @@ static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = {
.flush_dma = atiixp_in_flush_dma,
};
-static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
+static int __devinit snd_atiixp_pcm_new(struct atiixp_modem *chip)
{
- snd_pcm_t *pcm;
+ struct snd_pcm *pcm;
int err;
/* initialize constants */
@@ -989,7 +1005,8 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
- snd_dma_pci_data(chip->pci), 64*1024, 128*1024);
+ snd_dma_pci_data(chip->pci),
+ 64*1024, 128*1024);
return 0;
}
@@ -1001,7 +1018,7 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
*/
static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- atiixp_t *chip = dev_id;
+ struct atiixp_modem *chip = dev_id;
unsigned int status;
status = atiixp_read(chip, ISR);
@@ -1040,13 +1057,13 @@ static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *r
* ac97 mixer section
*/
-static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock)
+static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
{
- ac97_bus_t *pbus;
- ac97_template_t ac97;
+ struct snd_ac97_bus *pbus;
+ struct snd_ac97_template ac97;
int i, err;
int codec_count;
- static ac97_bus_ops_t ops = {
+ static struct snd_ac97_bus_ops ops = {
.write = snd_atiixp_ac97_write,
.read = snd_atiixp_ac97_read,
};
@@ -1096,9 +1113,9 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock)
/*
* power management
*/
-static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state)
+static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state)
{
- atiixp_t *chip = card->pm_private_data;
+ struct atiixp_modem *chip = card->pm_private_data;
int i;
for (i = 0; i < NUM_ATI_PCMDEVS; i++)
@@ -1115,9 +1132,9 @@ static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state)
return 0;
}
-static int snd_atiixp_resume(snd_card_t *card)
+static int snd_atiixp_resume(struct snd_card *card)
{
- atiixp_t *chip = card->pm_private_data;
+ struct atiixp_modem *chip = card->pm_private_data;
int i;
pci_enable_device(chip->pci);
@@ -1140,18 +1157,19 @@ static int snd_atiixp_resume(snd_card_t *card)
* proc interface for register dump
*/
-static void snd_atiixp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
+static void snd_atiixp_proc_read(struct snd_info_entry *entry,
+ struct snd_info_buffer *buffer)
{
- atiixp_t *chip = entry->private_data;
+ struct atiixp_modem *chip = entry->private_data;
int i;
for (i = 0; i < 256; i += 4)
snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i));
}
-static void __devinit snd_atiixp_proc_init(atiixp_t *chip)
+static void __devinit snd_atiixp_proc_init(struct atiixp_modem *chip)
{
- snd_info_entry_t *entry;
+ struct snd_info_entry *entry;
if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry))
snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read);
@@ -1163,7 +1181,7 @@ static void __devinit snd_atiixp_proc_init(atiixp_t *chip)
* destructor
*/
-static int snd_atiixp_free(atiixp_t *chip)
+static int snd_atiixp_free(struct atiixp_modem *chip)
{
if (chip->irq < 0)
goto __hw_end;
@@ -1171,7 +1189,7 @@ static int snd_atiixp_free(atiixp_t *chip)
synchronize_irq(chip->irq);
__hw_end:
if (chip->irq >= 0)
- free_irq(chip->irq, (void *)chip);
+ free_irq(chip->irq, chip);
if (chip->remap_addr)
iounmap(chip->remap_addr);
pci_release_regions(chip->pci);
@@ -1180,23 +1198,23 @@ static int snd_atiixp_free(atiixp_t *chip)
return 0;
}
-static int snd_atiixp_dev_free(snd_device_t *device)
+static int snd_atiixp_dev_free(struct snd_device *device)
{
- atiixp_t *chip = device->device_data;
+ struct atiixp_modem *chip = device->device_data;
return snd_atiixp_free(chip);
}
/*
* constructor for chip instance
*/
-static int __devinit snd_atiixp_create(snd_card_t *card,
- struct pci_dev *pci,
- atiixp_t **r_chip)
+static int __devinit snd_atiixp_create(struct snd_card *card,
+ struct pci_dev *pci,
+ struct atiixp_modem **r_chip)
{
- static snd_device_ops_t ops = {
+ static struct snd_device_ops ops = {
.dev_free = snd_atiixp_dev_free,
};
- atiixp_t *chip;
+ struct atiixp_modem *chip;
int err;
if ((err = pci_enable_device(pci)) < 0)
@@ -1226,7 +1244,8 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
return -EIO;
}
- if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) {
+ if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ,
+ card->shortname, chip)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
snd_atiixp_free(chip);
return -EBUSY;
@@ -1250,8 +1269,8 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
static int __devinit snd_atiixp_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- snd_card_t *card;
- atiixp_t *chip;
+ struct snd_card *card;
+ struct atiixp_modem *chip;
unsigned char revision;
int err;