Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15926
b: refs/heads/master
c: 3e87317
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jan 3, 2006
1 parent 4b823d1 commit 10f8d69
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 61 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b4ffa48ae855c8657a36014c5b0243ff69f4722
refs/heads/master: 3e8731740e17f01ec1ecce556ccdc4c42279ce1b
7 changes: 7 additions & 0 deletions trunk/Documentation/sound/alsa/ALSA-Configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.

The power-management is supported.

Module snd-cs5535audio
----------------------

Module for multifunction CS5535 companion PCI device

Module supports up to 8 cards.

Module snd-dt019x
-----------------

Expand Down
34 changes: 13 additions & 21 deletions trunk/sound/pci/cs5535audio/cs5535audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions trunk/sound/pci/cs5535audio/cs5535audio.h
Original file line number Diff line number Diff line change
@@ -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

Expand Down
57 changes: 23 additions & 34 deletions trunk/sound/pci/cs5535audio/cs5535audio_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,16 @@ 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;
}
/* we reserved one dummy descriptor at the end to do the PRD jump */
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));

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit 10f8d69

Please sign in to comment.