Lines Matching refs:stream
42 struct audio_stream stream[2]; /* playback & capture */ member
45 static void au1000_release_dma_link(struct audio_stream *stream) in au1000_release_dma_link() argument
50 stream->period_size = 0; in au1000_release_dma_link()
51 stream->periods = 0; in au1000_release_dma_link()
52 pointer = stream->buffer; in au1000_release_dma_link()
59 } while (pointer != stream->buffer); in au1000_release_dma_link()
60 stream->buffer = NULL; in au1000_release_dma_link()
63 static int au1000_setup_dma_link(struct audio_stream *stream, in au1000_setup_dma_link() argument
67 struct snd_pcm_substream *substream = stream->substream; in au1000_setup_dma_link()
75 if (stream->period_size == period_bytes && in au1000_setup_dma_link()
76 stream->periods == periods) in au1000_setup_dma_link()
79 au1000_release_dma_link(stream); in au1000_setup_dma_link()
81 stream->period_size = period_bytes; in au1000_setup_dma_link()
82 stream->periods = periods; in au1000_setup_dma_link()
84 stream->buffer = kmalloc(sizeof(struct pcm_period), GFP_KERNEL); in au1000_setup_dma_link()
85 if (!stream->buffer) in au1000_setup_dma_link()
87 pointer = stream->buffer; in au1000_setup_dma_link()
95 au1000_release_dma_link(stream); in au1000_setup_dma_link()
101 pointer->next = stream->buffer; in au1000_setup_dma_link()
105 static void au1000_dma_stop(struct audio_stream *stream) in au1000_dma_stop() argument
107 if (stream->buffer) in au1000_dma_stop()
108 disable_dma(stream->dma); in au1000_dma_stop()
111 static void au1000_dma_start(struct audio_stream *stream) in au1000_dma_start() argument
113 if (!stream->buffer) in au1000_dma_start()
116 init_dma(stream->dma); in au1000_dma_start()
117 if (get_dma_active_buffer(stream->dma) == 0) { in au1000_dma_start()
118 clear_dma_done0(stream->dma); in au1000_dma_start()
119 set_dma_addr0(stream->dma, stream->buffer->start); in au1000_dma_start()
120 set_dma_count0(stream->dma, stream->period_size >> 1); in au1000_dma_start()
121 set_dma_addr1(stream->dma, stream->buffer->next->start); in au1000_dma_start()
122 set_dma_count1(stream->dma, stream->period_size >> 1); in au1000_dma_start()
124 clear_dma_done1(stream->dma); in au1000_dma_start()
125 set_dma_addr1(stream->dma, stream->buffer->start); in au1000_dma_start()
126 set_dma_count1(stream->dma, stream->period_size >> 1); in au1000_dma_start()
127 set_dma_addr0(stream->dma, stream->buffer->next->start); in au1000_dma_start()
128 set_dma_count0(stream->dma, stream->period_size >> 1); in au1000_dma_start()
130 enable_dma_buffers(stream->dma); in au1000_dma_start()
131 start_dma(stream->dma); in au1000_dma_start()
136 struct audio_stream *stream = (struct audio_stream *)ptr; in au1000_dma_interrupt() local
137 struct snd_pcm_substream *substream = stream->substream; in au1000_dma_interrupt()
139 switch (get_dma_buffer_done(stream->dma)) { in au1000_dma_interrupt()
141 stream->buffer = stream->buffer->next; in au1000_dma_interrupt()
142 clear_dma_done0(stream->dma); in au1000_dma_interrupt()
143 set_dma_addr0(stream->dma, stream->buffer->next->start); in au1000_dma_interrupt()
144 set_dma_count0(stream->dma, stream->period_size >> 1); in au1000_dma_interrupt()
145 enable_dma_buffer0(stream->dma); in au1000_dma_interrupt()
148 stream->buffer = stream->buffer->next; in au1000_dma_interrupt()
149 clear_dma_done1(stream->dma); in au1000_dma_interrupt()
150 set_dma_addr1(stream->dma, stream->buffer->next->start); in au1000_dma_interrupt()
151 set_dma_count1(stream->dma, stream->period_size >> 1); in au1000_dma_interrupt()
152 enable_dma_buffer1(stream->dma); in au1000_dma_interrupt()
155 pr_debug("DMA %d missed interrupt.\n", stream->dma); in au1000_dma_interrupt()
156 au1000_dma_stop(stream); in au1000_dma_interrupt()
157 au1000_dma_start(stream); in au1000_dma_interrupt()
160 pr_debug("DMA %d empty irq.\n", stream->dma); in au1000_dma_interrupt()
187 return &(ctx->stream[ss->stream]); in ss_to_as()
195 int *dmaids, s = substream->stream; in alchemy_pcm_open()
204 ctx->stream[s].dma = request_au1000_dma(dmaids[s], name, in alchemy_pcm_open()
206 &ctx->stream[s]); in alchemy_pcm_open()
207 set_dma_mode(ctx->stream[s].dma, in alchemy_pcm_open()
208 get_dma_mode(ctx->stream[s].dma) & ~DMA_NC); in alchemy_pcm_open()
210 ctx->stream[s].substream = substream; in alchemy_pcm_open()
211 ctx->stream[s].buffer = NULL; in alchemy_pcm_open()
221 int stype = substream->stream; in alchemy_pcm_close()
223 ctx->stream[stype].substream = NULL; in alchemy_pcm_close()
224 free_au1000_dma(ctx->stream[stype].dma); in alchemy_pcm_close()
233 struct audio_stream *stream = ss_to_as(substream, component); in alchemy_pcm_hw_params() local
235 return au1000_setup_dma_link(stream, in alchemy_pcm_hw_params()
243 struct audio_stream *stream = ss_to_as(substream, component); in alchemy_pcm_hw_free() local
244 au1000_release_dma_link(stream); in alchemy_pcm_hw_free()
251 struct audio_stream *stream = ss_to_as(substream, component); in alchemy_pcm_trigger() local
256 au1000_dma_start(stream); in alchemy_pcm_trigger()
259 au1000_dma_stop(stream); in alchemy_pcm_trigger()
271 struct audio_stream *stream = ss_to_as(ss, component); in alchemy_pcm_pointer() local
274 location = get_dma_residue(stream->dma); in alchemy_pcm_pointer()
275 location = stream->buffer->relative_end - location; in alchemy_pcm_pointer()