[ALSA] Minor clean up and fixes for CS5535 audio driver
Modules: Documentation,CS5535 driver Minor clean up and fixes for CS5535 audio driver. Added an entry in ALSA-Configuration.txt, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9b4ffa48ae
commit
3e8731740e
Documentation/sound/alsa
sound/pci/cs5535audio
@ -410,6 +410,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
|||||||
|
|
||||||
The power-management is supported.
|
The power-management is supported.
|
||||||
|
|
||||||
|
Module snd-cs5535audio
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Module for multifunction CS5535 companion PCI device
|
||||||
|
|
||||||
|
Module supports up to 8 cards.
|
||||||
|
|
||||||
Module snd-dt019x
|
Module snd-dt019x
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ 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(cs5535audio_t *cs5535au, unsigned long timeout)
|
||||||
{
|
{
|
||||||
unsigned long tmp;
|
unsigned int tmp;
|
||||||
do {
|
do {
|
||||||
tmp = cs_readl(cs5535au, ACC_CODEC_CNTL);
|
tmp = cs_readl(cs5535au, ACC_CODEC_CNTL);
|
||||||
if (!(tmp & CMD_NEW))
|
if (!(tmp & CMD_NEW))
|
||||||
@ -69,11 +69,11 @@ static void wait_till_cmd_acked(cs5535audio_t *cs5535au, unsigned long timeout)
|
|||||||
static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au,
|
static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au,
|
||||||
unsigned short reg)
|
unsigned short reg)
|
||||||
{
|
{
|
||||||
unsigned long regdata;
|
unsigned int regdata;
|
||||||
unsigned long timeout;
|
int timeout;
|
||||||
unsigned long val;
|
unsigned int val;
|
||||||
|
|
||||||
regdata = ((unsigned long) reg) << 24;
|
regdata = ((unsigned int) reg) << 24;
|
||||||
regdata |= ACC_CODEC_CNTL_RD_CMD;
|
regdata |= ACC_CODEC_CNTL_RD_CMD;
|
||||||
regdata |= CMD_NEW;
|
regdata |= CMD_NEW;
|
||||||
|
|
||||||
@ -83,24 +83,23 @@ static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au,
|
|||||||
timeout = 50;
|
timeout = 50;
|
||||||
do {
|
do {
|
||||||
val = cs_readl(cs5535au, ACC_CODEC_STATUS);
|
val = cs_readl(cs5535au, ACC_CODEC_STATUS);
|
||||||
if ( (val & STS_NEW) &&
|
if ((val & STS_NEW) && reg == (val >> 24))
|
||||||
((unsigned long) reg == ((0xFF000000 & val)>>24)) )
|
|
||||||
break;
|
break;
|
||||||
msleep(10);
|
msleep(10);
|
||||||
} while (--timeout);
|
} while (--timeout);
|
||||||
if (!timeout)
|
if (!timeout)
|
||||||
snd_printk(KERN_ERR "Failure reading cs5535 codec\n");
|
snd_printk(KERN_ERR "Failure reading cs5535 codec\n");
|
||||||
|
|
||||||
return ((unsigned short) val);
|
return (unsigned short) val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_cs5535audio_codec_write(cs5535audio_t *cs5535au,
|
static void snd_cs5535audio_codec_write(cs5535audio_t *cs5535au,
|
||||||
unsigned short reg, unsigned short val)
|
unsigned short reg, unsigned short val)
|
||||||
{
|
{
|
||||||
unsigned long regdata;
|
unsigned int regdata;
|
||||||
|
|
||||||
regdata = ((unsigned long) reg) << 24;
|
regdata = ((unsigned int) reg) << 24;
|
||||||
regdata |= (unsigned long) val;
|
regdata |= val;
|
||||||
regdata &= CMD_MASK;
|
regdata &= CMD_MASK;
|
||||||
regdata |= CMD_NEW;
|
regdata |= CMD_NEW;
|
||||||
regdata &= ACC_CODEC_CNTL_WR_CMD;
|
regdata &= ACC_CODEC_CNTL_WR_CMD;
|
||||||
@ -123,12 +122,6 @@ static unsigned short snd_cs5535audio_ac97_codec_read(ac97_t *ac97,
|
|||||||
return snd_cs5535audio_codec_read(cs5535au, reg);
|
return snd_cs5535audio_codec_read(cs5535au, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void snd_cs5535audio_mixer_free_ac97(ac97_t *ac97)
|
|
||||||
{
|
|
||||||
cs5535audio_t *cs5535audio = ac97->private_data;
|
|
||||||
cs5535audio->ac97 = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_cs5535audio_mixer(cs5535audio_t *cs5535au)
|
static int snd_cs5535audio_mixer(cs5535audio_t *cs5535au)
|
||||||
{
|
{
|
||||||
snd_card_t *card = cs5535au->card;
|
snd_card_t *card = cs5535au->card;
|
||||||
@ -147,10 +140,9 @@ static int snd_cs5535audio_mixer(cs5535audio_t *cs5535au)
|
|||||||
ac97.scaps = AC97_SCAP_AUDIO|AC97_SCAP_SKIP_MODEM;
|
ac97.scaps = AC97_SCAP_AUDIO|AC97_SCAP_SKIP_MODEM;
|
||||||
ac97.private_data = cs5535au;
|
ac97.private_data = cs5535au;
|
||||||
ac97.pci = cs5535au->pci;
|
ac97.pci = cs5535au->pci;
|
||||||
ac97.private_free = snd_cs5535audio_mixer_free_ac97;
|
|
||||||
|
|
||||||
if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
|
if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
|
||||||
snd_printk("mixer failed\n");
|
snd_printk(KERN_ERR "mixer failed\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef __SOUND_CS5535AUDIO_H
|
#ifndef __SOUND_CS5535AUDIO_H
|
||||||
#define __SOUND_CS5535AUDIO_H
|
#define __SOUND_CS5535AUDIO_H
|
||||||
|
|
||||||
#define cs_writel(cs5535au, reg, val) outl(val, (int) cs5535au->port + reg)
|
#define cs_writel(cs5535au, reg, val) outl(val, (cs5535au)->port + reg)
|
||||||
#define cs_writeb(cs5535au, reg, val) outb(val, (int) cs5535au->port + reg)
|
#define cs_writeb(cs5535au, reg, val) outb(val, (cs5535au)->port + reg)
|
||||||
#define cs_readl(cs5535au, reg) inl((unsigned short) (cs5535au->port + reg))
|
#define cs_readl(cs5535au, reg) inl((cs5535au)->port + reg)
|
||||||
#define cs_readw(cs5535au, reg) inw((unsigned short) (cs5535au->port + reg))
|
#define cs_readw(cs5535au, reg) inw((cs5535au)->port + reg)
|
||||||
#define cs_readb(cs5535au, reg) inb((unsigned short) (cs5535au->port + reg))
|
#define cs_readb(cs5535au, reg) inb((cs5535au)->port + reg)
|
||||||
|
|
||||||
#define CS5535AUDIO_MAX_DESCRIPTORS 128
|
#define CS5535AUDIO_MAX_DESCRIPTORS 128
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ static int cs5535audio_build_dma_packets(cs5535audio_t *cs5535au,
|
|||||||
cs5535audio_dma_desc_t *desc =
|
cs5535audio_dma_desc_t *desc =
|
||||||
&((cs5535audio_dma_desc_t *) dma->desc_buf.area)[i];
|
&((cs5535audio_dma_desc_t *) dma->desc_buf.area)[i];
|
||||||
desc->addr = cpu_to_le32(addr);
|
desc->addr = cpu_to_le32(addr);
|
||||||
desc->size = period_bytes;
|
desc->size = cpu_to_le32(period_bytes);
|
||||||
desc->ctlreserved = PRD_EOP;
|
desc->ctlreserved = cpu_to_le32(PRD_EOP);
|
||||||
desc_addr += sizeof(cs5535audio_dma_desc_t);
|
desc_addr += sizeof(cs5535audio_dma_desc_t);
|
||||||
addr += period_bytes;
|
addr += period_bytes;
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ static int cs5535audio_build_dma_packets(cs5535audio_t *cs5535au,
|
|||||||
lastdesc = &((cs5535audio_dma_desc_t *) dma->desc_buf.area)[periods];
|
lastdesc = &((cs5535audio_dma_desc_t *) 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 = 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(cs5535audio_dma_desc_t)*periods));
|
||||||
|
|
||||||
@ -272,34 +272,29 @@ static int snd_cs5535audio_trigger(snd_pcm_substream_t *substream, int cmd)
|
|||||||
{
|
{
|
||||||
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
|
||||||
cs5535audio_dma_t *dma = substream->runtime->private_data;
|
cs5535audio_dma_t *dma = substream->runtime->private_data;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
spin_lock(&cs5535au->reg_lock);
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||||
spin_lock_irq(&cs5535au->reg_lock);
|
|
||||||
dma->ops->pause_dma(cs5535au);
|
dma->ops->pause_dma(cs5535au);
|
||||||
spin_unlock_irq(&cs5535au->reg_lock);
|
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||||
spin_lock_irq(&cs5535au->reg_lock);
|
|
||||||
dma->ops->enable_dma(cs5535au);
|
dma->ops->enable_dma(cs5535au);
|
||||||
spin_unlock_irq(&cs5535au->reg_lock);
|
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_START:
|
case SNDRV_PCM_TRIGGER_START:
|
||||||
spin_lock_irq(&cs5535au->reg_lock);
|
|
||||||
dma->ops->enable_dma(cs5535au);
|
dma->ops->enable_dma(cs5535au);
|
||||||
spin_unlock_irq(&cs5535au->reg_lock);
|
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_STOP:
|
case SNDRV_PCM_TRIGGER_STOP:
|
||||||
spin_lock_irq(&cs5535au->reg_lock);
|
|
||||||
dma->ops->disable_dma(cs5535au);
|
dma->ops->disable_dma(cs5535au);
|
||||||
spin_unlock_irq(&cs5535au->reg_lock);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_ERR "unhandled trigger\n");
|
snd_printk(KERN_ERR "unhandled trigger\n");
|
||||||
return -EINVAL;
|
err = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
spin_unlock(&cs5535au->reg_lock);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static snd_pcm_uframes_t snd_cs5535audio_pcm_pointer(snd_pcm_substream_t
|
static snd_pcm_uframes_t snd_cs5535audio_pcm_pointer(snd_pcm_substream_t
|
||||||
@ -375,11 +370,6 @@ static snd_pcm_ops_t snd_cs5535audio_capture_ops = {
|
|||||||
.pointer = snd_cs5535audio_pcm_pointer,
|
.pointer = snd_cs5535audio_pcm_pointer,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void snd_cs5535audio_pcm_free(snd_pcm_t *pcm)
|
|
||||||
{
|
|
||||||
snd_pcm_lib_preallocate_free_for_all(pcm);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cs5535audio_dma_ops_t snd_cs5535audio_playback_dma_ops = {
|
static cs5535audio_dma_ops_t 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,
|
||||||
@ -417,7 +407,6 @@ int __devinit snd_cs5535audio_pcm(cs5535audio_t *cs5535au)
|
|||||||
&snd_cs5535audio_capture_ops);
|
&snd_cs5535audio_capture_ops);
|
||||||
|
|
||||||
pcm->private_data = cs5535au;
|
pcm->private_data = cs5535au;
|
||||||
pcm->private_free = snd_cs5535audio_pcm_free;
|
|
||||||
pcm->info_flags = 0;
|
pcm->info_flags = 0;
|
||||||
strcpy(pcm->name, "CS5535 Audio");
|
strcpy(pcm->name, "CS5535 Audio");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user