• Home
  • Raw
  • Download

Lines Matching refs:chan

44 	return container_of(dchan, struct sf_pdma_chan, vchan.chan);  in to_sf_pdma_chan()
52 static struct sf_pdma_desc *sf_pdma_alloc_desc(struct sf_pdma_chan *chan) in sf_pdma_alloc_desc() argument
60 desc->chan = chan; in sf_pdma_alloc_desc()
74 static void sf_pdma_disclaim_chan(struct sf_pdma_chan *chan) in sf_pdma_disclaim_chan() argument
76 struct pdma_regs *regs = &chan->regs; in sf_pdma_disclaim_chan()
85 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); in sf_pdma_prep_dma_memcpy() local
89 if (chan && (!len || !dest || !src)) { in sf_pdma_prep_dma_memcpy()
90 dev_err(chan->pdma->dma_dev.dev, in sf_pdma_prep_dma_memcpy()
95 desc = sf_pdma_alloc_desc(chan); in sf_pdma_prep_dma_memcpy()
101 desc->async_tx = vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); in sf_pdma_prep_dma_memcpy()
103 spin_lock_irqsave(&chan->vchan.lock, iflags); in sf_pdma_prep_dma_memcpy()
105 spin_unlock_irqrestore(&chan->vchan.lock, iflags); in sf_pdma_prep_dma_memcpy()
113 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); in sf_pdma_slave_config() local
115 memcpy(&chan->cfg, cfg, sizeof(*cfg)); in sf_pdma_slave_config()
122 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); in sf_pdma_alloc_chan_resources() local
123 struct pdma_regs *regs = &chan->regs; in sf_pdma_alloc_chan_resources()
131 static void sf_pdma_disable_request(struct sf_pdma_chan *chan) in sf_pdma_disable_request() argument
133 struct pdma_regs *regs = &chan->regs; in sf_pdma_disable_request()
140 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); in sf_pdma_free_chan_resources() local
144 spin_lock_irqsave(&chan->vchan.lock, flags); in sf_pdma_free_chan_resources()
145 sf_pdma_disable_request(chan); in sf_pdma_free_chan_resources()
146 kfree(chan->desc); in sf_pdma_free_chan_resources()
147 chan->desc = NULL; in sf_pdma_free_chan_resources()
148 vchan_get_all_descriptors(&chan->vchan, &head); in sf_pdma_free_chan_resources()
149 sf_pdma_disclaim_chan(chan); in sf_pdma_free_chan_resources()
150 spin_unlock_irqrestore(&chan->vchan.lock, flags); in sf_pdma_free_chan_resources()
151 vchan_dma_desc_free_list(&chan->vchan, &head); in sf_pdma_free_chan_resources()
154 static size_t sf_pdma_desc_residue(struct sf_pdma_chan *chan, in sf_pdma_desc_residue() argument
158 struct pdma_regs *regs = &chan->regs; in sf_pdma_desc_residue()
164 spin_lock_irqsave(&chan->vchan.lock, flags); in sf_pdma_desc_residue()
166 list_for_each_entry(vd, &chan->vchan.desc_submitted, node) in sf_pdma_desc_residue()
173 if (cookie == tx->chan->completed_cookie) in sf_pdma_desc_residue()
179 vd = vchan_find_desc(&chan->vchan, cookie); in sf_pdma_desc_residue()
188 spin_unlock_irqrestore(&chan->vchan.lock, flags); in sf_pdma_desc_residue()
197 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); in sf_pdma_tx_status() local
203 dma_set_residue(txstate, sf_pdma_desc_residue(chan, cookie)); in sf_pdma_tx_status()
210 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); in sf_pdma_terminate_all() local
214 spin_lock_irqsave(&chan->vchan.lock, flags); in sf_pdma_terminate_all()
215 sf_pdma_disable_request(chan); in sf_pdma_terminate_all()
216 kfree(chan->desc); in sf_pdma_terminate_all()
217 chan->desc = NULL; in sf_pdma_terminate_all()
218 chan->xfer_err = false; in sf_pdma_terminate_all()
219 vchan_get_all_descriptors(&chan->vchan, &head); in sf_pdma_terminate_all()
220 spin_unlock_irqrestore(&chan->vchan.lock, flags); in sf_pdma_terminate_all()
221 vchan_dma_desc_free_list(&chan->vchan, &head); in sf_pdma_terminate_all()
226 static void sf_pdma_enable_request(struct sf_pdma_chan *chan) in sf_pdma_enable_request() argument
228 struct pdma_regs *regs = &chan->regs; in sf_pdma_enable_request()
239 static struct sf_pdma_desc *sf_pdma_get_first_pending_desc(struct sf_pdma_chan *chan) in sf_pdma_get_first_pending_desc() argument
241 struct virt_dma_chan *vchan = &chan->vchan; in sf_pdma_get_first_pending_desc()
252 static void sf_pdma_xfer_desc(struct sf_pdma_chan *chan) in sf_pdma_xfer_desc() argument
254 struct sf_pdma_desc *desc = chan->desc; in sf_pdma_xfer_desc()
255 struct pdma_regs *regs = &chan->regs; in sf_pdma_xfer_desc()
258 dev_err(chan->pdma->dma_dev.dev, "NULL desc.\n"); in sf_pdma_xfer_desc()
267 chan->desc = desc; in sf_pdma_xfer_desc()
268 chan->status = DMA_IN_PROGRESS; in sf_pdma_xfer_desc()
269 sf_pdma_enable_request(chan); in sf_pdma_xfer_desc()
274 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); in sf_pdma_issue_pending() local
277 spin_lock_irqsave(&chan->vchan.lock, flags); in sf_pdma_issue_pending()
279 if (!chan->desc && vchan_issue_pending(&chan->vchan)) { in sf_pdma_issue_pending()
281 chan->desc = sf_pdma_get_first_pending_desc(chan); in sf_pdma_issue_pending()
282 sf_pdma_xfer_desc(chan); in sf_pdma_issue_pending()
285 spin_unlock_irqrestore(&chan->vchan.lock, flags); in sf_pdma_issue_pending()
298 struct sf_pdma_chan *chan = from_tasklet(chan, t, done_tasklet); in sf_pdma_donebh_tasklet() local
301 spin_lock_irqsave(&chan->lock, flags); in sf_pdma_donebh_tasklet()
302 if (chan->xfer_err) { in sf_pdma_donebh_tasklet()
303 chan->retries = MAX_RETRY; in sf_pdma_donebh_tasklet()
304 chan->status = DMA_COMPLETE; in sf_pdma_donebh_tasklet()
305 chan->xfer_err = false; in sf_pdma_donebh_tasklet()
307 spin_unlock_irqrestore(&chan->lock, flags); in sf_pdma_donebh_tasklet()
309 spin_lock_irqsave(&chan->vchan.lock, flags); in sf_pdma_donebh_tasklet()
310 list_del(&chan->desc->vdesc.node); in sf_pdma_donebh_tasklet()
311 vchan_cookie_complete(&chan->desc->vdesc); in sf_pdma_donebh_tasklet()
313 chan->desc = sf_pdma_get_first_pending_desc(chan); in sf_pdma_donebh_tasklet()
314 if (chan->desc) in sf_pdma_donebh_tasklet()
315 sf_pdma_xfer_desc(chan); in sf_pdma_donebh_tasklet()
317 spin_unlock_irqrestore(&chan->vchan.lock, flags); in sf_pdma_donebh_tasklet()
322 struct sf_pdma_chan *chan = from_tasklet(chan, t, err_tasklet); in sf_pdma_errbh_tasklet() local
323 struct sf_pdma_desc *desc = chan->desc; in sf_pdma_errbh_tasklet()
326 spin_lock_irqsave(&chan->lock, flags); in sf_pdma_errbh_tasklet()
327 if (chan->retries <= 0) { in sf_pdma_errbh_tasklet()
329 spin_unlock_irqrestore(&chan->lock, flags); in sf_pdma_errbh_tasklet()
333 chan->retries--; in sf_pdma_errbh_tasklet()
334 chan->xfer_err = true; in sf_pdma_errbh_tasklet()
335 chan->status = DMA_ERROR; in sf_pdma_errbh_tasklet()
337 sf_pdma_enable_request(chan); in sf_pdma_errbh_tasklet()
338 spin_unlock_irqrestore(&chan->lock, flags); in sf_pdma_errbh_tasklet()
344 struct sf_pdma_chan *chan = dev_id; in sf_pdma_done_isr() local
345 struct pdma_regs *regs = &chan->regs; in sf_pdma_done_isr()
349 spin_lock_irqsave(&chan->vchan.lock, flags); in sf_pdma_done_isr()
354 tasklet_hi_schedule(&chan->done_tasklet); in sf_pdma_done_isr()
357 struct sf_pdma_desc *desc = chan->desc; in sf_pdma_done_isr()
363 sf_pdma_xfer_desc(chan); in sf_pdma_done_isr()
366 spin_unlock_irqrestore(&chan->vchan.lock, flags); in sf_pdma_done_isr()
373 struct sf_pdma_chan *chan = dev_id; in sf_pdma_err_isr() local
374 struct pdma_regs *regs = &chan->regs; in sf_pdma_err_isr()
377 spin_lock_irqsave(&chan->lock, flags); in sf_pdma_err_isr()
379 spin_unlock_irqrestore(&chan->lock, flags); in sf_pdma_err_isr()
381 tasklet_schedule(&chan->err_tasklet); in sf_pdma_err_isr()
404 struct sf_pdma_chan *chan; in sf_pdma_irq_init() local
407 chan = &pdma->chans[i]; in sf_pdma_irq_init()
416 dev_name(&pdev->dev), (void *)chan); in sf_pdma_irq_init()
422 chan->txirq = irq; in sf_pdma_irq_init()
431 dev_name(&pdev->dev), (void *)chan); in sf_pdma_irq_init()
437 chan->errirq = irq; in sf_pdma_irq_init()
458 struct sf_pdma_chan *chan; in sf_pdma_setup_chans() local
463 chan = &pdma->chans[i]; in sf_pdma_setup_chans()
465 chan->regs.ctrl = in sf_pdma_setup_chans()
467 chan->regs.xfer_type = in sf_pdma_setup_chans()
469 chan->regs.xfer_size = in sf_pdma_setup_chans()
471 chan->regs.dst_addr = in sf_pdma_setup_chans()
473 chan->regs.src_addr = in sf_pdma_setup_chans()
475 chan->regs.act_type = in sf_pdma_setup_chans()
477 chan->regs.residue = in sf_pdma_setup_chans()
479 chan->regs.cur_dst_addr = in sf_pdma_setup_chans()
481 chan->regs.cur_src_addr = in sf_pdma_setup_chans()
484 chan->pdma = pdma; in sf_pdma_setup_chans()
485 chan->pm_state = RUNNING; in sf_pdma_setup_chans()
486 chan->slave_id = i; in sf_pdma_setup_chans()
487 chan->xfer_err = false; in sf_pdma_setup_chans()
488 spin_lock_init(&chan->lock); in sf_pdma_setup_chans()
490 chan->vchan.desc_free = sf_pdma_free_desc; in sf_pdma_setup_chans()
491 vchan_init(&chan->vchan, &pdma->dma_dev); in sf_pdma_setup_chans()
493 writel(PDMA_CLEAR_CTRL, chan->regs.ctrl); in sf_pdma_setup_chans()
495 tasklet_setup(&chan->done_tasklet, sf_pdma_donebh_tasklet); in sf_pdma_setup_chans()
496 tasklet_setup(&chan->err_tasklet, sf_pdma_errbh_tasklet); in sf_pdma_setup_chans()
503 struct sf_pdma_chan *chan; in sf_pdma_probe() local
514 len = sizeof(*pdma) + sizeof(*chan) * chans; in sf_pdma_probe()
582 list_del(&ch->vchan.chan.device_node); in sf_pdma_remove()