Commit ff2f60e6 authored by David Brownell's avatar David Brownell Committed by Kevin Hilman

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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent ce31af1d
......@@ -909,6 +909,38 @@ void davinci_set_dma_transfer_params(int lch,
}
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 */
......@@ -1060,49 +1092,6 @@ void davinci_stop_dma(int lch)
}
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
......
......@@ -190,6 +190,7 @@ int davinci_request_dma(int dev_id, const char *dev_name,
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, s16 src_bidx, s16 src_cidx);
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);
......
......@@ -156,7 +156,7 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
}
/* 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_pcm_substream *substream)
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment