mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
dmaengine: dma-axi-dmac: Add helper for getting next desc
Add a new helper for getting the next valid struct axi_dmac_desc. This will be extended in follow up patches to support to gracefully terminate cyclic transfers. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20260303-axi-dac-cyclic-support-v2-3-0db27b4be95a@analog.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
@@ -227,10 +227,29 @@ static bool axi_dmac_check_addr(struct axi_dmac_chan *chan, dma_addr_t addr)
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct axi_dmac_desc *axi_dmac_get_next_desc(struct axi_dmac *dmac,
|
||||
struct axi_dmac_chan *chan)
|
||||
{
|
||||
struct virt_dma_desc *vdesc;
|
||||
struct axi_dmac_desc *desc;
|
||||
|
||||
if (chan->next_desc)
|
||||
return chan->next_desc;
|
||||
|
||||
vdesc = vchan_next_desc(&chan->vchan);
|
||||
if (!vdesc)
|
||||
return NULL;
|
||||
|
||||
list_move_tail(&vdesc->node, &chan->active_descs);
|
||||
desc = to_axi_dmac_desc(vdesc);
|
||||
chan->next_desc = desc;
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
static void axi_dmac_start_transfer(struct axi_dmac_chan *chan)
|
||||
{
|
||||
struct axi_dmac *dmac = chan_to_axi_dmac(chan);
|
||||
struct virt_dma_desc *vdesc;
|
||||
struct axi_dmac_desc *desc;
|
||||
struct axi_dmac_sg *sg;
|
||||
unsigned int flags = 0;
|
||||
@@ -240,16 +259,10 @@ static void axi_dmac_start_transfer(struct axi_dmac_chan *chan)
|
||||
if (val) /* Queue is full, wait for the next SOT IRQ */
|
||||
return;
|
||||
|
||||
desc = chan->next_desc;
|
||||
desc = axi_dmac_get_next_desc(dmac, chan);
|
||||
if (!desc)
|
||||
return;
|
||||
|
||||
if (!desc) {
|
||||
vdesc = vchan_next_desc(&chan->vchan);
|
||||
if (!vdesc)
|
||||
return;
|
||||
list_move_tail(&vdesc->node, &chan->active_descs);
|
||||
desc = to_axi_dmac_desc(vdesc);
|
||||
chan->next_desc = desc;
|
||||
}
|
||||
sg = &desc->sg[desc->num_submitted];
|
||||
|
||||
/* Already queued in cyclic mode. Wait for it to finish */
|
||||
|
||||
Reference in New Issue
Block a user