dmaengine: PL08x: track mux usage on a per-channel basis.
Keep track of the number of descriptors currently using a MUX setting on a per-channel basis. This allows us to know when we have descriptors queued somewhere which have been assigned a DMA request signal. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
ad0de2ac32
commit
5e2479bd0e
1 changed files with 13 additions and 5 deletions
|
@ -227,6 +227,7 @@ enum pl08x_dma_chan_state {
|
||||||
* @waiting: a TX descriptor on this channel which is waiting for a physical
|
* @waiting: a TX descriptor on this channel which is waiting for a physical
|
||||||
* channel to become available
|
* channel to become available
|
||||||
* @signal: the physical DMA request signal which this channel is using
|
* @signal: the physical DMA request signal which this channel is using
|
||||||
|
* @mux_use: count of descriptors using this DMA request signal setting
|
||||||
*/
|
*/
|
||||||
struct pl08x_dma_chan {
|
struct pl08x_dma_chan {
|
||||||
struct dma_chan chan;
|
struct dma_chan chan;
|
||||||
|
@ -244,6 +245,7 @@ struct pl08x_dma_chan {
|
||||||
bool slave;
|
bool slave;
|
||||||
struct pl08x_txd *waiting;
|
struct pl08x_txd *waiting;
|
||||||
int signal;
|
int signal;
|
||||||
|
unsigned mux_use;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -310,10 +312,12 @@ static int pl08x_request_mux(struct pl08x_dma_chan *plchan)
|
||||||
const struct pl08x_platform_data *pd = plchan->host->pd;
|
const struct pl08x_platform_data *pd = plchan->host->pd;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (pd->get_signal) {
|
if (plchan->mux_use++ == 0 && pd->get_signal) {
|
||||||
ret = pd->get_signal(plchan->cd);
|
ret = pd->get_signal(plchan->cd);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
plchan->mux_use = 0;
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
plchan->signal = ret;
|
plchan->signal = ret;
|
||||||
}
|
}
|
||||||
|
@ -324,9 +328,13 @@ static void pl08x_release_mux(struct pl08x_dma_chan *plchan)
|
||||||
{
|
{
|
||||||
const struct pl08x_platform_data *pd = plchan->host->pd;
|
const struct pl08x_platform_data *pd = plchan->host->pd;
|
||||||
|
|
||||||
if (plchan->signal >= 0 && pd->put_signal) {
|
if (plchan->signal >= 0) {
|
||||||
pd->put_signal(plchan->cd, plchan->signal);
|
WARN_ON(plchan->mux_use == 0);
|
||||||
plchan->signal = -1;
|
|
||||||
|
if (--plchan->mux_use == 0 && pd->put_signal) {
|
||||||
|
pd->put_signal(plchan->cd, plchan->signal);
|
||||||
|
plchan->signal = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue