Lines Matching refs:dmadata
51 struct txx9aclc_dmadata *dmadata = runtime->private_data;
69 dmadata->substream = substream;
70 dmadata->pos = 0;
82 struct txx9aclc_dmadata *dmadata = runtime->private_data;
84 dmadata->dma_addr = runtime->dma_addr;
85 dmadata->buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
86 dmadata->period_bytes = snd_pcm_lib_period_bytes(substream);
88 if (dmadata->buffer_bytes == dmadata->period_bytes) {
89 dmadata->frag_bytes = dmadata->period_bytes >> 1;
90 dmadata->frags = 2;
92 dmadata->frag_bytes = dmadata->period_bytes;
93 dmadata->frags = dmadata->buffer_bytes / dmadata->period_bytes;
95 dmadata->frag_count = 0;
96 dmadata->pos = 0;
102 struct txx9aclc_dmadata *dmadata = arg;
106 spin_lock_irqsave(&dmadata->dma_lock, flags);
107 if (dmadata->frag_count >= 0) {
108 dmadata->dmacount--;
109 BUG_ON(dmadata->dmacount < 0);
110 tasklet_schedule(&dmadata->tasklet);
112 spin_unlock_irqrestore(&dmadata->dma_lock, flags);
116 txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr)
118 struct dma_chan *chan = dmadata->dma_chan;
124 dmadata->frag_bytes, buf_dma_addr & (PAGE_SIZE - 1));
127 dmadata->substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
135 desc->callback_param = dmadata;
144 struct txx9aclc_dmadata *dmadata = (struct txx9aclc_dmadata *)data;
145 struct dma_chan *chan = dmadata->dma_chan;
147 struct snd_pcm_substream *substream = dmadata->substream;
153 spin_lock_irqsave(&dmadata->dma_lock, flags);
154 if (dmadata->frag_count < 0) {
156 container_of(dmadata, struct txx9aclc_soc_device,
157 dmadata[substream->stream]);
162 spin_unlock_irqrestore(&dmadata->dma_lock, flags);
166 desc = txx9aclc_dma_submit(dmadata,
167 dmadata->dma_addr + i * dmadata->frag_bytes);
171 dmadata->dmacount = NR_DMA_CHAIN;
173 spin_lock_irqsave(&dmadata->dma_lock, flags);
175 dmadata->frag_count = NR_DMA_CHAIN % dmadata->frags;
176 spin_unlock_irqrestore(&dmadata->dma_lock, flags);
179 BUG_ON(dmadata->dmacount >= NR_DMA_CHAIN);
180 while (dmadata->dmacount < NR_DMA_CHAIN) {
181 dmadata->dmacount++;
182 spin_unlock_irqrestore(&dmadata->dma_lock, flags);
183 desc = txx9aclc_dma_submit(dmadata,
184 dmadata->dma_addr +
185 dmadata->frag_count * dmadata->frag_bytes);
190 spin_lock_irqsave(&dmadata->dma_lock, flags);
191 dmadata->frag_count++;
192 dmadata->frag_count %= dmadata->frags;
193 dmadata->pos += dmadata->frag_bytes;
194 dmadata->pos %= dmadata->buffer_bytes;
195 if ((dmadata->frag_count * dmadata->frag_bytes) %
196 dmadata->period_bytes == 0)
199 spin_unlock_irqrestore(&dmadata->dma_lock, flags);
204 struct txx9aclc_dmadata *dmadata = substream->runtime->private_data;
215 spin_lock_irqsave(&dmadata->dma_lock, flags);
218 dmadata->frag_count = -1;
219 tasklet_schedule(&dmadata->tasklet);
233 spin_unlock_irqrestore(&dmadata->dma_lock, flags);
240 struct txx9aclc_dmadata *dmadata = substream->runtime->private_data;
242 return bytes_to_frames(substream->runtime, dmadata->pos);
250 struct txx9aclc_dmadata *dmadata = &dev->dmadata[substream->stream];
261 substream->runtime->private_data = dmadata;
267 struct txx9aclc_dmadata *dmadata = substream->runtime->private_data;
268 struct dma_chan *chan = dmadata->dma_chan;
270 dmadata->frag_count = -1;
300 struct txx9aclc_dmadata *dmadata = param;
304 devname = kasprintf(GFP_KERNEL, "%s.%d", dmadata->dma_res->name,
305 (int)dmadata->dma_res->start);
307 chan->private = &dmadata->dma_slave;
315 struct txx9aclc_dmadata *dmadata)
318 struct txx9dmac_slave *ds = &dmadata->dma_slave;
321 spin_lock_init(&dmadata->dma_lock);
324 if (dmadata->stream == SNDRV_PCM_STREAM_PLAYBACK) {
335 dmadata->dma_chan = dma_request_channel(mask, filter, dmadata);
336 if (!dmadata->dma_chan) {
339 dmadata->stream == SNDRV_PCM_STREAM_PLAYBACK ?
343 tasklet_init(&dmadata->tasklet, txx9aclc_dma_tasklet,
344 (unsigned long)dmadata);
357 dev->dmadata[0].stream = SNDRV_PCM_STREAM_PLAYBACK;
358 dev->dmadata[1].stream = SNDRV_PCM_STREAM_CAPTURE;
365 dev->dmadata[i].dma_res = r;
366 ret = txx9aclc_dma_init(dev, &dev->dmadata[i]);
374 if (dev->dmadata[i].dma_chan)
375 dma_release_channel(dev->dmadata[i].dma_chan);
376 dev->dmadata[i].dma_chan = NULL;
396 struct txx9aclc_dmadata *dmadata = &dev->dmadata[i];
397 struct dma_chan *chan = dmadata->dma_chan;
399 dmadata->frag_count = -1;
404 dev->dmadata[i].dma_chan = NULL;