aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/cs5535audio
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:15:37 +0100
committerJaroslav Kysela <perex@suse.cz>2006-01-03 12:16:29 +0100
commit3e8731740e17f01ec1ecce556ccdc4c42279ce1b (patch)
treedada863f577ad8c00b152a9538a4cde36aa240d6 /sound/pci/cs5535audio
parent9b4ffa48ae855c8657a36014c5b0243ff69f4722 (diff)
[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>
Diffstat (limited to 'sound/pci/cs5535audio')
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c34
-rw-r--r--sound/pci/cs5535audio/cs5535audio.h10
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pcm.c57
3 files changed, 41 insertions, 60 deletions
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 920c857fc22..3f4379da4d2 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids);
static void wait_till_cmd_acked(cs5535audio_t *cs5535au, unsigned long timeout)
{
- unsigned long tmp;
+ unsigned int tmp;
do {
tmp = cs_readl(cs5535au, ACC_CODEC_CNTL);
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,
unsigned short reg)
{
- unsigned long regdata;
- unsigned long timeout;
- unsigned long val;
+ unsigned int regdata;
+ int timeout;
+ unsigned int val;
- regdata = ((unsigned long) reg) << 24;
+ regdata = ((unsigned int) reg) << 24;
regdata |= ACC_CODEC_CNTL_RD_CMD;
regdata |= CMD_NEW;
@@ -83,24 +83,23 @@ static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au,
timeout = 50;
do {
val = cs_readl(cs5535au, ACC_CODEC_STATUS);
- if ( (val & STS_NEW) &&
- ((unsigned long) reg == ((0xFF000000 & val)>>24)) )
+ if ((val & STS_NEW) && reg == (val >> 24))
break;
msleep(10);
} while (--timeout);
if (!timeout)
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,
unsigned short reg, unsigned short val)
{
- unsigned long regdata;
+ unsigned int regdata;
- regdata = ((unsigned long) reg) << 24;
- regdata |= (unsigned long) val;
+ regdata = ((unsigned int) reg) << 24;
+ regdata |= val;
regdata &= CMD_MASK;
regdata |= CMD_NEW;
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);
}
-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)
{
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.private_data = cs5535au;
ac97.pci = cs5535au->pci;
- ac97.private_free = snd_cs5535audio_mixer_free_ac97;
if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
- snd_printk("mixer failed\n");
+ snd_printk(KERN_ERR "mixer failed\n");
return err;
}
@@ -201,8 +193,8 @@ static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id,
if (!acc_irq_stat)
return IRQ_NONE;
- for (count=0; count < 10; count++) {
- if (acc_irq_stat & (1<<count)) {
+ for (count = 0; count < 10; count++) {
+ if (acc_irq_stat & (1 << count)) {
switch (count) {
case IRQ_STS:
cs_readl(cs5535au, ACC_GPIO_STATUS);
diff --git a/sound/pci/cs5535audio/cs5535audio.h b/sound/pci/cs5535audio/cs5535audio.h
index e28177fb099..774185e026d 100644
--- a/sound/pci/cs5535audio/cs5535audio.h
+++ b/sound/pci/cs5535audio/cs5535audio.h
@@ -1,11 +1,11 @@
#ifndef __SOUND_CS5535AUDIO_H
#define __SOUND_CS5535AUDIO_H
-#define cs_writel(cs5535au, reg, val) outl(val, (int) cs5535au->port + reg)
-#define cs_writeb(cs5535au, reg, val) outb(val, (int) cs5535au->port + reg)
-#define cs_readl(cs5535au, reg) inl((unsigned short) (cs5535au->port + reg))
-#define cs_readw(cs5535au, reg) inw((unsigned short) (cs5535au->port + reg))
-#define cs_readb(cs5535au, reg) inb((unsigned short) (cs5535au->port + reg))
+#define cs_writel(cs5535au, reg, val) outl(val, (cs5535au)->port + reg)
+#define cs_writeb(cs5535au, reg, val) outb(val, (cs5535au)->port + reg)
+#define cs_readl(cs5535au, reg) inl((cs5535au)->port + reg)
+#define cs_readw(cs5535au, reg) inw((cs5535au)->port + reg)
+#define cs_readb(cs5535au, reg) inb((cs5535au)->port + reg)
#define CS5535AUDIO_MAX_DESCRIPTORS 128
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c
index 5802ed9d57b..d32b23f202c 100644
--- a/sound/pci/cs5535audio/cs5535audio_pcm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pcm.c
@@ -150,8 +150,8 @@ static int cs5535audio_build_dma_packets(cs5535audio_t *cs5535au,
cs5535audio_dma_desc_t *desc =
&((cs5535audio_dma_desc_t *) dma->desc_buf.area)[i];
desc->addr = cpu_to_le32(addr);
- desc->size = period_bytes;
- desc->ctlreserved = PRD_EOP;
+ desc->size = cpu_to_le32(period_bytes);
+ desc->ctlreserved = cpu_to_le32(PRD_EOP);
desc_addr += sizeof(cs5535audio_dma_desc_t);
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->addr = cpu_to_le32((u32) dma->desc_buf.addr);
lastdesc->size = 0;
- lastdesc->ctlreserved = PRD_JMP;
+ lastdesc->ctlreserved = cpu_to_le32(PRD_JMP);
jmpprd_addr = cpu_to_le32(lastdesc->addr +
(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_dma_t *dma = substream->runtime->private_data;
+ int err = 0;
+ spin_lock(&cs5535au->reg_lock);
switch (cmd) {
- case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- spin_lock_irq(&cs5535au->reg_lock);
- dma->ops->pause_dma(cs5535au);
- spin_unlock_irq(&cs5535au->reg_lock);
- break;
- case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- spin_lock_irq(&cs5535au->reg_lock);
- dma->ops->enable_dma(cs5535au);
- spin_unlock_irq(&cs5535au->reg_lock);
- break;
- case SNDRV_PCM_TRIGGER_START:
- spin_lock_irq(&cs5535au->reg_lock);
- dma->ops->enable_dma(cs5535au);
- spin_unlock_irq(&cs5535au->reg_lock);
- break;
- case SNDRV_PCM_TRIGGER_STOP:
- spin_lock_irq(&cs5535au->reg_lock);
- dma->ops->disable_dma(cs5535au);
- spin_unlock_irq(&cs5535au->reg_lock);
- break;
- default:
- snd_printk(KERN_ERR "unhandled trigger\n");
- return -EINVAL;
- break;
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+ dma->ops->pause_dma(cs5535au);
+ break;
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ dma->ops->enable_dma(cs5535au);
+ break;
+ case SNDRV_PCM_TRIGGER_START:
+ dma->ops->enable_dma(cs5535au);
+ break;
+ case SNDRV_PCM_TRIGGER_STOP:
+ dma->ops->disable_dma(cs5535au);
+ break;
+ default:
+ snd_printk(KERN_ERR "unhandled trigger\n");
+ err = -EINVAL;
+ break;
}
- return 0;
+ spin_unlock(&cs5535au->reg_lock);
+ return err;
}
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,
};
-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 = {
.type = CS5535AUDIO_DMA_PLAYBACK,
.enable_dma = cs5535audio_playback_enable_dma,
@@ -417,7 +407,6 @@ int __devinit snd_cs5535audio_pcm(cs5535audio_t *cs5535au)
&snd_cs5535audio_capture_ops);
pcm->private_data = cs5535au;
- pcm->private_free = snd_cs5535audio_pcm_free;
pcm->info_flags = 0;
strcpy(pcm->name, "CS5535 Audio");