From: David Brownell <[email protected]> Subject: EDMA renames: all remaining operations
This patch primarily renames functions to use an edma_ prefix and remove a needless infix "_dma_" token. Again, parameters which identify parameter RAM slots were renamed as "slot" from "lch". Also, edma_get_position() was moved to be adjacent to the other operations that rely on just a few fields of a parameter RAM slot. Signed-off-by: David Brownell <[email protected]> --- The SRAM ops should have their own file; they'd be useful with power management too. arch/arm/mach-davinci/dma.c | 91 +++++++++++++++------------- arch/arm/mach-davinci/include/mach/edma.h | 11 +-- drivers/mmc/host/davinci_mmc.c | 2 sound/soc/davinci/davinci-pcm.c | 2 4 files changed, 59 insertions(+), 47 deletions(-) --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/mach-davinci/dma.c @@ -323,27 +323,6 @@ setup_dma_interrupt(unsigned lch, } } -/** - * davinci_dma_getposition - returns the current transfer points - * @lch: logical channel number - * @src: pointer to source port position - * @dst: pointer to destination port position - * - * Returns current source and destination address of a particular - * DMA channel. The channel should not be active when this is called. - */ -void davinci_dma_getposition(int lch, dma_addr_t *src, dma_addr_t *dst) -{ - struct edmacc_param temp; - - edma_read_slot(lch, &temp); - if (src != NULL) - *src = temp.src; - if (dst != NULL) - *dst = temp.dst; -} -EXPORT_SYMBOL(davinci_dma_getposition); - /****************************************************************************** * * DMA interrupt handler @@ -819,6 +798,27 @@ void edma_set_dest(unsigned slot, dma_ad EXPORT_SYMBOL(edma_set_dest); /** + * edma_get_position - returns the current transfer points + * @slot: parameter RAM slot being examined + * @src: pointer to source port position + * @dst: pointer to destination port position + * + * Returns current source and destination addresses for a particular + * parameter RAM slot. Its channel should not be active when this is called. + */ +void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst) +{ + struct edmacc_param temp; + + edma_read_slot(slot, &temp); + if (src != NULL) + *src = temp.src; + if (dst != NULL) + *dst = temp.dst; +} +EXPORT_SYMBOL(edma_get_position); + +/** * edma_set_src_index - configure DMA source address indexing * @slot: parameter RAM slot being configured * @src_bidx: byte offset between source arrays in a frame @@ -981,30 +981,38 @@ EXPORT_SYMBOL(edma_read_slot); /* Various EDMA channel control operations */ -/* - * DMA pause - pauses the dma on the channel passed +/** + * edma_pause - pause dma on a channel + * @channel: on which edma_start() has been called + * + * This temporarily disables EDMA hardware events on the specified channel, + * preventing them from triggering new transfers on its behalf */ -void davinci_pause_dma(int lch) +void edma_pause(unsigned channel) { - if ((lch >= 0) && (lch < DAVINCI_EDMA_NUM_DMACH)) { - unsigned int mask = (1 << (lch & 0x1f)); + if (channel < DAVINCI_EDMA_NUM_DMACH) { + unsigned int mask = (1 << (channel & 0x1f)); - edma_shadow0_write_array(SH_EECR, lch >> 5, mask); + edma_shadow0_write_array(SH_EECR, channel >> 5, mask); } } -EXPORT_SYMBOL(davinci_pause_dma); -/* - * DMA resume - resumes the dma on the channel passed +EXPORT_SYMBOL(edma_pause); + +/** + * edma_resume - resumes dma on a paused channel + * @channel: on which edma_pause() has been called + * + * This re-enables EDMA hardware events on the specified channel. */ -void davinci_resume_dma(int lch) +void edma_resume(unsigned channel) { - if ((lch >= 0) && (lch < DAVINCI_EDMA_NUM_DMACH)) { - unsigned int mask = (1 << (lch & 0x1f)); + if (channel < DAVINCI_EDMA_NUM_DMACH) { + unsigned int mask = (1 << (channel & 0x1f)); - edma_shadow0_write_array(SH_EESR, lch >> 5, mask); + edma_shadow0_write_array(SH_EESR, channel >> 5, mask); } } -EXPORT_SYMBOL(davinci_resume_dma); +EXPORT_SYMBOL(edma_resume); /** * edma_start - start dma on a channel @@ -1087,13 +1095,16 @@ EXPORT_SYMBOL(edma_stop); * * Return: zero on success, or corresponding error no on failure * + * FIXME this should not be needed ... edma_stop() should suffice. + * *****************************************************************************/ -void davinci_clean_channel(int ch_no) +void edma_clean_channel(unsigned channel) { - if ((ch_no >= 0) && (ch_no < DAVINCI_EDMA_NUM_DMACH)) { - int j = (ch_no >> 5); - unsigned int mask = 1 << (ch_no & 0x1f); + if (channel < DAVINCI_EDMA_NUM_DMACH) { + int j = (channel >> 5); + unsigned int mask = 1 << (channel & 0x1f); + dev_dbg(&edma_dev.dev, "EMR%d %08x\n", j, edma_read_array(EDMA_EMR, j)); edma_shadow0_write_array(SH_ECR, j, mask); @@ -1104,4 +1115,4 @@ void davinci_clean_channel(int ch_no) edma_write(EDMA_CCERRCLR, (1 << 16) | 0x3); } } -EXPORT_SYMBOL(davinci_clean_channel); +EXPORT_SYMBOL(edma_clean_channel); --- a/arch/arm/mach-davinci/include/mach/edma.h +++ b/arch/arm/mach-davinci/include/mach/edma.h @@ -199,6 +199,7 @@ void edma_set_src(unsigned slot, dma_add enum address_mode mode, enum fifo_width); void edma_set_dest(unsigned slot, dma_addr_t dest_port, enum address_mode mode, enum fifo_width); +void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst); void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx); void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx); void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt, @@ -210,14 +211,14 @@ void edma_unlink(unsigned from); void edma_write_slot(unsigned slot, const struct edmacc_param *params); void edma_read_slot(unsigned slot, struct edmacc_param *params); +/* channel control operations */ int edma_start(unsigned channel); void edma_stop(unsigned channel); +void edma_clean_channel(unsigned channel); +void edma_pause(unsigned channel); +void edma_resume(unsigned channel); -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); -void davinci_resume_dma(int lch); - +/* UNRELATED TO DMA */ int davinci_alloc_iram(unsigned size); void davinci_free_iram(unsigned addr, unsigned size); #endif --- a/drivers/mmc/host/davinci_mmc.c +++ b/drivers/mmc/host/davinci_mmc.c @@ -419,7 +419,7 @@ static void davinci_abort_dma(struct mmc sync_dev = host->txdma; edma_stop(sync_dev); - davinci_clean_channel(sync_dev); + edma_clean_channel(sync_dev); } static void mmc_davinci_dma_cb(unsigned channel, u16 ch_status, void *data) --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -227,7 +227,7 @@ davinci_pcm_pointer(struct snd_pcm_subst spin_lock(&prtd->lock); - davinci_dma_getposition(prtd->master_lch, &src, &dst); + edma_get_position(prtd->master_lch, &src, &dst); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) count = src - runtime->dma_addr; else _______________________________________________ Davinci-linux-open-source mailing list [email protected] http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
