Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine fixes from Vinod Koul: "We have two small fixes. First one from Daniel to handle 0-length packets for usb cppi dma. Second by Russell for imx-sdam cyclic residue reporting" * 'fixes' of git://git.infradead.org/users/vkoul/slave-dma: Update imx-sdma cyclic handling to report residue dma: cppi41: handle 0-length packets
This commit is contained in:
commit
28b1fae568
|
@ -86,6 +86,9 @@
|
|||
|
||||
#define USBSS_IRQ_PD_COMP (1 << 2)
|
||||
|
||||
/* Packet Descriptor */
|
||||
#define PD2_ZERO_LENGTH (1 << 19)
|
||||
|
||||
struct cppi41_channel {
|
||||
struct dma_chan chan;
|
||||
struct dma_async_tx_descriptor txd;
|
||||
|
@ -307,7 +310,7 @@ static irqreturn_t cppi41_irq(int irq, void *data)
|
|||
__iormb();
|
||||
|
||||
while (val) {
|
||||
u32 desc;
|
||||
u32 desc, len;
|
||||
|
||||
q_num = __fls(val);
|
||||
val &= ~(1 << q_num);
|
||||
|
@ -319,9 +322,13 @@ static irqreturn_t cppi41_irq(int irq, void *data)
|
|||
q_num, desc);
|
||||
continue;
|
||||
}
|
||||
c->residue = pd_trans_len(c->desc->pd6) -
|
||||
pd_trans_len(c->desc->pd0);
|
||||
|
||||
if (c->desc->pd2 & PD2_ZERO_LENGTH)
|
||||
len = 0;
|
||||
else
|
||||
len = pd_trans_len(c->desc->pd0);
|
||||
|
||||
c->residue = pd_trans_len(c->desc->pd6) - len;
|
||||
dma_cookie_complete(&c->txd);
|
||||
c->txd.callback(c->txd.callback_param);
|
||||
}
|
||||
|
|
|
@ -255,6 +255,7 @@ struct sdma_channel {
|
|||
enum dma_slave_buswidth word_size;
|
||||
unsigned int buf_tail;
|
||||
unsigned int num_bd;
|
||||
unsigned int period_len;
|
||||
struct sdma_buffer_descriptor *bd;
|
||||
dma_addr_t bd_phys;
|
||||
unsigned int pc_from_device, pc_to_device;
|
||||
|
@ -592,6 +593,12 @@ static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event)
|
|||
}
|
||||
|
||||
static void sdma_handle_channel_loop(struct sdma_channel *sdmac)
|
||||
{
|
||||
if (sdmac->desc.callback)
|
||||
sdmac->desc.callback(sdmac->desc.callback_param);
|
||||
}
|
||||
|
||||
static void sdma_update_channel_loop(struct sdma_channel *sdmac)
|
||||
{
|
||||
struct sdma_buffer_descriptor *bd;
|
||||
|
||||
|
@ -611,9 +618,6 @@ static void sdma_handle_channel_loop(struct sdma_channel *sdmac)
|
|||
bd->mode.status |= BD_DONE;
|
||||
sdmac->buf_tail++;
|
||||
sdmac->buf_tail %= sdmac->num_bd;
|
||||
|
||||
if (sdmac->desc.callback)
|
||||
sdmac->desc.callback(sdmac->desc.callback_param);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,6 +673,9 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id)
|
|||
int channel = fls(stat) - 1;
|
||||
struct sdma_channel *sdmac = &sdma->channel[channel];
|
||||
|
||||
if (sdmac->flags & IMX_DMA_SG_LOOP)
|
||||
sdma_update_channel_loop(sdmac);
|
||||
|
||||
tasklet_schedule(&sdmac->tasklet);
|
||||
|
||||
__clear_bit(channel, &stat);
|
||||
|
@ -1129,6 +1136,7 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
|
|||
sdmac->status = DMA_IN_PROGRESS;
|
||||
|
||||
sdmac->buf_tail = 0;
|
||||
sdmac->period_len = period_len;
|
||||
|
||||
sdmac->flags |= IMX_DMA_SG_LOOP;
|
||||
sdmac->direction = direction;
|
||||
|
@ -1225,9 +1233,15 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan,
|
|||
struct dma_tx_state *txstate)
|
||||
{
|
||||
struct sdma_channel *sdmac = to_sdma_chan(chan);
|
||||
u32 residue;
|
||||
|
||||
if (sdmac->flags & IMX_DMA_SG_LOOP)
|
||||
residue = (sdmac->num_bd - sdmac->buf_tail) * sdmac->period_len;
|
||||
else
|
||||
residue = sdmac->chn_count - sdmac->chn_real_count;
|
||||
|
||||
dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie,
|
||||
sdmac->chn_count - sdmac->chn_real_count);
|
||||
residue);
|
||||
|
||||
return sdmac->status;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ int imx_pcm_dma_init(struct platform_device *pdev)
|
|||
{
|
||||
return devm_snd_dmaengine_pcm_register(&pdev->dev,
|
||||
&imx_dmaengine_pcm_config,
|
||||
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
|
||||
SND_DMAENGINE_PCM_FLAG_COMPAT);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(imx_pcm_dma_init);
|
||||
|
|
Loading…
Reference in New Issue