Lines Matching +full:tx +full:- +full:only

1 // SPDX-License-Identifier: GPL-2.0-only
12 #include "virt-dma.h"
14 static struct virt_dma_desc *to_virt_desc(struct dma_async_tx_descriptor *tx) in to_virt_desc() argument
16 return container_of(tx, struct virt_dma_desc, tx); in to_virt_desc()
19 dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *tx) in vchan_tx_submit() argument
21 struct virt_dma_chan *vc = to_virt_chan(tx->chan); in vchan_tx_submit()
22 struct virt_dma_desc *vd = to_virt_desc(tx); in vchan_tx_submit()
26 spin_lock_irqsave(&vc->lock, flags); in vchan_tx_submit()
27 cookie = dma_cookie_assign(tx); in vchan_tx_submit()
29 list_move_tail(&vd->node, &vc->desc_submitted); in vchan_tx_submit()
30 spin_unlock_irqrestore(&vc->lock, flags); in vchan_tx_submit()
32 dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: submitted\n", in vchan_tx_submit()
40 * vchan_tx_desc_free - free a reusable descriptor
41 * @tx: the transfer
43 * This function frees a previously allocated reusable descriptor. The only
49 int vchan_tx_desc_free(struct dma_async_tx_descriptor *tx) in vchan_tx_desc_free() argument
51 struct virt_dma_chan *vc = to_virt_chan(tx->chan); in vchan_tx_desc_free()
52 struct virt_dma_desc *vd = to_virt_desc(tx); in vchan_tx_desc_free()
55 spin_lock_irqsave(&vc->lock, flags); in vchan_tx_desc_free()
56 list_del(&vd->node); in vchan_tx_desc_free()
57 spin_unlock_irqrestore(&vc->lock, flags); in vchan_tx_desc_free()
59 dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: freeing\n", in vchan_tx_desc_free()
60 vc, vd, vd->tx.cookie); in vchan_tx_desc_free()
61 vc->desc_free(vd); in vchan_tx_desc_free()
71 list_for_each_entry(vd, &vc->desc_issued, node) in vchan_find_desc()
72 if (vd->tx.cookie == cookie) in vchan_find_desc()
90 spin_lock_irq(&vc->lock); in vchan_complete()
91 list_splice_tail_init(&vc->desc_completed, &head); in vchan_complete()
92 vd = vc->cyclic; in vchan_complete()
94 vc->cyclic = NULL; in vchan_complete()
95 dmaengine_desc_get_callback(&vd->tx, &cb); in vchan_complete()
99 spin_unlock_irq(&vc->lock); in vchan_complete()
101 dmaengine_desc_callback_invoke(&cb, &vd->tx_result); in vchan_complete()
104 dmaengine_desc_get_callback(&vd->tx, &cb); in vchan_complete()
106 list_del(&vd->node); in vchan_complete()
107 dmaengine_desc_callback_invoke(&cb, &vd->tx_result); in vchan_complete()
117 list_del(&vd->node); in vchan_dma_desc_free_list()
125 dma_cookie_init(&vc->chan); in vchan_init()
127 spin_lock_init(&vc->lock); in vchan_init()
128 INIT_LIST_HEAD(&vc->desc_allocated); in vchan_init()
129 INIT_LIST_HEAD(&vc->desc_submitted); in vchan_init()
130 INIT_LIST_HEAD(&vc->desc_issued); in vchan_init()
131 INIT_LIST_HEAD(&vc->desc_completed); in vchan_init()
132 INIT_LIST_HEAD(&vc->desc_terminated); in vchan_init()
134 tasklet_setup(&vc->task, vchan_complete); in vchan_init()
136 vc->chan.device = dmadev; in vchan_init()
137 list_add_tail(&vc->chan.device_node, &dmadev->channels); in vchan_init()