Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Nuno Sá and committed by
Vinod Koul
c60990ba ac85913a

+23 -10
+23 -10
drivers/dma/dma-axi-dmac.c
··· 227 227 return true; 228 228 } 229 229 230 + static struct axi_dmac_desc *axi_dmac_get_next_desc(struct axi_dmac *dmac, 231 + struct axi_dmac_chan *chan) 232 + { 233 + struct virt_dma_desc *vdesc; 234 + struct axi_dmac_desc *desc; 235 + 236 + if (chan->next_desc) 237 + return chan->next_desc; 238 + 239 + vdesc = vchan_next_desc(&chan->vchan); 240 + if (!vdesc) 241 + return NULL; 242 + 243 + list_move_tail(&vdesc->node, &chan->active_descs); 244 + desc = to_axi_dmac_desc(vdesc); 245 + chan->next_desc = desc; 246 + 247 + return desc; 248 + } 249 + 230 250 static void axi_dmac_start_transfer(struct axi_dmac_chan *chan) 231 251 { 232 252 struct axi_dmac *dmac = chan_to_axi_dmac(chan); 233 - struct virt_dma_desc *vdesc; 234 253 struct axi_dmac_desc *desc; 235 254 struct axi_dmac_sg *sg; 236 255 unsigned int flags = 0; ··· 259 240 if (val) /* Queue is full, wait for the next SOT IRQ */ 260 241 return; 261 242 262 - desc = chan->next_desc; 243 + desc = axi_dmac_get_next_desc(dmac, chan); 244 + if (!desc) 245 + return; 263 246 264 - if (!desc) { 265 - vdesc = vchan_next_desc(&chan->vchan); 266 - if (!vdesc) 267 - return; 268 - list_move_tail(&vdesc->node, &chan->active_descs); 269 - desc = to_axi_dmac_desc(vdesc); 270 - chan->next_desc = desc; 271 - } 272 247 sg = &desc->sg[desc->num_submitted]; 273 248 274 249 /* Already queued in cyclic mode. Wait for it to finish */