Lines Matching full:ac

38 		struct tw686x_audio_channel *ac = &dev->audio_channels[ch];  in tw686x_audio_irq()  local
45 spin_lock_irqsave(&ac->lock, flags); in tw686x_audio_irq()
48 if (!ac->ss || !ac->curr_bufs[0] || !ac->curr_bufs[1]) { in tw686x_audio_irq()
49 spin_unlock_irqrestore(&ac->lock, flags); in tw686x_audio_irq()
53 if (!list_empty(&ac->buf_list)) { in tw686x_audio_irq()
54 next = list_first_entry(&ac->buf_list, in tw686x_audio_irq()
56 list_move_tail(&next->list, &ac->buf_list); in tw686x_audio_irq()
57 done = ac->curr_bufs[!pb]; in tw686x_audio_irq()
58 ac->curr_bufs[pb] = next; in tw686x_audio_irq()
60 spin_unlock_irqrestore(&ac->lock, flags); in tw686x_audio_irq()
68 desc = &ac->dma_descs[pb]; in tw686x_audio_irq()
76 ac->ptr = done->dma - ac->buf[0].dma; in tw686x_audio_irq()
77 snd_pcm_period_elapsed(ac->ss); in tw686x_audio_irq()
107 struct tw686x_audio_channel *ac = &dev->audio_channels[ss->number]; in tw686x_pcm_open() local
111 ac->ss = ss; in tw686x_pcm_open()
124 struct tw686x_audio_channel *ac = &dev->audio_channels[ss->number]; in tw686x_pcm_close() local
126 ac->ss = NULL; in tw686x_pcm_close()
133 struct tw686x_audio_channel *ac = &dev->audio_channels[ss->number]; in tw686x_pcm_prepare() local
149 tw686x_disable_channel(dev, AUDIO_CHANNEL_OFFSET + ac->ch); in tw686x_pcm_prepare()
177 spin_lock_irqsave(&ac->lock, flags); in tw686x_pcm_prepare()
178 INIT_LIST_HEAD(&ac->buf_list); in tw686x_pcm_prepare()
181 ac->buf[i].dma = rt->dma_addr + period_size * i; in tw686x_pcm_prepare()
182 ac->buf[i].virt = rt->dma_area + period_size * i; in tw686x_pcm_prepare()
183 INIT_LIST_HEAD(&ac->buf[i].list); in tw686x_pcm_prepare()
184 list_add_tail(&ac->buf[i].list, &ac->buf_list); in tw686x_pcm_prepare()
187 p_buf = list_first_entry(&ac->buf_list, struct tw686x_audio_buf, list); in tw686x_pcm_prepare()
188 list_move_tail(&p_buf->list, &ac->buf_list); in tw686x_pcm_prepare()
190 b_buf = list_first_entry(&ac->buf_list, struct tw686x_audio_buf, list); in tw686x_pcm_prepare()
191 list_move_tail(&b_buf->list, &ac->buf_list); in tw686x_pcm_prepare()
193 ac->curr_bufs[0] = p_buf; in tw686x_pcm_prepare()
194 ac->curr_bufs[1] = b_buf; in tw686x_pcm_prepare()
195 ac->ptr = 0; in tw686x_pcm_prepare()
198 reg_write(dev, ADMA_P_ADDR[ac->ch], p_buf->dma); in tw686x_pcm_prepare()
199 reg_write(dev, ADMA_B_ADDR[ac->ch], b_buf->dma); in tw686x_pcm_prepare()
202 spin_unlock_irqrestore(&ac->lock, flags); in tw686x_pcm_prepare()
214 struct tw686x_audio_channel *ac = &dev->audio_channels[ss->number]; in tw686x_pcm_trigger() local
220 if (ac->curr_bufs[0] && ac->curr_bufs[1]) { in tw686x_pcm_trigger()
224 AUDIO_CHANNEL_OFFSET + ac->ch); in tw686x_pcm_trigger()
236 tw686x_disable_channel(dev, AUDIO_CHANNEL_OFFSET + ac->ch); in tw686x_pcm_trigger()
239 spin_lock_irqsave(&ac->lock, flags); in tw686x_pcm_trigger()
240 ac->curr_bufs[0] = NULL; in tw686x_pcm_trigger()
241 ac->curr_bufs[1] = NULL; in tw686x_pcm_trigger()
242 spin_unlock_irqrestore(&ac->lock, flags); in tw686x_pcm_trigger()
253 struct tw686x_audio_channel *ac = &dev->audio_channels[ss->number]; in tw686x_pcm_pointer() local
255 return bytes_to_frames(ss->runtime, ac->ptr); in tw686x_pcm_pointer()
296 struct tw686x_audio_channel *ac) in tw686x_audio_dma_free() argument
301 if (!ac->dma_descs[pb].virt) in tw686x_audio_dma_free()
303 pci_free_consistent(dev->pci_dev, ac->dma_descs[pb].size, in tw686x_audio_dma_free()
304 ac->dma_descs[pb].virt, in tw686x_audio_dma_free()
305 ac->dma_descs[pb].phys); in tw686x_audio_dma_free()
306 ac->dma_descs[pb].virt = NULL; in tw686x_audio_dma_free()
311 struct tw686x_audio_channel *ac) in tw686x_audio_dma_alloc() argument
324 u32 reg = pb ? ADMA_B_ADDR[ac->ch] : ADMA_P_ADDR[ac->ch]; in tw686x_audio_dma_alloc()
328 &ac->dma_descs[pb].phys); in tw686x_audio_dma_alloc()
332 ac->ch, pb ? "B" : "P"); in tw686x_audio_dma_alloc()
335 ac->dma_descs[pb].virt = virt; in tw686x_audio_dma_alloc()
336 ac->dma_descs[pb].size = AUDIO_DMA_SIZE_MAX; in tw686x_audio_dma_alloc()
337 reg_write(dev, reg, ac->dma_descs[pb].phys); in tw686x_audio_dma_alloc()
383 struct tw686x_audio_channel *ac; in tw686x_audio_init() local
385 ac = &dev->audio_channels[ch]; in tw686x_audio_init()
386 spin_lock_init(&ac->lock); in tw686x_audio_init()
387 ac->dev = dev; in tw686x_audio_init()
388 ac->ch = ch; in tw686x_audio_init()
390 err = tw686x_audio_dma_alloc(dev, ac); in tw686x_audio_init()