Lines Matching full:contract
149 struct sun4i_dma_contract *contract; member
163 /* A contract is a set of promises */
326 * from the next pending contract.
334 struct sun4i_dma_contract *contract = NULL; in __execute_vchan_pending() local
358 /* Figure out which contract we're working with today */ in __execute_vchan_pending()
362 "No pending contract found"); in __execute_vchan_pending()
367 contract = to_sun4i_dma_contract(vd); in __execute_vchan_pending()
368 if (list_empty(&contract->demands)) { in __execute_vchan_pending()
369 /* The contract has been completed so mark it as such */ in __execute_vchan_pending()
370 list_del(&contract->vd.node); in __execute_vchan_pending()
371 vchan_cookie_complete(&contract->vd); in __execute_vchan_pending()
373 "Empty contract found and marked complete"); in __execute_vchan_pending()
375 } while (list_empty(&contract->demands)); in __execute_vchan_pending()
378 promise = list_first_entry(&contract->demands, in __execute_vchan_pending()
384 vchan->contract = contract; in __execute_vchan_pending()
386 set_pchan_interrupt(priv, pchan, contract->use_half_int, 1); in __execute_vchan_pending()
434 * Generate a promise, to be used in a normal DMA contract.
438 * promise will live in the demands list on a contract. Once it has been
440 * All linked promises will be freed when the corresponding contract is freed
501 * Generate a promise, to be used in a dedicated DMA contract.
505 * promise will live in the demands list on a contract. Once it has been
507 * All linked promises will be freed when the corresponding contract is freed
558 * Generate a contract
561 * linked lists, we need to implement SG via software. We use a contract
567 struct sun4i_dma_contract *contract; in generate_dma_contract() local
569 contract = kzalloc(sizeof(*contract), GFP_NOWAIT); in generate_dma_contract()
570 if (!contract) in generate_dma_contract()
573 INIT_LIST_HEAD(&contract->demands); in generate_dma_contract()
574 INIT_LIST_HEAD(&contract->completed_demands); in generate_dma_contract()
576 return contract; in generate_dma_contract()
583 * loop. This function returns the next promise from a cyclic contract,
587 get_next_cyclic_promise(struct sun4i_dma_contract *contract) in get_next_cyclic_promise() argument
591 promise = list_first_entry_or_null(&contract->demands, in get_next_cyclic_promise()
594 list_splice_init(&contract->completed_demands, in get_next_cyclic_promise()
595 &contract->demands); in get_next_cyclic_promise()
596 promise = list_first_entry(&contract->demands, in get_next_cyclic_promise()
604 * Free a contract and all its associated promises
608 struct sun4i_dma_contract *contract = to_sun4i_dma_contract(vd); in sun4i_dma_free_contract() local
612 list_for_each_entry_safe(promise, tmp, &contract->demands, list) in sun4i_dma_free_contract()
615 list_for_each_entry_safe(promise, tmp, &contract->completed_demands, list) in sun4i_dma_free_contract()
618 kfree(contract); in sun4i_dma_free_contract()
628 struct sun4i_dma_contract *contract; in sun4i_dma_prep_dma_memcpy() local
630 contract = generate_dma_contract(); in sun4i_dma_prep_dma_memcpy()
631 if (!contract) in sun4i_dma_prep_dma_memcpy()
651 kfree(contract); in sun4i_dma_prep_dma_memcpy()
664 /* Fill the contract with our only promise */ in sun4i_dma_prep_dma_memcpy()
665 list_add_tail(&promise->list, &contract->demands); in sun4i_dma_prep_dma_memcpy()
668 return vchan_tx_prep(&vchan->vc, &contract->vd, flags); in sun4i_dma_prep_dma_memcpy()
679 struct sun4i_dma_contract *contract; in sun4i_dma_prep_dma_cyclic() local
690 contract = generate_dma_contract(); in sun4i_dma_prep_dma_cyclic()
691 if (!contract) in sun4i_dma_prep_dma_cyclic()
694 contract->is_cyclic = 1; in sun4i_dma_prep_dma_cyclic()
756 contract->use_half_int = 1; in sun4i_dma_prep_dma_cyclic()
783 /* Then add it to the contract */ in sun4i_dma_prep_dma_cyclic()
784 list_add_tail(&promise->list, &contract->demands); in sun4i_dma_prep_dma_cyclic()
788 return vchan_tx_prep(&vchan->vc, &contract->vd, flags); in sun4i_dma_prep_dma_cyclic()
799 struct sun4i_dma_contract *contract; in sun4i_dma_prep_slave_sg() local
814 contract = generate_dma_contract(); in sun4i_dma_prep_slave_sg()
815 if (!contract) in sun4i_dma_prep_slave_sg()
876 /* Then add it to the contract */ in sun4i_dma_prep_slave_sg()
877 list_add_tail(&promise->list, &contract->demands); in sun4i_dma_prep_slave_sg()
881 * Once we've got all the promises ready, add the contract in sun4i_dma_prep_slave_sg()
884 return vchan_tx_prep(&vchan->vc, &contract->vd, flags); in sun4i_dma_prep_slave_sg()
969 struct sun4i_dma_contract *contract; in sun4i_dma_tx_status() local
984 contract = to_sun4i_dma_contract(vd); in sun4i_dma_tx_status()
986 list_for_each_entry(promise, &contract->demands, list) in sun4i_dma_tx_status()
994 promise = list_first_entry_or_null(&contract->demands, in sun4i_dma_tx_status()
1035 struct sun4i_dma_contract *contract; in sun4i_dma_interrupt() local
1052 contract = vchan->contract; in sun4i_dma_interrupt()
1066 &contract->completed_demands); in sun4i_dma_interrupt()
1081 if (contract->is_cyclic) { in sun4i_dma_interrupt()
1082 promise = get_next_cyclic_promise(contract); in sun4i_dma_interrupt()
1085 vchan_cyclic_callback(&contract->vd); in sun4i_dma_interrupt()
1098 if (contract->is_cyclic) in sun4i_dma_interrupt()
1099 vchan_cyclic_callback(&contract->vd); in sun4i_dma_interrupt()