/* omap_get_dma_chain_index - Get the element and frame index of the ongoing DMA in chain  */
int omap_get_dma_chain_index(int chain_id, int *ei, int *fi)
/* omap_get_dma_chain_index - Get the element and frame index of the ongoing DMA in chain  */
int omap_get_dma_chain_index(int chain_id, int *ei, int *fi)
{
	int lch;
	int *channels;
	if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
		printk(KERN_ERR "Invalid chain id\n");
		return -EINVAL;
	}
	if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
		printk(KERN_ERR "Chain doesn't exists\n");
		return -EINVAL;
	}
	if ((!ei) || (!fi))
		return -EINVAL;
	channels = dma_linked_lch[chain_id].linked_dmach_q;
	lch = channels[dma_linked_lch[chain_id].q_head];
	*ei = dma_read(CCEN(lch));
	*fi = dma_read(CCFN(lch));
	return 0;
}