From: David Brownell <[email protected]> Subject: EDMA interface renames: edma_link(), edma_unlink()
Another EDMA interface update. Fixes documentation for the linking calls to be kerneldoc style. Rename parameters so they're meaningful (from/to vs lch/lch_que) and unsigned (eliminates some error checks). Remove unused edma_unlink() parameter. Move this code so it's grouped with the other calls which only modify parameter RAM. Signed-off-by: David Brownell <[email protected]> --- NOTE: considered naming these edma_link_slot() and edma_unlink_slot(); but there's no ambiguity (only PaRAM slots can be linked!) so I used the shorter symbols. And, hmm, unlink() seems superfluous... arch/arm/mach-davinci/dma.c | 75 +++++++++++----------------- arch/arm/mach-davinci/include/mach/edma.h | 40 +------------- sound/soc/davinci/davinci-pcm.c | 4 - 3 files changed, 38 insertions(+), 81 deletions(-) --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/mach-davinci/dma.c @@ -909,6 +909,38 @@ void davinci_set_dma_transfer_params(int } EXPORT_SYMBOL(davinci_set_dma_transfer_params); +/** + * edma_link - link one parameter RAM slot to another + * @from: parameter RAM slot originating the link + * @to: parameter RAM slot which is the link target + * + * The originating slot should not be part of any active DMA transfer. + */ +void edma_link(unsigned from, unsigned to) +{ + if (from >= DAVINCI_EDMA_NUM_PARAMENTRY) + return; + if (to >= DAVINCI_EDMA_NUM_PARAMENTRY) + return; + edma_parm_modify(PARM_LINK_BCNTRLD, from, 0xffff0000, PARM_OFFSET(to)); +} +EXPORT_SYMBOL(edma_link); + +/** + * edma_unlink - cut link from one parameter RAM slot + * @from: parameter RAM slot originating the link + * + * The originating slot should not be part of any active DMA transfer. + * Its link is set to 0xffff. + */ +void edma_unlink(unsigned from) +{ + if (from >= DAVINCI_EDMA_NUM_PARAMENTRY) + return; + edma_parm_or(PARM_LINK_BCNTRLD, from, 0xffff); +} +EXPORT_SYMBOL(edma_unlink); + /*-----------------------------------------------------------------------*/ /* Parameter RAM operations (ii) -- read/write whole parameter sets */ @@ -1062,49 +1094,6 @@ EXPORT_SYMBOL(davinci_stop_dma); /****************************************************************************** * - * DMA channel link - link the two logical channels passed through by linking - * the link field of head to the param pointed by the lch_que. - * ARGUMENTS: - * lch - logical channel number, in which the link field is linked - * to the param pointed to by lch_que - * lch_que - logical channel number or the param entry number, which is to be - * linked to the lch - * - *****************************************************************************/ -void davinci_dma_link_lch(int lch, int lch_que) -{ - if ((lch >= 0) && (lch < DAVINCI_EDMA_NUM_PARAMENTRY) && - (lch_que >= 0) && (lch_que < DAVINCI_EDMA_NUM_PARAMENTRY)) { - /* program LINK */ - edma_parm_modify(PARM_LINK_BCNTRLD, lch, - 0xffff0000, - PARM_OFFSET(lch_que)); - } -} -EXPORT_SYMBOL(davinci_dma_link_lch); - -/****************************************************************************** - * - * DMA channel unlink - unlink the two logical channels passed through by - * setting the link field of head to 0xffff. - * ARGUMENTS: - * lch - logical channel number, from which the link field is to be removed - * lch_que - logical channel number or the param entry number, which is to be - * unlinked from lch - * - *****************************************************************************/ -void davinci_dma_unlink_lch(int lch, int lch_que) -{ - if ((lch >= 0) && (lch < DAVINCI_EDMA_NUM_PARAMENTRY) && - (lch_que >= 0) && (lch_que < DAVINCI_EDMA_NUM_PARAMENTRY)) { - edma_parm_or(PARM_LINK_BCNTRLD, lch, - 0xffff); - } -} -EXPORT_SYMBOL(davinci_dma_unlink_lch); - -/****************************************************************************** - * * It cleans ParamEntry qand bring back EDMA to initial state if media has * been removed before EDMA has finished.It is usedful for removable media. * Arguments: --- a/arch/arm/mach-davinci/include/mach/edma.h +++ b/arch/arm/mach-davinci/include/mach/edma.h @@ -190,6 +190,7 @@ int davinci_request_dma(int dev_id, cons void *data, int *lch, int *tcc, enum dma_event_q); void davinci_free_dma(int lch); +/* calls that operate on part of a parameter RAM slot */ void davinci_set_dma_src_params(int lch, dma_addr_t src_port, enum address_mode mode, enum fifo_width); void davinci_set_dma_dest_params(int lch, dma_addr_t dest_port, @@ -198,49 +199,16 @@ void davinci_set_dma_src_index(int lch, void davinci_set_dma_dest_index(int lch, s16 dest_bidx, s16 dest_cidx); void davinci_set_dma_transfer_params(int lch, u16 acnt, u16 bcnt, u16 ccnt, u16 bcnt_rld, enum sync_dimension sync_mode); +void edma_link(unsigned from, unsigned to); +void edma_unlink(unsigned from); +/* calls that operate on an entire parameter RAM slot */ void edma_write_slot(unsigned slot, const struct edmacc_param *params); void edma_read_slot(unsigned slot, struct edmacc_param *params); int davinci_start_dma(int lch); void davinci_stop_dma(int lch); -/****************************************************************************** - * davinci_dma_link_lch - Link two Logical channels - * - * lch_head - logical channel number, in which the link field is linked to the - * the param pointed to by lch_queue - * Can be a MasterChannel or SlaveChannel - * lch_queue - logical channel number or the param entry number, which is to be - * linked to the lch_head - * Must be a SlaveChannel - * - * |---------------| - * v | - * Ex: ch1--> ch2-->ch3-->ch4--| - * - * ch1 must be a MasterChannel - * - * ch2, ch3, ch4 must be SlaveChannels - * - * Note: After channel linking,the user should not update any PaRam entry - * of MasterChannel ( In the above example ch1 ) - * - *****************************************************************************/ -void davinci_dma_link_lch(int lch_head, int lch_queue); - -/****************************************************************************** - * davinci_dma_unlink_lch - unlink the two logical channels passed through by - * setting the link field of head to 0xffff. - * - * lch_head - logical channel number, from which the link field is to be - * removed - * lch_queue - logical channel number or the param entry number,which is to be - * unlinked from lch_head - * - *****************************************************************************/ -void davinci_dma_unlink_lch(int lch_head, int lch_queue); - void davinci_dma_getposition(int lch, dma_addr_t *src, dma_addr_t *dst); void davinci_clean_channel(int lch); void davinci_pause_dma(int lch); --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -156,7 +156,7 @@ static int davinci_pcm_dma_request(struc } /* Link parameter RAM to itself in loopback */ - davinci_dma_link_lch(prtd->slave_lch, prtd->slave_lch); + edma_link(prtd->slave_lch, prtd->slave_lch); return 0; } @@ -260,7 +260,7 @@ static int davinci_pcm_close(struct snd_ struct snd_pcm_runtime *runtime = substream->runtime; struct davinci_runtime_data *prtd = runtime->private_data; - davinci_dma_unlink_lch(prtd->slave_lch, prtd->slave_lch); + edma_unlink(prtd->slave_lch); davinci_free_dma(prtd->slave_lch); davinci_free_dma(prtd->master_lch); _______________________________________________ Davinci-linux-open-source mailing list [email protected] http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
