[ALSA] Remove xxx_t typedefs: PCI CS5535
Modules: CS5535 driver Remove xxx_t typedefs from the PCI CS5535 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d1fabd9cbc
commit
66f8df6bdd
|
@ -53,7 +53,7 @@ static struct pci_device_id snd_cs5535audio_ids[] = {
|
||||||
|
|
||||||
MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids);
|
MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids);
|
||||||
|
|
||||||
static void wait_till_cmd_acked(cs5535audio_t *cs5535au, unsigned long timeout)
|
static void wait_till_cmd_acked(struct cs5535audio *cs5535au, unsigned long timeout)
|
||||||
{
|
{
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
do {
|
do {
|
||||||
|
@ -66,11 +66,11 @@ static void wait_till_cmd_acked(cs5535audio_t *cs5535au, unsigned long timeout)
|
||||||
snd_printk(KERN_ERR "Failure writing to cs5535 codec\n");
|
snd_printk(KERN_ERR "Failure writing to cs5535 codec\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au,
|
static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au,
|
||||||
unsigned short reg)
|
unsigned short reg)
|
||||||
{
|
{
|
||||||
unsigned int regdata;
|
unsigned int regdata;
|
||||||
int timeout;
|
unsigned int timeout;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
regdata = ((unsigned int) reg) << 24;
|
regdata = ((unsigned int) reg) << 24;
|
||||||
|
@ -93,8 +93,8 @@ static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au,
|
||||||
return (unsigned short) val;
|
return (unsigned short) val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_cs5535audio_codec_write(cs5535audio_t *cs5535au,
|
static void snd_cs5535audio_codec_write(struct cs5535audio *cs5535au,
|
||||||
unsigned short reg, unsigned short val)
|
unsigned short reg, unsigned short val)
|
||||||
{
|
{
|
||||||
unsigned int regdata;
|
unsigned int regdata;
|
||||||
|
|
||||||
|
@ -108,27 +108,27 @@ static void snd_cs5535audio_codec_write(cs5535audio_t *cs5535au,
|
||||||
wait_till_cmd_acked(cs5535au, 50);
|
wait_till_cmd_acked(cs5535au, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_cs5535audio_ac97_codec_write(ac97_t *ac97,
|
static void snd_cs5535audio_ac97_codec_write(struct snd_ac97 *ac97,
|
||||||
unsigned short reg, unsigned short val)
|
unsigned short reg, unsigned short val)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = ac97->private_data;
|
struct cs5535audio *cs5535au = ac97->private_data;
|
||||||
snd_cs5535audio_codec_write(cs5535au, reg, val);
|
snd_cs5535audio_codec_write(cs5535au, reg, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned short snd_cs5535audio_ac97_codec_read(ac97_t *ac97,
|
static unsigned short snd_cs5535audio_ac97_codec_read(struct snd_ac97 *ac97,
|
||||||
unsigned short reg)
|
unsigned short reg)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = ac97->private_data;
|
struct cs5535audio *cs5535au = ac97->private_data;
|
||||||
return snd_cs5535audio_codec_read(cs5535au, reg);
|
return snd_cs5535audio_codec_read(cs5535au, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_mixer(cs5535audio_t *cs5535au)
|
static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
snd_card_t *card = cs5535au->card;
|
struct snd_card *card = cs5535au->card;
|
||||||
ac97_bus_t *pbus;
|
struct snd_ac97_bus *pbus;
|
||||||
ac97_template_t ac97;
|
struct snd_ac97_template ac97;
|
||||||
int err;
|
int err;
|
||||||
static ac97_bus_ops_t ops = {
|
static struct snd_ac97_bus_ops ops = {
|
||||||
.write = snd_cs5535audio_ac97_codec_write,
|
.write = snd_cs5535audio_ac97_codec_write,
|
||||||
.read = snd_cs5535audio_ac97_codec_read,
|
.read = snd_cs5535audio_ac97_codec_read,
|
||||||
};
|
};
|
||||||
|
@ -149,14 +149,14 @@ static int snd_cs5535audio_mixer(cs5535audio_t *cs5535au)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_bm0_irq(cs5535audio_t *cs5535au)
|
static void process_bm0_irq(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
u8 bm_stat;
|
u8 bm_stat;
|
||||||
spin_lock(&cs5535au->reg_lock);
|
spin_lock(&cs5535au->reg_lock);
|
||||||
bm_stat = cs_readb(cs5535au, ACC_BM0_STATUS);
|
bm_stat = cs_readb(cs5535au, ACC_BM0_STATUS);
|
||||||
spin_unlock(&cs5535au->reg_lock);
|
spin_unlock(&cs5535au->reg_lock);
|
||||||
if (bm_stat & EOP) {
|
if (bm_stat & EOP) {
|
||||||
cs5535audio_dma_t *dma;
|
struct cs5535audio_dma *dma;
|
||||||
dma = cs5535au->playback_substream->runtime->private_data;
|
dma = cs5535au->playback_substream->runtime->private_data;
|
||||||
snd_pcm_period_elapsed(cs5535au->playback_substream);
|
snd_pcm_period_elapsed(cs5535au->playback_substream);
|
||||||
} else {
|
} else {
|
||||||
|
@ -165,26 +165,26 @@ static void process_bm0_irq(cs5535audio_t *cs5535au)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_bm1_irq(cs5535audio_t *cs5535au)
|
static void process_bm1_irq(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
u8 bm_stat;
|
u8 bm_stat;
|
||||||
spin_lock(&cs5535au->reg_lock);
|
spin_lock(&cs5535au->reg_lock);
|
||||||
bm_stat = cs_readb(cs5535au, ACC_BM1_STATUS);
|
bm_stat = cs_readb(cs5535au, ACC_BM1_STATUS);
|
||||||
spin_unlock(&cs5535au->reg_lock);
|
spin_unlock(&cs5535au->reg_lock);
|
||||||
if (bm_stat & EOP) {
|
if (bm_stat & EOP) {
|
||||||
cs5535audio_dma_t *dma;
|
struct cs5535audio_dma *dma;
|
||||||
dma = cs5535au->capture_substream->runtime->private_data;
|
dma = cs5535au->capture_substream->runtime->private_data;
|
||||||
snd_pcm_period_elapsed(cs5535au->capture_substream);
|
snd_pcm_period_elapsed(cs5535au->capture_substream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id,
|
static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id,
|
||||||
struct pt_regs *regs)
|
struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
u16 acc_irq_stat;
|
u16 acc_irq_stat;
|
||||||
u8 bm_stat;
|
u8 bm_stat;
|
||||||
unsigned char count;
|
unsigned char count;
|
||||||
cs5535audio_t *cs5535au = dev_id;
|
struct cs5535audio *cs5535au = dev_id;
|
||||||
|
|
||||||
if (cs5535au == NULL)
|
if (cs5535au == NULL)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
@ -235,7 +235,7 @@ static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id,
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_free(cs5535audio_t *cs5535au)
|
static int snd_cs5535audio_free(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
synchronize_irq(cs5535au->irq);
|
synchronize_irq(cs5535au->irq);
|
||||||
pci_set_power_state(cs5535au->pci, 3);
|
pci_set_power_state(cs5535au->pci, 3);
|
||||||
|
@ -249,20 +249,20 @@ static int snd_cs5535audio_free(cs5535audio_t *cs5535au)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_dev_free(snd_device_t *device)
|
static int snd_cs5535audio_dev_free(struct snd_device *device)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = device->device_data;
|
struct cs5535audio *cs5535au = device->device_data;
|
||||||
return snd_cs5535audio_free(cs5535au);
|
return snd_cs5535audio_free(cs5535au);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devinit snd_cs5535audio_create(snd_card_t *card,
|
static int __devinit snd_cs5535audio_create(struct snd_card *card,
|
||||||
struct pci_dev *pci,
|
struct pci_dev *pci,
|
||||||
cs5535audio_t **rcs5535au)
|
struct cs5535audio **rcs5535au)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au;
|
struct cs5535audio *cs5535au;
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
static snd_device_ops_t ops = {
|
static struct snd_device_ops ops = {
|
||||||
.dev_free = snd_cs5535audio_dev_free,
|
.dev_free = snd_cs5535audio_dev_free,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ static int __devinit snd_cs5535audio_create(snd_card_t *card,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 ||
|
if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 ||
|
||||||
pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) {
|
pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) {
|
||||||
printk(KERN_WARNING "unable to get 32bit dma\n");
|
printk(KERN_WARNING "unable to get 32bit dma\n");
|
||||||
err = -ENXIO;
|
err = -ENXIO;
|
||||||
goto pcifail;
|
goto pcifail;
|
||||||
|
@ -296,7 +296,7 @@ static int __devinit snd_cs5535audio_create(snd_card_t *card,
|
||||||
cs5535au->port = pci_resource_start(pci, 0);
|
cs5535au->port = pci_resource_start(pci, 0);
|
||||||
|
|
||||||
if (request_irq(pci->irq, snd_cs5535audio_interrupt,
|
if (request_irq(pci->irq, snd_cs5535audio_interrupt,
|
||||||
SA_INTERRUPT|SA_SHIRQ, "CS5535 Audio", cs5535au)) {
|
SA_INTERRUPT|SA_SHIRQ, "CS5535 Audio", cs5535au)) {
|
||||||
snd_printk("unable to grab IRQ %d\n", pci->irq);
|
snd_printk("unable to grab IRQ %d\n", pci->irq);
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
goto sndfail;
|
goto sndfail;
|
||||||
|
@ -306,7 +306,7 @@ static int __devinit snd_cs5535audio_create(snd_card_t *card,
|
||||||
pci_set_master(pci);
|
pci_set_master(pci);
|
||||||
|
|
||||||
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
|
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
|
||||||
cs5535au, &ops)) < 0)
|
cs5535au, &ops)) < 0)
|
||||||
goto sndfail;
|
goto sndfail;
|
||||||
|
|
||||||
snd_card_set_dev(card, &pci->dev);
|
snd_card_set_dev(card, &pci->dev);
|
||||||
|
@ -324,11 +324,11 @@ pcifail:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devinit snd_cs5535audio_probe(struct pci_dev *pci,
|
static int __devinit snd_cs5535audio_probe(struct pci_dev *pci,
|
||||||
const struct pci_device_id *pci_id)
|
const struct pci_device_id *pci_id)
|
||||||
{
|
{
|
||||||
static int dev;
|
static int dev;
|
||||||
snd_card_t *card;
|
struct snd_card *card;
|
||||||
cs5535audio_t *cs5535au;
|
struct cs5535audio *cs5535au;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (dev >= SNDRV_CARDS)
|
if (dev >= SNDRV_CARDS)
|
||||||
|
|
|
@ -78,46 +78,46 @@
|
||||||
#define PRD_EOP 0x4000
|
#define PRD_EOP 0x4000
|
||||||
#define PRD_EOT 0x8000
|
#define PRD_EOT 0x8000
|
||||||
|
|
||||||
typedef struct _snd_cs5535audio cs5535audio_t;
|
|
||||||
typedef struct snd_cs5535audio_dma cs5535audio_dma_t;
|
|
||||||
typedef struct snd_cs5535audio_dma_ops cs5535audio_dma_ops_t;
|
|
||||||
|
|
||||||
enum { CS5535AUDIO_DMA_PLAYBACK, CS5535AUDIO_DMA_CAPTURE, NUM_CS5535AUDIO_DMAS };
|
enum { CS5535AUDIO_DMA_PLAYBACK, CS5535AUDIO_DMA_CAPTURE, NUM_CS5535AUDIO_DMAS };
|
||||||
struct snd_cs5535audio_dma_ops {
|
|
||||||
|
struct cs5535audio;
|
||||||
|
|
||||||
|
struct cs5535audio_dma_ops {
|
||||||
int type;
|
int type;
|
||||||
void (*enable_dma)(cs5535audio_t *cs5535au);
|
void (*enable_dma)(struct cs5535audio *cs5535au);
|
||||||
void (*disable_dma)(cs5535audio_t *cs5535au);
|
void (*disable_dma)(struct cs5535audio *cs5535au);
|
||||||
void (*pause_dma)(cs5535audio_t *cs5535au);
|
void (*pause_dma)(struct cs5535audio *cs5535au);
|
||||||
void (*setup_prd)(cs5535audio_t *cs5535au, u32 prd_addr);
|
void (*setup_prd)(struct cs5535audio *cs5535au, u32 prd_addr);
|
||||||
u32 (*read_dma_pntr)(cs5535audio_t *cs5535au);
|
u32 (*read_dma_pntr)(struct cs5535audio *cs5535au);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct cs5535audio_dma_desc {
|
struct cs5535audio_dma_desc {
|
||||||
u32 addr;
|
u32 addr;
|
||||||
u16 size;
|
u16 size;
|
||||||
u16 ctlreserved;
|
u16 ctlreserved;
|
||||||
} cs5535audio_dma_desc_t;
|
};
|
||||||
|
|
||||||
struct snd_cs5535audio_dma {
|
struct cs5535audio_dma {
|
||||||
const cs5535audio_dma_ops_t *ops;
|
const struct cs5535audio_dma_ops *ops;
|
||||||
struct snd_dma_buffer desc_buf;
|
struct snd_dma_buffer desc_buf;
|
||||||
snd_pcm_substream_t *substream;
|
struct snd_pcm_substream *substream;
|
||||||
unsigned int buf_addr, buf_bytes;
|
unsigned int buf_addr, buf_bytes;
|
||||||
unsigned int period_bytes, periods;
|
unsigned int period_bytes, periods;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _snd_cs5535audio {
|
struct cs5535audio {
|
||||||
snd_card_t *card;
|
struct snd_card *card;
|
||||||
ac97_t *ac97;
|
struct snd_ac97 *ac97;
|
||||||
int irq;
|
int irq;
|
||||||
struct pci_dev *pci;
|
struct pci_dev *pci;
|
||||||
unsigned long port;
|
unsigned long port;
|
||||||
spinlock_t reg_lock;
|
spinlock_t reg_lock;
|
||||||
snd_pcm_substream_t *playback_substream;
|
struct snd_pcm_substream *playback_substream;
|
||||||
snd_pcm_substream_t *capture_substream;
|
struct snd_pcm_substream *capture_substream;
|
||||||
cs5535audio_dma_t dmas[NUM_CS5535AUDIO_DMAS];
|
struct cs5535audio_dma dmas[NUM_CS5535AUDIO_DMAS];
|
||||||
};
|
};
|
||||||
|
|
||||||
int __devinit snd_cs5535audio_pcm(cs5535audio_t *cs5535audio);
|
int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535audio);
|
||||||
|
|
||||||
#endif /* __SOUND_CS5535AUDIO_H */
|
#endif /* __SOUND_CS5535AUDIO_H */
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <sound/ac97_codec.h>
|
#include <sound/ac97_codec.h>
|
||||||
#include "cs5535audio.h"
|
#include "cs5535audio.h"
|
||||||
|
|
||||||
static snd_pcm_hardware_t snd_cs5535audio_playback =
|
static struct snd_pcm_hardware snd_cs5535audio_playback =
|
||||||
{
|
{
|
||||||
.info = (
|
.info = (
|
||||||
SNDRV_PCM_INFO_MMAP |
|
SNDRV_PCM_INFO_MMAP |
|
||||||
|
@ -64,7 +64,7 @@ static snd_pcm_hardware_t snd_cs5535audio_playback =
|
||||||
.fifo_size = 0,
|
.fifo_size = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static snd_pcm_hardware_t snd_cs5535audio_capture =
|
static struct snd_pcm_hardware snd_cs5535audio_capture =
|
||||||
{
|
{
|
||||||
.info = (
|
.info = (
|
||||||
SNDRV_PCM_INFO_MMAP |
|
SNDRV_PCM_INFO_MMAP |
|
||||||
|
@ -92,11 +92,11 @@ static snd_pcm_hardware_t snd_cs5535audio_capture =
|
||||||
.fifo_size = 0,
|
.fifo_size = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int snd_cs5535audio_playback_open(snd_pcm_substream_t *substream)
|
static int snd_cs5535audio_playback_open(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
snd_pcm_runtime_t *runtime = substream->runtime;
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||||
|
|
||||||
runtime->hw = snd_cs5535audio_playback;
|
runtime->hw = snd_cs5535audio_playback;
|
||||||
cs5535au->playback_substream = substream;
|
cs5535au->playback_substream = substream;
|
||||||
|
@ -109,23 +109,23 @@ static int snd_cs5535audio_playback_open(snd_pcm_substream_t *substream)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_playback_close(snd_pcm_substream_t *substream)
|
static int snd_cs5535audio_playback_close(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CS5535AUDIO_DESC_LIST_SIZE \
|
#define CS5535AUDIO_DESC_LIST_SIZE \
|
||||||
PAGE_ALIGN(CS5535AUDIO_MAX_DESCRIPTORS * sizeof(cs5535audio_dma_desc_t))
|
PAGE_ALIGN(CS5535AUDIO_MAX_DESCRIPTORS * sizeof(struct cs5535audio_dma_desc))
|
||||||
|
|
||||||
static int cs5535audio_build_dma_packets(cs5535audio_t *cs5535au,
|
static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,
|
||||||
cs5535audio_dma_t *dma,
|
struct cs5535audio_dma *dma,
|
||||||
snd_pcm_substream_t *substream,
|
struct snd_pcm_substream *substream,
|
||||||
unsigned int periods,
|
unsigned int periods,
|
||||||
unsigned int period_bytes)
|
unsigned int period_bytes)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
u32 addr, desc_addr, jmpprd_addr;
|
u32 addr, desc_addr, jmpprd_addr;
|
||||||
cs5535audio_dma_desc_t *lastdesc;
|
struct cs5535audio_dma_desc *lastdesc;
|
||||||
|
|
||||||
if (periods > CS5535AUDIO_MAX_DESCRIPTORS)
|
if (periods > CS5535AUDIO_MAX_DESCRIPTORS)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -147,21 +147,21 @@ static int cs5535audio_build_dma_packets(cs5535audio_t *cs5535au,
|
||||||
addr = (u32) substream->runtime->dma_addr;
|
addr = (u32) substream->runtime->dma_addr;
|
||||||
desc_addr = (u32) dma->desc_buf.addr;
|
desc_addr = (u32) dma->desc_buf.addr;
|
||||||
for (i = 0; i < periods; i++) {
|
for (i = 0; i < periods; i++) {
|
||||||
cs5535audio_dma_desc_t *desc =
|
struct cs5535audio_dma_desc *desc =
|
||||||
&((cs5535audio_dma_desc_t *) dma->desc_buf.area)[i];
|
&((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i];
|
||||||
desc->addr = cpu_to_le32(addr);
|
desc->addr = cpu_to_le32(addr);
|
||||||
desc->size = cpu_to_le32(period_bytes);
|
desc->size = cpu_to_le32(period_bytes);
|
||||||
desc->ctlreserved = cpu_to_le32(PRD_EOP);
|
desc->ctlreserved = cpu_to_le32(PRD_EOP);
|
||||||
desc_addr += sizeof(cs5535audio_dma_desc_t);
|
desc_addr += sizeof(struct cs5535audio_dma_desc);
|
||||||
addr += period_bytes;
|
addr += period_bytes;
|
||||||
}
|
}
|
||||||
/* we reserved one dummy descriptor at the end to do the PRD jump */
|
/* we reserved one dummy descriptor at the end to do the PRD jump */
|
||||||
lastdesc = &((cs5535audio_dma_desc_t *) dma->desc_buf.area)[periods];
|
lastdesc = &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[periods];
|
||||||
lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr);
|
lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr);
|
||||||
lastdesc->size = 0;
|
lastdesc->size = 0;
|
||||||
lastdesc->ctlreserved = cpu_to_le32(PRD_JMP);
|
lastdesc->ctlreserved = cpu_to_le32(PRD_JMP);
|
||||||
jmpprd_addr = cpu_to_le32(lastdesc->addr +
|
jmpprd_addr = cpu_to_le32(lastdesc->addr +
|
||||||
(sizeof(cs5535audio_dma_desc_t)*periods));
|
(sizeof(struct cs5535audio_dma_desc)*periods));
|
||||||
|
|
||||||
dma->period_bytes = period_bytes;
|
dma->period_bytes = period_bytes;
|
||||||
dma->periods = periods;
|
dma->periods = periods;
|
||||||
|
@ -172,71 +172,71 @@ static int cs5535audio_build_dma_packets(cs5535audio_t *cs5535au,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_playback_enable_dma(cs5535audio_t *cs5535au)
|
static void cs5535audio_playback_enable_dma(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
cs_writeb(cs5535au, ACC_BM0_CMD, BM_CTL_EN);
|
cs_writeb(cs5535au, ACC_BM0_CMD, BM_CTL_EN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_playback_disable_dma(cs5535audio_t *cs5535au)
|
static void cs5535audio_playback_disable_dma(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
cs_writeb(cs5535au, ACC_BM0_CMD, 0);
|
cs_writeb(cs5535au, ACC_BM0_CMD, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_playback_pause_dma(cs5535audio_t *cs5535au)
|
static void cs5535audio_playback_pause_dma(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
cs_writeb(cs5535au, ACC_BM0_CMD, BM_CTL_PAUSE);
|
cs_writeb(cs5535au, ACC_BM0_CMD, BM_CTL_PAUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_playback_setup_prd(cs5535audio_t *cs5535au,
|
static void cs5535audio_playback_setup_prd(struct cs5535audio *cs5535au,
|
||||||
u32 prd_addr)
|
u32 prd_addr)
|
||||||
{
|
{
|
||||||
cs_writel(cs5535au, ACC_BM0_PRD, prd_addr);
|
cs_writel(cs5535au, ACC_BM0_PRD, prd_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 cs5535audio_playback_read_dma_pntr(cs5535audio_t *cs5535au)
|
static u32 cs5535audio_playback_read_dma_pntr(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
return cs_readl(cs5535au, ACC_BM0_PNTR);
|
return cs_readl(cs5535au, ACC_BM0_PNTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_capture_enable_dma(cs5535audio_t *cs5535au)
|
static void cs5535audio_capture_enable_dma(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
cs_writeb(cs5535au, ACC_BM1_CMD, BM_CTL_EN);
|
cs_writeb(cs5535au, ACC_BM1_CMD, BM_CTL_EN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_capture_disable_dma(cs5535audio_t *cs5535au)
|
static void cs5535audio_capture_disable_dma(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
cs_writeb(cs5535au, ACC_BM1_CMD, 0);
|
cs_writeb(cs5535au, ACC_BM1_CMD, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_capture_pause_dma(cs5535audio_t *cs5535au)
|
static void cs5535audio_capture_pause_dma(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
cs_writeb(cs5535au, ACC_BM1_CMD, BM_CTL_PAUSE);
|
cs_writeb(cs5535au, ACC_BM1_CMD, BM_CTL_PAUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_capture_setup_prd(cs5535audio_t *cs5535au,
|
static void cs5535audio_capture_setup_prd(struct cs5535audio *cs5535au,
|
||||||
u32 prd_addr)
|
u32 prd_addr)
|
||||||
{
|
{
|
||||||
cs_writel(cs5535au, ACC_BM1_PRD, prd_addr);
|
cs_writel(cs5535au, ACC_BM1_PRD, prd_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 cs5535audio_capture_read_dma_pntr(cs5535audio_t *cs5535au)
|
static u32 cs5535audio_capture_read_dma_pntr(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
return cs_readl(cs5535au, ACC_BM1_PNTR);
|
return cs_readl(cs5535au, ACC_BM1_PNTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs5535audio_clear_dma_packets(cs5535audio_t *cs5535au,
|
static void cs5535audio_clear_dma_packets(struct cs5535audio *cs5535au,
|
||||||
cs5535audio_dma_t *dma,
|
struct cs5535audio_dma *dma,
|
||||||
snd_pcm_substream_t *substream)
|
struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
snd_dma_free_pages(&dma->desc_buf);
|
snd_dma_free_pages(&dma->desc_buf);
|
||||||
dma->desc_buf.area = NULL;
|
dma->desc_buf.area = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_hw_params(snd_pcm_substream_t *substream,
|
static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream,
|
||||||
snd_pcm_hw_params_t *hw_params)
|
struct snd_pcm_hw_params *hw_params)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
cs5535audio_dma_t *dma = substream->runtime->private_data;
|
struct cs5535audio_dma *dma = substream->runtime->private_data;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = snd_pcm_lib_malloc_pages(substream,
|
err = snd_pcm_lib_malloc_pages(substream,
|
||||||
|
@ -247,31 +247,31 @@ static int snd_cs5535audio_hw_params(snd_pcm_substream_t *substream,
|
||||||
dma->buf_bytes = params_buffer_bytes(hw_params);
|
dma->buf_bytes = params_buffer_bytes(hw_params);
|
||||||
|
|
||||||
err = cs5535audio_build_dma_packets(cs5535au, dma, substream,
|
err = cs5535audio_build_dma_packets(cs5535au, dma, substream,
|
||||||
params_periods(hw_params),
|
params_periods(hw_params),
|
||||||
params_period_bytes(hw_params));
|
params_period_bytes(hw_params));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_hw_free(snd_pcm_substream_t *substream)
|
static int snd_cs5535audio_hw_free(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
cs5535audio_dma_t *dma = substream->runtime->private_data;
|
struct cs5535audio_dma *dma = substream->runtime->private_data;
|
||||||
|
|
||||||
cs5535audio_clear_dma_packets(cs5535au, dma, substream);
|
cs5535audio_clear_dma_packets(cs5535au, dma, substream);
|
||||||
return snd_pcm_lib_free_pages(substream);
|
return snd_pcm_lib_free_pages(substream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_playback_prepare(snd_pcm_substream_t *substream)
|
static int snd_cs5535audio_playback_prepare(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
return snd_ac97_set_rate(cs5535au->ac97, AC97_PCM_FRONT_DAC_RATE,
|
return snd_ac97_set_rate(cs5535au->ac97, AC97_PCM_FRONT_DAC_RATE,
|
||||||
substream->runtime->rate);
|
substream->runtime->rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_trigger(snd_pcm_substream_t *substream, int cmd)
|
static int snd_cs5535audio_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
cs5535audio_dma_t *dma = substream->runtime->private_data;
|
struct cs5535audio_dma *dma = substream->runtime->private_data;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
spin_lock(&cs5535au->reg_lock);
|
spin_lock(&cs5535au->reg_lock);
|
||||||
|
@ -297,12 +297,12 @@ static int snd_cs5535audio_trigger(snd_pcm_substream_t *substream, int cmd)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static snd_pcm_uframes_t snd_cs5535audio_pcm_pointer(snd_pcm_substream_t
|
static snd_pcm_uframes_t snd_cs5535audio_pcm_pointer(struct snd_pcm_substream
|
||||||
*substream)
|
*substream)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
u32 curdma;
|
u32 curdma;
|
||||||
cs5535audio_dma_t *dma;
|
struct cs5535audio_dma *dma;
|
||||||
|
|
||||||
dma = substream->runtime->private_data;
|
dma = substream->runtime->private_data;
|
||||||
curdma = dma->ops->read_dma_pntr(cs5535au);
|
curdma = dma->ops->read_dma_pntr(cs5535au);
|
||||||
|
@ -320,11 +320,11 @@ static snd_pcm_uframes_t snd_cs5535audio_pcm_pointer(snd_pcm_substream_t
|
||||||
return bytes_to_frames(substream->runtime, curdma);
|
return bytes_to_frames(substream->runtime, curdma);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_capture_open(snd_pcm_substream_t *substream)
|
static int snd_cs5535audio_capture_open(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
snd_pcm_runtime_t *runtime = substream->runtime;
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||||
|
|
||||||
runtime->hw = snd_cs5535audio_capture;
|
runtime->hw = snd_cs5535audio_capture;
|
||||||
cs5535au->capture_substream = substream;
|
cs5535au->capture_substream = substream;
|
||||||
|
@ -336,19 +336,19 @@ static int snd_cs5535audio_capture_open(snd_pcm_substream_t *substream)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_capture_close(snd_pcm_substream_t *substream)
|
static int snd_cs5535audio_capture_close(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_cs5535audio_capture_prepare(snd_pcm_substream_t *substream)
|
static int snd_cs5535audio_capture_prepare(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
return snd_ac97_set_rate(cs5535au->ac97, AC97_PCM_LR_ADC_RATE,
|
return snd_ac97_set_rate(cs5535au->ac97, AC97_PCM_LR_ADC_RATE,
|
||||||
substream->runtime->rate);
|
substream->runtime->rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static snd_pcm_ops_t snd_cs5535audio_playback_ops = {
|
static struct snd_pcm_ops snd_cs5535audio_playback_ops = {
|
||||||
.open = snd_cs5535audio_playback_open,
|
.open = snd_cs5535audio_playback_open,
|
||||||
.close = snd_cs5535audio_playback_close,
|
.close = snd_cs5535audio_playback_close,
|
||||||
.ioctl = snd_pcm_lib_ioctl,
|
.ioctl = snd_pcm_lib_ioctl,
|
||||||
|
@ -359,7 +359,7 @@ static snd_pcm_ops_t snd_cs5535audio_playback_ops = {
|
||||||
.pointer = snd_cs5535audio_pcm_pointer,
|
.pointer = snd_cs5535audio_pcm_pointer,
|
||||||
};
|
};
|
||||||
|
|
||||||
static snd_pcm_ops_t snd_cs5535audio_capture_ops = {
|
static struct snd_pcm_ops snd_cs5535audio_capture_ops = {
|
||||||
.open = snd_cs5535audio_capture_open,
|
.open = snd_cs5535audio_capture_open,
|
||||||
.close = snd_cs5535audio_capture_close,
|
.close = snd_cs5535audio_capture_close,
|
||||||
.ioctl = snd_pcm_lib_ioctl,
|
.ioctl = snd_pcm_lib_ioctl,
|
||||||
|
@ -370,7 +370,7 @@ static snd_pcm_ops_t snd_cs5535audio_capture_ops = {
|
||||||
.pointer = snd_cs5535audio_pcm_pointer,
|
.pointer = snd_cs5535audio_pcm_pointer,
|
||||||
};
|
};
|
||||||
|
|
||||||
static cs5535audio_dma_ops_t snd_cs5535audio_playback_dma_ops = {
|
static struct cs5535audio_dma_ops snd_cs5535audio_playback_dma_ops = {
|
||||||
.type = CS5535AUDIO_DMA_PLAYBACK,
|
.type = CS5535AUDIO_DMA_PLAYBACK,
|
||||||
.enable_dma = cs5535audio_playback_enable_dma,
|
.enable_dma = cs5535audio_playback_enable_dma,
|
||||||
.disable_dma = cs5535audio_playback_disable_dma,
|
.disable_dma = cs5535audio_playback_disable_dma,
|
||||||
|
@ -379,7 +379,7 @@ static cs5535audio_dma_ops_t snd_cs5535audio_playback_dma_ops = {
|
||||||
.read_dma_pntr = cs5535audio_playback_read_dma_pntr,
|
.read_dma_pntr = cs5535audio_playback_read_dma_pntr,
|
||||||
};
|
};
|
||||||
|
|
||||||
static cs5535audio_dma_ops_t snd_cs5535audio_capture_dma_ops = {
|
static struct cs5535audio_dma_ops snd_cs5535audio_capture_dma_ops = {
|
||||||
.type = CS5535AUDIO_DMA_CAPTURE,
|
.type = CS5535AUDIO_DMA_CAPTURE,
|
||||||
.enable_dma = cs5535audio_capture_enable_dma,
|
.enable_dma = cs5535audio_capture_enable_dma,
|
||||||
.disable_dma = cs5535audio_capture_disable_dma,
|
.disable_dma = cs5535audio_capture_disable_dma,
|
||||||
|
@ -388,9 +388,9 @@ static cs5535audio_dma_ops_t snd_cs5535audio_capture_dma_ops = {
|
||||||
.read_dma_pntr = cs5535audio_capture_read_dma_pntr,
|
.read_dma_pntr = cs5535audio_capture_read_dma_pntr,
|
||||||
};
|
};
|
||||||
|
|
||||||
int __devinit snd_cs5535audio_pcm(cs5535audio_t *cs5535au)
|
int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535au)
|
||||||
{
|
{
|
||||||
snd_pcm_t *pcm;
|
struct snd_pcm *pcm;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = snd_pcm_new(cs5535au->card, "CS5535 Audio", 0, 1, 1, &pcm);
|
err = snd_pcm_new(cs5535au->card, "CS5535 Audio", 0, 1, 1, &pcm);
|
||||||
|
|
Loading…
Reference in New Issue