Lines Matching refs:cvc
266 static void mtk_cqdma_issue_vchan_pending(struct mtk_cqdma_vchan *cvc) in mtk_cqdma_issue_vchan_pending() argument
269 struct mtk_cqdma_pchan *pc = cvc->pc; in mtk_cqdma_issue_vchan_pending()
273 lockdep_assert_held(&cvc->vc.lock); in mtk_cqdma_issue_vchan_pending()
276 list_for_each_entry_safe(vd, vd2, &cvc->vc.desc_issued, node) { in mtk_cqdma_issue_vchan_pending()
299 static bool mtk_cqdma_is_vchan_active(struct mtk_cqdma_vchan *cvc) in mtk_cqdma_is_vchan_active() argument
303 list_for_each_entry(cvd, &cvc->pc->queue, node) in mtk_cqdma_is_vchan_active()
304 if (cvc == to_cqdma_vchan(cvd->ch)) in mtk_cqdma_is_vchan_active()
316 struct mtk_cqdma_vchan *cvc; in mtk_cqdma_consume_work_queue() local
325 cvc = to_cqdma_vchan(cvd->ch); in mtk_cqdma_consume_work_queue()
334 spin_lock(&cvc->vc.lock); in mtk_cqdma_consume_work_queue()
342 if (cvc->issue_synchronize && !mtk_cqdma_is_vchan_active(cvc)) { in mtk_cqdma_consume_work_queue()
343 complete(&cvc->issue_completion); in mtk_cqdma_consume_work_queue()
344 cvc->issue_synchronize = false; in mtk_cqdma_consume_work_queue()
348 spin_unlock(&cvc->vc.lock); in mtk_cqdma_consume_work_queue()
422 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_find_active_desc() local
426 spin_lock_irqsave(&cvc->pc->lock, flags); in mtk_cqdma_find_active_desc()
427 list_for_each_entry(vd, &cvc->pc->queue, node) in mtk_cqdma_find_active_desc()
429 spin_unlock_irqrestore(&cvc->pc->lock, flags); in mtk_cqdma_find_active_desc()
432 spin_unlock_irqrestore(&cvc->pc->lock, flags); in mtk_cqdma_find_active_desc()
434 list_for_each_entry(vd, &cvc->vc.desc_issued, node) in mtk_cqdma_find_active_desc()
445 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_tx_status() local
456 spin_lock_irqsave(&cvc->vc.lock, flags); in mtk_cqdma_tx_status()
458 spin_unlock_irqrestore(&cvc->vc.lock, flags); in mtk_cqdma_tx_status()
472 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_issue_pending() local
477 spin_lock_irqsave(&cvc->pc->lock, pc_flags); in mtk_cqdma_issue_pending()
478 spin_lock_irqsave(&cvc->vc.lock, vc_flags); in mtk_cqdma_issue_pending()
480 if (vchan_issue_pending(&cvc->vc)) in mtk_cqdma_issue_pending()
481 mtk_cqdma_issue_vchan_pending(cvc); in mtk_cqdma_issue_pending()
483 spin_unlock_irqrestore(&cvc->vc.lock, vc_flags); in mtk_cqdma_issue_pending()
484 spin_unlock_irqrestore(&cvc->pc->lock, pc_flags); in mtk_cqdma_issue_pending()
573 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_free_active_desc() local
579 spin_lock_irqsave(&cvc->pc->lock, pc_flags); in mtk_cqdma_free_active_desc()
580 spin_lock_irqsave(&cvc->vc.lock, vc_flags); in mtk_cqdma_free_active_desc()
583 if (mtk_cqdma_is_vchan_active(cvc)) { in mtk_cqdma_free_active_desc()
584 cvc->issue_synchronize = true; in mtk_cqdma_free_active_desc()
588 spin_unlock_irqrestore(&cvc->vc.lock, vc_flags); in mtk_cqdma_free_active_desc()
589 spin_unlock_irqrestore(&cvc->pc->lock, pc_flags); in mtk_cqdma_free_active_desc()
593 wait_for_completion(&cvc->issue_completion); in mtk_cqdma_free_active_desc()
596 vchan_synchronize(&cvc->vc); in mtk_cqdma_free_active_desc()
598 WARN_ONCE(!list_empty(&cvc->vc.desc_completed), in mtk_cqdma_free_active_desc()
660 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_free_chan_resources() local
666 spin_lock_irqsave(&cvc->pc->lock, flags); in mtk_cqdma_free_chan_resources()
669 if (refcount_dec_and_test(&cvc->pc->refcnt)) { in mtk_cqdma_free_chan_resources()
671 mtk_dma_set(cvc->pc, MTK_CQDMA_FLUSH, MTK_CQDMA_FLUSH_BIT); in mtk_cqdma_free_chan_resources()
674 if (mtk_cqdma_poll_engine_done(cvc->pc, true) < 0) in mtk_cqdma_free_chan_resources()
678 mtk_dma_clr(cvc->pc, MTK_CQDMA_FLUSH, MTK_CQDMA_FLUSH_BIT); in mtk_cqdma_free_chan_resources()
679 mtk_dma_clr(cvc->pc, MTK_CQDMA_INT_FLAG, in mtk_cqdma_free_chan_resources()
683 mtk_dma_clr(cvc->pc, MTK_CQDMA_INT_EN, MTK_CQDMA_INT_EN_BIT); in mtk_cqdma_free_chan_resources()
686 spin_unlock_irqrestore(&cvc->pc->lock, flags); in mtk_cqdma_free_chan_resources()