aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs5535audio/cs5535audio_pcm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 04:15:37 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:16:29 -0500
commit3e8731740e17f01ec1ecce556ccdc4c42279ce1b (patch)
treedada863f577ad8c00b152a9538a4cde36aa240d6 /sound/pci/cs5535audio/cs5535audio_pcm.c
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/cs5535audio_pcm.c')
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pcm.c57
1 files changed, 23 insertions, 34 deletions
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c
index 5802ed9d57be..d32b23f202cd 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,
150 cs5535audio_dma_desc_t *desc = 150 cs5535audio_dma_desc_t *desc =
151 &((cs5535audio_dma_desc_t *) dma->desc_buf.area)[i]; 151 &((cs5535audio_dma_desc_t *) dma->desc_buf.area)[i];
152 desc->addr = cpu_to_le32(addr); 152 desc->addr = cpu_to_le32(addr);
153 desc->size = period_bytes; 153 desc->size = cpu_to_le32(period_bytes);
154 desc->ctlreserved = PRD_EOP; 154 desc->ctlreserved = cpu_to_le32(PRD_EOP);
155 desc_addr += sizeof(cs5535audio_dma_desc_t); 155 desc_addr += sizeof(cs5535audio_dma_desc_t);
156 addr += period_bytes; 156 addr += period_bytes;
157 } 157 }
@@ -159,7 +159,7 @@ static int cs5535audio_build_dma_packets(cs5535audio_t *cs5535au,
159 lastdesc = &((cs5535audio_dma_desc_t *) dma->desc_buf.area)[periods]; 159 lastdesc = &((cs5535audio_dma_desc_t *) dma->desc_buf.area)[periods];
160 lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr); 160 lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr);
161 lastdesc->size = 0; 161 lastdesc->size = 0;
162 lastdesc->ctlreserved = PRD_JMP; 162 lastdesc->ctlreserved = cpu_to_le32(PRD_JMP);
163 jmpprd_addr = cpu_to_le32(lastdesc->addr + 163 jmpprd_addr = cpu_to_le32(lastdesc->addr +
164 (sizeof(cs5535audio_dma_desc_t)*periods)); 164 (sizeof(cs5535audio_dma_desc_t)*periods));
165 165
@@ -272,34 +272,29 @@ static int snd_cs5535audio_trigger(snd_pcm_substream_t *substream, int cmd)
272{ 272{
273 cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream); 273 cs5535audio_t *cs5535au = snd_pcm_substream_chip(substream);
274 cs5535audio_dma_t *dma = substream->runtime->private_data; 274 cs5535audio_dma_t *dma = substream->runtime->private_data;
275 int err = 0;
275 276
277 spin_lock(&cs5535au->reg_lock);
276 switch (cmd) { 278 switch (cmd) {
277 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 279 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
278 spin_lock_irq(&cs5535au->reg_lock); 280 dma->ops->pause_dma(cs5535au);
279 dma->ops->pause_dma(cs5535au); 281 break;
280 spin_unlock_irq(&cs5535au->reg_lock); 282 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
281 break; 283 dma->ops->enable_dma(cs5535au);
282 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 284 break;
283 spin_lock_irq(&cs5535au->reg_lock); 285 case SNDRV_PCM_TRIGGER_START:
284 dma->ops->enable_dma(cs5535au); 286 dma->ops->enable_dma(cs5535au);
285 spin_unlock_irq(&cs5535au->reg_lock); 287 break;
286 break; 288 case SNDRV_PCM_TRIGGER_STOP:
287 case SNDRV_PCM_TRIGGER_START: 289 dma->ops->disable_dma(cs5535au);
288 spin_lock_irq(&cs5535au->reg_lock); 290 break;
289 dma->ops->enable_dma(cs5535au); 291 default:
290 spin_unlock_irq(&cs5535au->reg_lock); 292 snd_printk(KERN_ERR "unhandled trigger\n");
291 break; 293 err = -EINVAL;
292 case SNDRV_PCM_TRIGGER_STOP: 294 break;
293 spin_lock_irq(&cs5535au->reg_lock);
294 dma->ops->disable_dma(cs5535au);
295 spin_unlock_irq(&cs5535au->reg_lock);
296 break;
297 default:
298 snd_printk(KERN_ERR "unhandled trigger\n");
299 return -EINVAL;
300 break;
301 } 295 }
302 return 0; 296 spin_unlock(&cs5535au->reg_lock);
297 return err;
303} 298}
304 299
305static snd_pcm_uframes_t snd_cs5535audio_pcm_pointer(snd_pcm_substream_t 300static 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 = {
375 .pointer = snd_cs5535audio_pcm_pointer, 370 .pointer = snd_cs5535audio_pcm_pointer,
376}; 371};
377 372
378static void snd_cs5535audio_pcm_free(snd_pcm_t *pcm)
379{
380 snd_pcm_lib_preallocate_free_for_all(pcm);
381}
382
383static cs5535audio_dma_ops_t snd_cs5535audio_playback_dma_ops = { 373static cs5535audio_dma_ops_t snd_cs5535audio_playback_dma_ops = {
384 .type = CS5535AUDIO_DMA_PLAYBACK, 374 .type = CS5535AUDIO_DMA_PLAYBACK,
385 .enable_dma = cs5535audio_playback_enable_dma, 375 .enable_dma = cs5535audio_playback_enable_dma,
@@ -417,7 +407,6 @@ int __devinit snd_cs5535audio_pcm(cs5535audio_t *cs5535au)
417 &snd_cs5535audio_capture_ops); 407 &snd_cs5535audio_capture_ops);
418 408
419 pcm->private_data = cs5535au; 409 pcm->private_data = cs5535au;
420 pcm->private_free = snd_cs5535audio_pcm_free;
421 pcm->info_flags = 0; 410 pcm->info_flags = 0;
422 strcpy(pcm->name, "CS5535 Audio"); 411 strcpy(pcm->name, "CS5535 Audio");
423 412