Lines Matching refs:sub

29 	struct uniphier_aio_sub *sub = &aio->sub[compr->direction];  in uniphier_aio_comprdma_new()  local
37 sub->compr_area = kzalloc(size, GFP_KERNEL); in uniphier_aio_comprdma_new()
38 if (!sub->compr_area) in uniphier_aio_comprdma_new()
41 if (sub->swm->dir == PORT_DIR_OUTPUT) in uniphier_aio_comprdma_new()
44 sub->compr_addr = dma_map_single(dev, sub->compr_area, size, dma_dir); in uniphier_aio_comprdma_new()
45 if (dma_mapping_error(dev, sub->compr_addr)) { in uniphier_aio_comprdma_new()
46 kfree(sub->compr_area); in uniphier_aio_comprdma_new()
47 sub->compr_area = NULL; in uniphier_aio_comprdma_new()
52 sub->compr_bytes = size; in uniphier_aio_comprdma_new()
62 struct uniphier_aio_sub *sub = &aio->sub[compr->direction]; in uniphier_aio_comprdma_free() local
65 if (sub->swm->dir == PORT_DIR_OUTPUT) in uniphier_aio_comprdma_free()
68 dma_unmap_single(dev, sub->compr_addr, sub->compr_bytes, dma_dir); in uniphier_aio_comprdma_free()
69 kfree(sub->compr_area); in uniphier_aio_comprdma_free()
70 sub->compr_area = NULL; in uniphier_aio_comprdma_free()
80 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_open() local
83 if (sub->cstream) in uniphier_aio_compr_open()
86 sub->cstream = cstream; in uniphier_aio_compr_open()
87 sub->pass_through = 1; in uniphier_aio_compr_open()
88 sub->use_mmap = false; in uniphier_aio_compr_open()
94 ret = aio_init(sub); in uniphier_aio_compr_open()
106 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_free() local
116 sub->cstream = NULL; in uniphier_aio_compr_free()
127 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_get_params() local
129 *params = sub->cparams.codec; in uniphier_aio_compr_get_params()
140 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_set_params() local
155 sub->iec_pc = IEC61937_PC_AAC; in uniphier_aio_compr_set_params()
157 sub->cparams = *params; in uniphier_aio_compr_set_params()
158 sub->setting = 1; in uniphier_aio_compr_set_params()
160 aio_port_reset(sub); in uniphier_aio_compr_set_params()
161 aio_src_reset(sub); in uniphier_aio_compr_set_params()
171 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_hw_free() local
173 sub->setting = 0; in uniphier_aio_compr_hw_free()
184 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_prepare() local
189 ret = aiodma_ch_set_param(sub); in uniphier_aio_compr_prepare()
193 spin_lock_irqsave(&sub->lock, flags); in uniphier_aio_compr_prepare()
194 ret = aiodma_rb_set_buffer(sub, sub->compr_addr, in uniphier_aio_compr_prepare()
195 sub->compr_addr + sub->compr_bytes, in uniphier_aio_compr_prepare()
197 spin_unlock_irqrestore(&sub->lock, flags); in uniphier_aio_compr_prepare()
201 ret = aio_port_set_param(sub, sub->pass_through, &sub->params); in uniphier_aio_compr_prepare()
204 ret = aio_oport_set_stream_type(sub, sub->iec_pc); in uniphier_aio_compr_prepare()
207 aio_port_set_enable(sub, 1); in uniphier_aio_compr_prepare()
209 ret = aio_if_set_param(sub, sub->pass_through); in uniphier_aio_compr_prepare()
223 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_trigger() local
228 spin_lock_irqsave(&sub->lock, flags); in uniphier_aio_compr_trigger()
231 aiodma_rb_sync(sub, sub->compr_addr, sub->compr_bytes, bytes); in uniphier_aio_compr_trigger()
232 aiodma_ch_set_enable(sub, 1); in uniphier_aio_compr_trigger()
233 sub->running = 1; in uniphier_aio_compr_trigger()
237 sub->running = 0; in uniphier_aio_compr_trigger()
238 aiodma_ch_set_enable(sub, 0); in uniphier_aio_compr_trigger()
245 spin_unlock_irqrestore(&sub->lock, flags); in uniphier_aio_compr_trigger()
257 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_pointer() local
262 spin_lock_irqsave(&sub->lock, flags); in uniphier_aio_compr_pointer()
264 aiodma_rb_sync(sub, sub->compr_addr, sub->compr_bytes, bytes); in uniphier_aio_compr_pointer()
266 if (sub->swm->dir == PORT_DIR_OUTPUT) { in uniphier_aio_compr_pointer()
267 pos = sub->rd_offs; in uniphier_aio_compr_pointer()
269 tstamp->copied_total = sub->rd_total / 2; in uniphier_aio_compr_pointer()
271 pos = sub->wr_offs; in uniphier_aio_compr_pointer()
272 tstamp->copied_total = sub->rd_total; in uniphier_aio_compr_pointer()
276 spin_unlock_irqrestore(&sub->lock, flags); in uniphier_aio_compr_pointer()
281 static int aio_compr_send_to_hw(struct uniphier_aio_sub *sub, in aio_compr_send_to_hw() argument
285 u32 *dstbuf = (u32 *)(sub->compr_area + sub->wr_offs); in aio_compr_send_to_hw()
302 sub->iec_header = true; in aio_compr_send_to_hw()
306 if (sub->iec_header && sub->iec_pc != pc) { in aio_compr_send_to_hw()
308 sub->iec_pc = pc; in aio_compr_send_to_hw()
309 ret = aio_oport_set_stream_type(sub, pc); in aio_compr_send_to_hw()
313 sub->iec_header = false; in aio_compr_send_to_hw()
332 struct uniphier_aio_sub *sub = &aio->sub[cstream->direction]; in uniphier_aio_compr_copy() local
333 size_t cnt = min_t(size_t, count, aio_rb_space_to_end(sub) / 2); in uniphier_aio_compr_copy()
342 if (sub->swm->dir == PORT_DIR_OUTPUT) { in uniphier_aio_compr_copy()
343 dma_addr_t dmapos = sub->compr_addr + sub->wr_offs; in uniphier_aio_compr_copy()
349 ret = aio_compr_send_to_hw(sub, buf, s); in uniphier_aio_compr_copy()
352 dma_addr_t dmapos = sub->compr_addr + sub->rd_offs; in uniphier_aio_compr_copy()
357 ret = copy_to_user(buf, sub->compr_area + sub->rd_offs, s); in uniphier_aio_compr_copy()
363 spin_lock_irqsave(&sub->lock, flags); in uniphier_aio_compr_copy()
365 sub->threshold = 2 * bytes; in uniphier_aio_compr_copy()
366 aiodma_rb_set_threshold(sub, sub->compr_bytes, 2 * bytes); in uniphier_aio_compr_copy()
368 if (sub->swm->dir == PORT_DIR_OUTPUT) { in uniphier_aio_compr_copy()
369 sub->wr_offs += s; in uniphier_aio_compr_copy()
370 if (sub->wr_offs >= sub->compr_bytes) in uniphier_aio_compr_copy()
371 sub->wr_offs -= sub->compr_bytes; in uniphier_aio_compr_copy()
373 sub->rd_offs += s; in uniphier_aio_compr_copy()
374 if (sub->rd_offs >= sub->compr_bytes) in uniphier_aio_compr_copy()
375 sub->rd_offs -= sub->compr_bytes; in uniphier_aio_compr_copy()
377 aiodma_rb_sync(sub, sub->compr_addr, sub->compr_bytes, bytes); in uniphier_aio_compr_copy()
379 spin_unlock_irqrestore(&sub->lock, flags); in uniphier_aio_compr_copy()