Lines Matching refs:dl

532 struct vsp1_dl_ext_cmd *vsp1_dl_get_pre_cmd(struct vsp1_dl_list *dl)  in vsp1_dl_get_pre_cmd()  argument
534 struct vsp1_dl_manager *dlm = dl->dlm; in vsp1_dl_get_pre_cmd()
536 if (dl->pre_cmd) in vsp1_dl_get_pre_cmd()
537 return dl->pre_cmd; in vsp1_dl_get_pre_cmd()
539 dl->pre_cmd = vsp1_dl_ext_cmd_get(dlm->cmdpool); in vsp1_dl_get_pre_cmd()
541 return dl->pre_cmd; in vsp1_dl_get_pre_cmd()
550 struct vsp1_dl_list *dl; in vsp1_dl_list_alloc() local
553 dl = kzalloc(sizeof(*dl), GFP_KERNEL); in vsp1_dl_list_alloc()
554 if (!dl) in vsp1_dl_list_alloc()
557 INIT_LIST_HEAD(&dl->bodies); in vsp1_dl_list_alloc()
558 dl->dlm = dlm; in vsp1_dl_list_alloc()
561 dl->body0 = vsp1_dl_body_get(dlm->pool); in vsp1_dl_list_alloc()
562 if (!dl->body0) { in vsp1_dl_list_alloc()
563 kfree(dl); in vsp1_dl_list_alloc()
567 header_offset = dl->body0->max_entries * sizeof(*dl->body0->entries); in vsp1_dl_list_alloc()
569 dl->header = ((void *)dl->body0->entries) + header_offset; in vsp1_dl_list_alloc()
570 dl->dma = dl->body0->dma + header_offset; in vsp1_dl_list_alloc()
572 memset(dl->header, 0, sizeof(*dl->header)); in vsp1_dl_list_alloc()
573 dl->header->lists[0].addr = dl->body0->dma; in vsp1_dl_list_alloc()
575 return dl; in vsp1_dl_list_alloc()
578 static void vsp1_dl_list_bodies_put(struct vsp1_dl_list *dl) in vsp1_dl_list_bodies_put() argument
582 list_for_each_entry_safe(dlb, tmp, &dl->bodies, list) { in vsp1_dl_list_bodies_put()
588 static void vsp1_dl_list_free(struct vsp1_dl_list *dl) in vsp1_dl_list_free() argument
590 vsp1_dl_body_put(dl->body0); in vsp1_dl_list_free()
591 vsp1_dl_list_bodies_put(dl); in vsp1_dl_list_free()
593 kfree(dl); in vsp1_dl_list_free()
606 struct vsp1_dl_list *dl = NULL; in vsp1_dl_list_get() local
612 dl = list_first_entry(&dlm->free, struct vsp1_dl_list, list); in vsp1_dl_list_get()
613 list_del(&dl->list); in vsp1_dl_list_get()
619 INIT_LIST_HEAD(&dl->chain); in vsp1_dl_list_get()
624 return dl; in vsp1_dl_list_get()
628 static void __vsp1_dl_list_put(struct vsp1_dl_list *dl) in __vsp1_dl_list_put() argument
632 if (!dl) in __vsp1_dl_list_put()
639 if (dl->has_chain) { in __vsp1_dl_list_put()
640 list_for_each_entry(dl_next, &dl->chain, chain) in __vsp1_dl_list_put()
644 dl->has_chain = false; in __vsp1_dl_list_put()
646 vsp1_dl_list_bodies_put(dl); in __vsp1_dl_list_put()
648 vsp1_dl_ext_cmd_put(dl->pre_cmd); in __vsp1_dl_list_put()
649 vsp1_dl_ext_cmd_put(dl->post_cmd); in __vsp1_dl_list_put()
651 dl->pre_cmd = NULL; in __vsp1_dl_list_put()
652 dl->post_cmd = NULL; in __vsp1_dl_list_put()
658 dl->body0->num_entries = 0; in __vsp1_dl_list_put()
660 list_add_tail(&dl->list, &dl->dlm->free); in __vsp1_dl_list_put()
672 void vsp1_dl_list_put(struct vsp1_dl_list *dl) in vsp1_dl_list_put() argument
676 if (!dl) in vsp1_dl_list_put()
679 spin_lock_irqsave(&dl->dlm->lock, flags); in vsp1_dl_list_put()
680 __vsp1_dl_list_put(dl); in vsp1_dl_list_put()
681 spin_unlock_irqrestore(&dl->dlm->lock, flags); in vsp1_dl_list_put()
691 struct vsp1_dl_body *vsp1_dl_list_get_body0(struct vsp1_dl_list *dl) in vsp1_dl_list_get_body0() argument
693 return dl->body0; in vsp1_dl_list_get_body0()
712 int vsp1_dl_list_add_body(struct vsp1_dl_list *dl, struct vsp1_dl_body *dlb) in vsp1_dl_list_add_body() argument
716 list_add_tail(&dlb->list, &dl->bodies); in vsp1_dl_list_add_body()
736 struct vsp1_dl_list *dl) in vsp1_dl_list_add_chain() argument
739 list_add_tail(&dl->chain, &head->chain); in vsp1_dl_list_add_chain()
751 static void vsp1_dl_list_fill_header(struct vsp1_dl_list *dl, bool is_last) in vsp1_dl_list_fill_header() argument
753 struct vsp1_dl_manager *dlm = dl->dlm; in vsp1_dl_list_fill_header()
754 struct vsp1_dl_header_list *hdr = dl->header->lists; in vsp1_dl_list_fill_header()
764 hdr->num_bytes = dl->body0->num_entries in vsp1_dl_list_fill_header()
765 * sizeof(*dl->header->lists); in vsp1_dl_list_fill_header()
767 list_for_each_entry(dlb, &dl->bodies, list) { in vsp1_dl_list_fill_header()
773 * sizeof(*dl->header->lists); in vsp1_dl_list_fill_header()
776 dl->header->num_lists = num_lists; in vsp1_dl_list_fill_header()
777 dl->header->flags = 0; in vsp1_dl_list_fill_header()
787 dl->header->flags |= VSP1_DLH_INT_ENABLE; in vsp1_dl_list_fill_header()
796 dl->header->flags |= VSP1_DLH_AUTO_START; in vsp1_dl_list_fill_header()
803 struct vsp1_dl_list *next = list_next_entry(dl, chain); in vsp1_dl_list_fill_header()
805 dl->header->next_header = next->dma; in vsp1_dl_list_fill_header()
812 dl->header->next_header = dl->dma; in vsp1_dl_list_fill_header()
815 if (!dl->extension) in vsp1_dl_list_fill_header()
818 dl->extension->flags = 0; in vsp1_dl_list_fill_header()
820 if (dl->pre_cmd) { in vsp1_dl_list_fill_header()
821 dl->extension->pre_ext_dl_plist = dl->pre_cmd->cmd_dma; in vsp1_dl_list_fill_header()
822 dl->extension->pre_ext_dl_num_cmd = dl->pre_cmd->num_cmds; in vsp1_dl_list_fill_header()
823 dl->extension->flags |= VSP1_DLH_EXT_PRE_CMD_EXEC; in vsp1_dl_list_fill_header()
825 vsp1_dl_ext_cmd_fill_header(dl->pre_cmd); in vsp1_dl_list_fill_header()
828 if (dl->post_cmd) { in vsp1_dl_list_fill_header()
829 dl->extension->post_ext_dl_plist = dl->post_cmd->cmd_dma; in vsp1_dl_list_fill_header()
830 dl->extension->post_ext_dl_num_cmd = dl->post_cmd->num_cmds; in vsp1_dl_list_fill_header()
831 dl->extension->flags |= VSP1_DLH_EXT_POST_CMD_EXEC; in vsp1_dl_list_fill_header()
833 vsp1_dl_ext_cmd_fill_header(dl->post_cmd); in vsp1_dl_list_fill_header()
851 static void vsp1_dl_list_hw_enqueue(struct vsp1_dl_list *dl) in vsp1_dl_list_hw_enqueue() argument
853 struct vsp1_dl_manager *dlm = dl->dlm; in vsp1_dl_list_hw_enqueue()
863 vsp1_write(vsp1, VI6_DL_HDR_ADDR(dlm->index), dl->dma); in vsp1_dl_list_hw_enqueue()
866 static void vsp1_dl_list_commit_continuous(struct vsp1_dl_list *dl) in vsp1_dl_list_commit_continuous() argument
868 struct vsp1_dl_manager *dlm = dl->dlm; in vsp1_dl_list_commit_continuous()
889 dlm->pending = dl; in vsp1_dl_list_commit_continuous()
897 vsp1_dl_list_hw_enqueue(dl); in vsp1_dl_list_commit_continuous()
900 dlm->queued = dl; in vsp1_dl_list_commit_continuous()
903 static void vsp1_dl_list_commit_singleshot(struct vsp1_dl_list *dl) in vsp1_dl_list_commit_singleshot() argument
905 struct vsp1_dl_manager *dlm = dl->dlm; in vsp1_dl_list_commit_singleshot()
912 vsp1_dl_list_hw_enqueue(dl); in vsp1_dl_list_commit_singleshot()
914 dlm->active = dl; in vsp1_dl_list_commit_singleshot()
917 void vsp1_dl_list_commit(struct vsp1_dl_list *dl, unsigned int dl_flags) in vsp1_dl_list_commit() argument
919 struct vsp1_dl_manager *dlm = dl->dlm; in vsp1_dl_list_commit()
924 vsp1_dl_list_fill_header(dl, list_empty(&dl->chain)); in vsp1_dl_list_commit()
926 list_for_each_entry(dl_next, &dl->chain, chain) { in vsp1_dl_list_commit()
927 bool last = list_is_last(&dl_next->chain, &dl->chain); in vsp1_dl_list_commit()
932 dl->flags = dl_flags & ~VSP1_DL_FRAME_END_COMPLETED; in vsp1_dl_list_commit()
937 vsp1_dl_list_commit_singleshot(dl); in vsp1_dl_list_commit()
939 vsp1_dl_list_commit_continuous(dl); in vsp1_dl_list_commit()
1127 struct vsp1_dl_list *dl; in vsp1_dlm_create() local
1129 dl = vsp1_dl_list_alloc(dlm); in vsp1_dlm_create()
1130 if (!dl) { in vsp1_dlm_create()
1137 dl->extension = (void *)dl->header in vsp1_dlm_create()
1138 + sizeof(*dl->header); in vsp1_dlm_create()
1140 list_add_tail(&dl->list, &dlm->free); in vsp1_dlm_create()
1157 struct vsp1_dl_list *dl, *next; in vsp1_dlm_destroy() local
1162 list_for_each_entry_safe(dl, next, &dlm->free, list) { in vsp1_dlm_destroy()
1163 list_del(&dl->list); in vsp1_dlm_destroy()
1164 vsp1_dl_list_free(dl); in vsp1_dlm_destroy()