Lines Matching refs:prtd

96 	struct qmc_dai_prtd *prtd = substream->runtime->private_data;  in qmc_audio_pcm_hw_params()  local
103 prtd->channels = qmc_audio_access_is_interleaved(params_access(params)) ? in qmc_audio_pcm_hw_params()
106 prtd->substream = substream; in qmc_audio_pcm_hw_params()
108 prtd->buffer_ended = 0; in qmc_audio_pcm_hw_params()
109 prtd->buffer_size = params_buffer_size(params); in qmc_audio_pcm_hw_params()
110 prtd->period_size = params_period_size(params); in qmc_audio_pcm_hw_params()
112 prtd->ch_dma_addr_start = runtime->dma_addr; in qmc_audio_pcm_hw_params()
113 prtd->ch_dma_offset = params_buffer_bytes(params) / prtd->channels; in qmc_audio_pcm_hw_params()
114 prtd->ch_dma_addr_end = runtime->dma_addr + prtd->ch_dma_offset; in qmc_audio_pcm_hw_params()
115 prtd->ch_dma_addr_current = prtd->ch_dma_addr_start; in qmc_audio_pcm_hw_params()
116 prtd->ch_dma_size = params_period_bytes(params) / prtd->channels; in qmc_audio_pcm_hw_params()
123 static int qmc_audio_pcm_write_submit(struct qmc_dai_prtd *prtd) in qmc_audio_pcm_write_submit() argument
128 for (i = 0; i < prtd->channels; i++) { in qmc_audio_pcm_write_submit()
129 bitmap_set(prtd->chans_pending, i, 1); in qmc_audio_pcm_write_submit()
131 ret = qmc_chan_write_submit(prtd->qmc_dai->chans[i].qmc_chan, in qmc_audio_pcm_write_submit()
132 prtd->ch_dma_addr_current + i * prtd->ch_dma_offset, in qmc_audio_pcm_write_submit()
133 prtd->ch_dma_size, in qmc_audio_pcm_write_submit()
135 &prtd->qmc_dai->chans[i]); in qmc_audio_pcm_write_submit()
137 dev_err(prtd->qmc_dai->dev, "write_submit %u failed %d\n", in qmc_audio_pcm_write_submit()
139 bitmap_clear(prtd->chans_pending, i, 1); in qmc_audio_pcm_write_submit()
150 struct qmc_dai_prtd *prtd; in qmc_audio_pcm_write_complete() local
152 prtd = chan->prtd_tx; in qmc_audio_pcm_write_complete()
155 bitmap_clear(prtd->chans_pending, chan - prtd->qmc_dai->chans, 1); in qmc_audio_pcm_write_complete()
161 if (!bitmap_empty(prtd->chans_pending, 64)) in qmc_audio_pcm_write_complete()
164 prtd->buffer_ended += prtd->period_size; in qmc_audio_pcm_write_complete()
165 if (prtd->buffer_ended >= prtd->buffer_size) in qmc_audio_pcm_write_complete()
166 prtd->buffer_ended = 0; in qmc_audio_pcm_write_complete()
168 prtd->ch_dma_addr_current += prtd->ch_dma_size; in qmc_audio_pcm_write_complete()
169 if (prtd->ch_dma_addr_current >= prtd->ch_dma_addr_end) in qmc_audio_pcm_write_complete()
170 prtd->ch_dma_addr_current = prtd->ch_dma_addr_start; in qmc_audio_pcm_write_complete()
172 qmc_audio_pcm_write_submit(prtd); in qmc_audio_pcm_write_complete()
174 snd_pcm_period_elapsed(prtd->substream); in qmc_audio_pcm_write_complete()
179 static int qmc_audio_pcm_read_submit(struct qmc_dai_prtd *prtd) in qmc_audio_pcm_read_submit() argument
184 for (i = 0; i < prtd->channels; i++) { in qmc_audio_pcm_read_submit()
185 bitmap_set(prtd->chans_pending, i, 1); in qmc_audio_pcm_read_submit()
187 ret = qmc_chan_read_submit(prtd->qmc_dai->chans[i].qmc_chan, in qmc_audio_pcm_read_submit()
188 prtd->ch_dma_addr_current + i * prtd->ch_dma_offset, in qmc_audio_pcm_read_submit()
189 prtd->ch_dma_size, in qmc_audio_pcm_read_submit()
191 &prtd->qmc_dai->chans[i]); in qmc_audio_pcm_read_submit()
193 dev_err(prtd->qmc_dai->dev, "read_submit %u failed %d\n", in qmc_audio_pcm_read_submit()
195 bitmap_clear(prtd->chans_pending, i, 1); in qmc_audio_pcm_read_submit()
206 struct qmc_dai_prtd *prtd; in qmc_audio_pcm_read_complete() local
208 prtd = chan->prtd_rx; in qmc_audio_pcm_read_complete()
211 bitmap_clear(prtd->chans_pending, chan - prtd->qmc_dai->chans, 1); in qmc_audio_pcm_read_complete()
213 if (length != prtd->ch_dma_size) { in qmc_audio_pcm_read_complete()
214 dev_err(prtd->qmc_dai->dev, "read complete length = %zu, exp %zu\n", in qmc_audio_pcm_read_complete()
215 length, prtd->ch_dma_size); in qmc_audio_pcm_read_complete()
222 if (!bitmap_empty(prtd->chans_pending, 64)) in qmc_audio_pcm_read_complete()
225 prtd->buffer_ended += prtd->period_size; in qmc_audio_pcm_read_complete()
226 if (prtd->buffer_ended >= prtd->buffer_size) in qmc_audio_pcm_read_complete()
227 prtd->buffer_ended = 0; in qmc_audio_pcm_read_complete()
229 prtd->ch_dma_addr_current += prtd->ch_dma_size; in qmc_audio_pcm_read_complete()
230 if (prtd->ch_dma_addr_current >= prtd->ch_dma_addr_end) in qmc_audio_pcm_read_complete()
231 prtd->ch_dma_addr_current = prtd->ch_dma_addr_start; in qmc_audio_pcm_read_complete()
233 qmc_audio_pcm_read_submit(prtd); in qmc_audio_pcm_read_complete()
235 snd_pcm_period_elapsed(prtd->substream); in qmc_audio_pcm_read_complete()
241 struct qmc_dai_prtd *prtd = substream->runtime->private_data; in qmc_audio_pcm_trigger() local
245 if (!prtd->qmc_dai) { in qmc_audio_pcm_trigger()
252 bitmap_zero(prtd->chans_pending, 64); in qmc_audio_pcm_trigger()
254 for (i = 0; i < prtd->channels; i++) in qmc_audio_pcm_trigger()
255 prtd->qmc_dai->chans[i].prtd_tx = prtd; in qmc_audio_pcm_trigger()
258 ret = qmc_audio_pcm_write_submit(prtd); in qmc_audio_pcm_trigger()
263 prtd->ch_dma_addr_current += prtd->ch_dma_size; in qmc_audio_pcm_trigger()
264 if (prtd->ch_dma_addr_current >= prtd->ch_dma_addr_end) in qmc_audio_pcm_trigger()
265 prtd->ch_dma_addr_current = prtd->ch_dma_addr_start; in qmc_audio_pcm_trigger()
268 ret = qmc_audio_pcm_write_submit(prtd); in qmc_audio_pcm_trigger()
272 for (i = 0; i < prtd->channels; i++) in qmc_audio_pcm_trigger()
273 prtd->qmc_dai->chans[i].prtd_rx = prtd; in qmc_audio_pcm_trigger()
276 ret = qmc_audio_pcm_read_submit(prtd); in qmc_audio_pcm_trigger()
281 prtd->ch_dma_addr_current += prtd->ch_dma_size; in qmc_audio_pcm_trigger()
282 if (prtd->ch_dma_addr_current >= prtd->ch_dma_addr_end) in qmc_audio_pcm_trigger()
283 prtd->ch_dma_addr_current = prtd->ch_dma_addr_start; in qmc_audio_pcm_trigger()
286 ret = qmc_audio_pcm_read_submit(prtd); in qmc_audio_pcm_trigger()
311 struct qmc_dai_prtd *prtd = substream->runtime->private_data; in qmc_audio_pcm_pointer() local
313 return prtd->buffer_ended; in qmc_audio_pcm_pointer()
353 struct qmc_dai_prtd *prtd; in qmc_audio_pcm_open() local
363 prtd = kzalloc(sizeof(*prtd), GFP_KERNEL); in qmc_audio_pcm_open()
364 if (!prtd) in qmc_audio_pcm_open()
367 runtime->private_data = prtd; in qmc_audio_pcm_open()
375 struct qmc_dai_prtd *prtd = substream->runtime->private_data; in qmc_audio_pcm_close() local
377 kfree(prtd); in qmc_audio_pcm_close()
594 struct qmc_dai_prtd *prtd = substream->runtime->private_data; in qmc_dai_startup() local
603 prtd->qmc_dai = qmc_dai; in qmc_dai_startup()