Lines Matching refs:cvc

265 static void mtk_cqdma_issue_vchan_pending(struct mtk_cqdma_vchan *cvc)  in mtk_cqdma_issue_vchan_pending()  argument
268 struct mtk_cqdma_pchan *pc = cvc->pc; in mtk_cqdma_issue_vchan_pending()
272 lockdep_assert_held(&cvc->vc.lock); in mtk_cqdma_issue_vchan_pending()
275 list_for_each_entry_safe(vd, vd2, &cvc->vc.desc_issued, node) { in mtk_cqdma_issue_vchan_pending()
298 static bool mtk_cqdma_is_vchan_active(struct mtk_cqdma_vchan *cvc) in mtk_cqdma_is_vchan_active() argument
302 list_for_each_entry(cvd, &cvc->pc->queue, node) in mtk_cqdma_is_vchan_active()
303 if (cvc == to_cqdma_vchan(cvd->ch)) in mtk_cqdma_is_vchan_active()
315 struct mtk_cqdma_vchan *cvc; in mtk_cqdma_consume_work_queue() local
324 cvc = to_cqdma_vchan(cvd->ch); in mtk_cqdma_consume_work_queue()
333 spin_lock(&cvc->vc.lock); in mtk_cqdma_consume_work_queue()
341 if (cvc->issue_synchronize && !mtk_cqdma_is_vchan_active(cvc)) { in mtk_cqdma_consume_work_queue()
342 complete(&cvc->issue_completion); in mtk_cqdma_consume_work_queue()
343 cvc->issue_synchronize = false; in mtk_cqdma_consume_work_queue()
347 spin_unlock(&cvc->vc.lock); in mtk_cqdma_consume_work_queue()
421 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_find_active_desc() local
425 spin_lock_irqsave(&cvc->pc->lock, flags); in mtk_cqdma_find_active_desc()
426 list_for_each_entry(vd, &cvc->pc->queue, node) in mtk_cqdma_find_active_desc()
428 spin_unlock_irqrestore(&cvc->pc->lock, flags); in mtk_cqdma_find_active_desc()
431 spin_unlock_irqrestore(&cvc->pc->lock, flags); in mtk_cqdma_find_active_desc()
433 list_for_each_entry(vd, &cvc->vc.desc_issued, node) in mtk_cqdma_find_active_desc()
444 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_tx_status() local
455 spin_lock_irqsave(&cvc->vc.lock, flags); in mtk_cqdma_tx_status()
457 spin_unlock_irqrestore(&cvc->vc.lock, flags); in mtk_cqdma_tx_status()
471 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_issue_pending() local
476 spin_lock_irqsave(&cvc->pc->lock, pc_flags); in mtk_cqdma_issue_pending()
477 spin_lock_irqsave(&cvc->vc.lock, vc_flags); in mtk_cqdma_issue_pending()
479 if (vchan_issue_pending(&cvc->vc)) in mtk_cqdma_issue_pending()
480 mtk_cqdma_issue_vchan_pending(cvc); in mtk_cqdma_issue_pending()
482 spin_unlock_irqrestore(&cvc->vc.lock, vc_flags); in mtk_cqdma_issue_pending()
483 spin_unlock_irqrestore(&cvc->pc->lock, pc_flags); in mtk_cqdma_issue_pending()
572 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_free_active_desc() local
578 spin_lock_irqsave(&cvc->pc->lock, pc_flags); in mtk_cqdma_free_active_desc()
579 spin_lock_irqsave(&cvc->vc.lock, vc_flags); in mtk_cqdma_free_active_desc()
582 if (mtk_cqdma_is_vchan_active(cvc)) { in mtk_cqdma_free_active_desc()
583 cvc->issue_synchronize = true; in mtk_cqdma_free_active_desc()
587 spin_unlock_irqrestore(&cvc->vc.lock, vc_flags); in mtk_cqdma_free_active_desc()
588 spin_unlock_irqrestore(&cvc->pc->lock, pc_flags); in mtk_cqdma_free_active_desc()
592 wait_for_completion(&cvc->issue_completion); in mtk_cqdma_free_active_desc()
595 vchan_synchronize(&cvc->vc); in mtk_cqdma_free_active_desc()
597 WARN_ONCE(!list_empty(&cvc->vc.desc_completed), in mtk_cqdma_free_active_desc()
659 struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c); in mtk_cqdma_free_chan_resources() local
665 spin_lock_irqsave(&cvc->pc->lock, flags); in mtk_cqdma_free_chan_resources()
668 if (refcount_dec_and_test(&cvc->pc->refcnt)) { in mtk_cqdma_free_chan_resources()
670 mtk_dma_set(cvc->pc, MTK_CQDMA_FLUSH, MTK_CQDMA_FLUSH_BIT); in mtk_cqdma_free_chan_resources()
673 if (mtk_cqdma_poll_engine_done(cvc->pc, true) < 0) in mtk_cqdma_free_chan_resources()
677 mtk_dma_clr(cvc->pc, MTK_CQDMA_FLUSH, MTK_CQDMA_FLUSH_BIT); in mtk_cqdma_free_chan_resources()
678 mtk_dma_clr(cvc->pc, MTK_CQDMA_INT_FLAG, in mtk_cqdma_free_chan_resources()
682 mtk_dma_clr(cvc->pc, MTK_CQDMA_INT_EN, MTK_CQDMA_INT_EN_BIT); in mtk_cqdma_free_chan_resources()
685 spin_unlock_irqrestore(&cvc->pc->lock, flags); in mtk_cqdma_free_chan_resources()