X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=sound%2Fpci%2Fcs5535audio%2Fcs5535audio_pcm.c;h=cdcda87116c34bc895b49e8def2ffa28a4c22491;hb=b17b3d479c4c43c3a980ee553c3be3ca456523de;hp=60bb82b2ff473c0cedec1f00b67644a0c6aa8c83;hpb=9fdb62af92c741addbea15545f214a6e89460865;p=linux-2.6 diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index 60bb82b2ff..cdcda87116 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -43,7 +42,7 @@ static struct snd_pcm_hardware snd_cs5535audio_playback = SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE | - SNDRV_PCM_INFO_SYNC_START + SNDRV_PCM_INFO_RESUME ), .formats = ( SNDRV_PCM_FMTBIT_S16_LE @@ -70,8 +69,7 @@ static struct snd_pcm_hardware snd_cs5535audio_capture = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_SYNC_START + SNDRV_PCM_INFO_MMAP_VALID ), .formats = ( SNDRV_PCM_FMTBIT_S16_LE @@ -99,9 +97,10 @@ static int snd_cs5535audio_playback_open(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; runtime->hw = snd_cs5535audio_playback; + runtime->hw.rates = cs5535au->ac97->rates[AC97_RATES_FRONT_DAC]; + snd_pcm_limit_hw_rates(runtime); cs5535au->playback_substream = substream; runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_PLAYBACK]); - snd_pcm_set_sync(substream); if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) return err; @@ -142,7 +141,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au, if (dma->periods == periods && dma->period_bytes == period_bytes) return 0; - /* the u32 cast is okay because in snd*create we succesfully told + /* the u32 cast is okay because in snd*create we successfully told pci alloc that we're only 32 bit capable so the uppper will be 0 */ addr = (u32) substream->runtime->dma_addr; desc_addr = (u32) dma->desc_buf.addr; @@ -163,6 +162,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au, jmpprd_addr = cpu_to_le32(lastdesc->addr + (sizeof(struct cs5535audio_dma_desc)*periods)); + dma->substream = substream; dma->period_bytes = period_bytes; dma->periods = periods; spin_lock_irq(&cs5535au->reg_lock); @@ -193,6 +193,11 @@ static void cs5535audio_playback_setup_prd(struct cs5535audio *cs5535au, cs_writel(cs5535au, ACC_BM0_PRD, prd_addr); } +static u32 cs5535audio_playback_read_prd(struct cs5535audio *cs5535au) +{ + return cs_readl(cs5535au, ACC_BM0_PRD); +} + static u32 cs5535audio_playback_read_dma_pntr(struct cs5535audio *cs5535au) { return cs_readl(cs5535au, ACC_BM0_PNTR); @@ -219,6 +224,11 @@ static void cs5535audio_capture_setup_prd(struct cs5535audio *cs5535au, cs_writel(cs5535au, ACC_BM1_PRD, prd_addr); } +static u32 cs5535audio_capture_read_prd(struct cs5535audio *cs5535au) +{ + return cs_readl(cs5535au, ACC_BM1_PRD); +} + static u32 cs5535audio_capture_read_dma_pntr(struct cs5535audio *cs5535au) { return cs_readl(cs5535au, ACC_BM1_PNTR); @@ -230,6 +240,7 @@ static void cs5535audio_clear_dma_packets(struct cs5535audio *cs5535au, { snd_dma_free_pages(&dma->desc_buf); dma->desc_buf.area = NULL; + dma->substream = NULL; } static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream, @@ -285,9 +296,15 @@ static int snd_cs5535audio_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: dma->ops->enable_dma(cs5535au); break; + case SNDRV_PCM_TRIGGER_RESUME: + dma->ops->enable_dma(cs5535au); + break; case SNDRV_PCM_TRIGGER_STOP: dma->ops->disable_dma(cs5535au); break; + case SNDRV_PCM_TRIGGER_SUSPEND: + dma->ops->disable_dma(cs5535au); + break; default: snd_printk(KERN_ERR "unhandled trigger\n"); err = -EINVAL; @@ -327,9 +344,10 @@ static int snd_cs5535audio_capture_open(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; runtime->hw = snd_cs5535audio_capture; + runtime->hw.rates = cs5535au->ac97->rates[AC97_RATES_ADC]; + snd_pcm_limit_hw_rates(runtime); cs5535au->capture_substream = substream; runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_CAPTURE]); - snd_pcm_set_sync(substream); if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) return err; @@ -375,6 +393,7 @@ static struct cs5535audio_dma_ops snd_cs5535audio_playback_dma_ops = { .enable_dma = cs5535audio_playback_enable_dma, .disable_dma = cs5535audio_playback_disable_dma, .setup_prd = cs5535audio_playback_setup_prd, + .read_prd = cs5535audio_playback_read_prd, .pause_dma = cs5535audio_playback_pause_dma, .read_dma_pntr = cs5535audio_playback_read_dma_pntr, }; @@ -384,6 +403,7 @@ static struct cs5535audio_dma_ops snd_cs5535audio_capture_dma_ops = { .enable_dma = cs5535audio_capture_enable_dma, .disable_dma = cs5535audio_capture_disable_dma, .setup_prd = cs5535audio_capture_setup_prd, + .read_prd = cs5535audio_capture_read_prd, .pause_dma = cs5535audio_capture_pause_dma, .read_dma_pntr = cs5535audio_capture_read_dma_pntr, }; @@ -413,6 +433,7 @@ int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535au) snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(cs5535au->pci), 64*1024, 128*1024); + cs5535au->pcm = pcm; return 0; }