All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dmaengine: at_hdmac: set residue as total len in atc_tx_status
@ 2011-05-04 18:14 ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-04 18:14 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams, linux-arm-kernel; +Cc: linux-kernel, Nicolas Ferre

If transfer status is !=DMA_SUCCESS, return total transfer len as residue,
instead of zero.

Idea from dw_dmac patch by Viresh Kumar.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index f52c9e3..ba0b5ec 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1026,7 +1026,12 @@ atc_tx_status(struct dma_chan *chan,
 
 	spin_unlock_bh(&atchan->lock);
 
-	dma_set_tx_state(txstate, last_complete, last_used, 0);
+	if (ret != DMA_SUCCESS)
+		dma_set_tx_state(txstate, last_complete, last_used,
+			atc_first_active(atchan)->len);
+	else
+		dma_set_tx_state(txstate, last_complete, last_used, 0);
+
 	dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n",
 		 cookie, last_complete ? last_complete : 0,
 		 last_used ? last_used : 0);
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 1/2] dmaengine: at_hdmac: set residue as total len in atc_tx_status
@ 2011-05-04 18:14 ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-04 18:14 UTC (permalink / raw)
  To: linux-arm-kernel

If transfer status is !=DMA_SUCCESS, return total transfer len as residue,
instead of zero.

Idea from dw_dmac patch by Viresh Kumar.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index f52c9e3..ba0b5ec 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1026,7 +1026,12 @@ atc_tx_status(struct dma_chan *chan,
 
 	spin_unlock_bh(&atchan->lock);
 
-	dma_set_tx_state(txstate, last_complete, last_used, 0);
+	if (ret != DMA_SUCCESS)
+		dma_set_tx_state(txstate, last_complete, last_used,
+			atc_first_active(atchan)->len);
+	else
+		dma_set_tx_state(txstate, last_complete, last_used, 0);
+
 	dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n",
 		 cookie, last_complete ? last_complete : 0,
 		 last_used ? last_used : 0);
-- 
1.7.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/2] dmaengine: at_hdmac: implement pause and resume in atc_control
  2011-05-04 18:14 ` Nicolas Ferre
@ 2011-05-04 18:14   ` Nicolas Ferre
  -1 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-04 18:14 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams, linux-arm-kernel; +Cc: linux-kernel, Nicolas Ferre

Pause and resume controls are useful for audio devices. This also returns
correct status from atc_tx_status() in case chan is paused.

Idea from dw_dmac patch by Linus Walleij.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c      |   85 +++++++++++++++++++++++++++++--------------
 drivers/dma/at_hdmac_regs.h |    1 +
 2 files changed, 59 insertions(+), 27 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index ba0b5ec..99ae628 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -508,7 +508,8 @@ static irqreturn_t at_dma_interrupt(int irq, void *dev_id)
 			if (pending & (AT_DMA_BTC(i) | AT_DMA_ERR(i))) {
 				if (pending & AT_DMA_ERR(i)) {
 					/* Disable channel on AHB error */
-					dma_writel(atdma, CHDR, atchan->mask);
+					dma_writel(atdma, CHDR,
+						AT_DMA_RES(i) | atchan->mask);
 					/* Give information to tasklet */
 					set_bit(ATC_IS_ERROR, &atchan->status);
 				}
@@ -952,39 +953,66 @@ static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 {
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
 	struct at_dma		*atdma = to_at_dma(chan->device);
-	struct at_desc		*desc, *_desc;
+	int			chan_id = atchan->chan_common.chan_id;
+
 	LIST_HEAD(list);
 
-	/* Only supports DMA_TERMINATE_ALL */
-	if (cmd != DMA_TERMINATE_ALL)
-		return -ENXIO;
+	dev_vdbg(chan2dev(chan), "atc_control (%d)\n", cmd);
 
-	/*
-	 * This is only called when something went wrong elsewhere, so
-	 * we don't really care about the data. Just disable the
-	 * channel. We still have to poll the channel enable bit due
-	 * to AHB/HSB limitations.
-	 */
-	spin_lock_bh(&atchan->lock);
+	if (cmd == DMA_PAUSE) {
+		spin_lock_bh(&atchan->lock);
 
-	dma_writel(atdma, CHDR, atchan->mask);
+		dma_writel(atdma, CHER, AT_DMA_SUSP(chan_id));
 
-	/* confirm that this channel is disabled */
-	while (dma_readl(atdma, CHSR) & atchan->mask)
-		cpu_relax();
+		while (!(dma_readl(atdma, CHSR) & AT_DMA_EMPT(chan_id)))
+			cpu_relax();
 
-	/* active_list entries will end up before queued entries */
-	list_splice_init(&atchan->queue, &list);
-	list_splice_init(&atchan->active_list, &list);
+		set_bit(ATC_IS_PAUSED, &atchan->status);
 
-	/* Flush all pending and queued descriptors */
-	list_for_each_entry_safe(desc, _desc, &list, desc_node)
-		atc_chain_complete(atchan, desc);
+		spin_unlock_bh(&atchan->lock);
+	} else if (cmd == DMA_RESUME) {
+		if (!test_bit(ATC_IS_PAUSED, &atchan->status))
+			return 0;
 
-	/* if channel dedicated to cyclic operations, free it */
-	clear_bit(ATC_IS_CYCLIC, &atchan->status);
+		spin_lock_bh(&atchan->lock);
 
-	spin_unlock_bh(&atchan->lock);
+		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
+		clear_bit(ATC_IS_PAUSED, &atchan->status);
+
+		spin_unlock_bh(&atchan->lock);
+	} else if (cmd == DMA_TERMINATE_ALL) {
+		struct at_desc	*desc, *_desc;
+		/*
+		 * This is only called when something went wrong elsewhere, so
+		 * we don't really care about the data. Just disable the
+		 * channel. We still have to poll the channel enable bit due
+		 * to AHB/HSB limitations.
+		 */
+		spin_lock_bh(&atchan->lock);
+
+		/* disabling channel: must also remove suspend state */
+		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id) | atchan->mask);
+
+		/* confirm that this channel is disabled */
+		while (dma_readl(atdma, CHSR) & atchan->mask)
+			cpu_relax();
+
+		/* active_list entries will end up before queued entries */
+		list_splice_init(&atchan->queue, &list);
+		list_splice_init(&atchan->active_list, &list);
+
+		/* Flush all pending and queued descriptors */
+		list_for_each_entry_safe(desc, _desc, &list, desc_node)
+			atc_chain_complete(atchan, desc);
+
+		clear_bit(ATC_IS_PAUSED, &atchan->status);
+		/* if channel dedicated to cyclic operations, free it */
+		clear_bit(ATC_IS_CYCLIC, &atchan->status);
+
+		spin_unlock_bh(&atchan->lock);
+	} else {
+		return -ENXIO;
+	}
 
 	return 0;
 }
@@ -1032,8 +1060,11 @@ atc_tx_status(struct dma_chan *chan,
 	else
 		dma_set_tx_state(txstate, last_complete, last_used, 0);
 
-	dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n",
-		 cookie, last_complete ? last_complete : 0,
+	if (test_bit(ATC_IS_PAUSED, &atchan->status))
+		ret = DMA_PAUSED;
+
+	dev_vdbg(chan2dev(chan), "tx_status %d: cookie = %d (d%d, u%d)\n",
+		 ret, cookie, last_complete ? last_complete : 0,
 		 last_used ? last_used : 0);
 
 	return ret;
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index ae3056d..087dbf1 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -191,6 +191,7 @@ txd_to_at_desc(struct dma_async_tx_descriptor *txd)
  */
 enum atc_status {
 	ATC_IS_ERROR = 0,
+	ATC_IS_PAUSED = 1,
 	ATC_IS_CYCLIC = 24,
 };
 
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/2] dmaengine: at_hdmac: implement pause and resume in atc_control
@ 2011-05-04 18:14   ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-04 18:14 UTC (permalink / raw)
  To: linux-arm-kernel

Pause and resume controls are useful for audio devices. This also returns
correct status from atc_tx_status() in case chan is paused.

Idea from dw_dmac patch by Linus Walleij.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c      |   85 +++++++++++++++++++++++++++++--------------
 drivers/dma/at_hdmac_regs.h |    1 +
 2 files changed, 59 insertions(+), 27 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index ba0b5ec..99ae628 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -508,7 +508,8 @@ static irqreturn_t at_dma_interrupt(int irq, void *dev_id)
 			if (pending & (AT_DMA_BTC(i) | AT_DMA_ERR(i))) {
 				if (pending & AT_DMA_ERR(i)) {
 					/* Disable channel on AHB error */
-					dma_writel(atdma, CHDR, atchan->mask);
+					dma_writel(atdma, CHDR,
+						AT_DMA_RES(i) | atchan->mask);
 					/* Give information to tasklet */
 					set_bit(ATC_IS_ERROR, &atchan->status);
 				}
@@ -952,39 +953,66 @@ static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 {
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
 	struct at_dma		*atdma = to_at_dma(chan->device);
-	struct at_desc		*desc, *_desc;
+	int			chan_id = atchan->chan_common.chan_id;
+
 	LIST_HEAD(list);
 
-	/* Only supports DMA_TERMINATE_ALL */
-	if (cmd != DMA_TERMINATE_ALL)
-		return -ENXIO;
+	dev_vdbg(chan2dev(chan), "atc_control (%d)\n", cmd);
 
-	/*
-	 * This is only called when something went wrong elsewhere, so
-	 * we don't really care about the data. Just disable the
-	 * channel. We still have to poll the channel enable bit due
-	 * to AHB/HSB limitations.
-	 */
-	spin_lock_bh(&atchan->lock);
+	if (cmd == DMA_PAUSE) {
+		spin_lock_bh(&atchan->lock);
 
-	dma_writel(atdma, CHDR, atchan->mask);
+		dma_writel(atdma, CHER, AT_DMA_SUSP(chan_id));
 
-	/* confirm that this channel is disabled */
-	while (dma_readl(atdma, CHSR) & atchan->mask)
-		cpu_relax();
+		while (!(dma_readl(atdma, CHSR) & AT_DMA_EMPT(chan_id)))
+			cpu_relax();
 
-	/* active_list entries will end up before queued entries */
-	list_splice_init(&atchan->queue, &list);
-	list_splice_init(&atchan->active_list, &list);
+		set_bit(ATC_IS_PAUSED, &atchan->status);
 
-	/* Flush all pending and queued descriptors */
-	list_for_each_entry_safe(desc, _desc, &list, desc_node)
-		atc_chain_complete(atchan, desc);
+		spin_unlock_bh(&atchan->lock);
+	} else if (cmd == DMA_RESUME) {
+		if (!test_bit(ATC_IS_PAUSED, &atchan->status))
+			return 0;
 
-	/* if channel dedicated to cyclic operations, free it */
-	clear_bit(ATC_IS_CYCLIC, &atchan->status);
+		spin_lock_bh(&atchan->lock);
 
-	spin_unlock_bh(&atchan->lock);
+		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
+		clear_bit(ATC_IS_PAUSED, &atchan->status);
+
+		spin_unlock_bh(&atchan->lock);
+	} else if (cmd == DMA_TERMINATE_ALL) {
+		struct at_desc	*desc, *_desc;
+		/*
+		 * This is only called when something went wrong elsewhere, so
+		 * we don't really care about the data. Just disable the
+		 * channel. We still have to poll the channel enable bit due
+		 * to AHB/HSB limitations.
+		 */
+		spin_lock_bh(&atchan->lock);
+
+		/* disabling channel: must also remove suspend state */
+		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id) | atchan->mask);
+
+		/* confirm that this channel is disabled */
+		while (dma_readl(atdma, CHSR) & atchan->mask)
+			cpu_relax();
+
+		/* active_list entries will end up before queued entries */
+		list_splice_init(&atchan->queue, &list);
+		list_splice_init(&atchan->active_list, &list);
+
+		/* Flush all pending and queued descriptors */
+		list_for_each_entry_safe(desc, _desc, &list, desc_node)
+			atc_chain_complete(atchan, desc);
+
+		clear_bit(ATC_IS_PAUSED, &atchan->status);
+		/* if channel dedicated to cyclic operations, free it */
+		clear_bit(ATC_IS_CYCLIC, &atchan->status);
+
+		spin_unlock_bh(&atchan->lock);
+	} else {
+		return -ENXIO;
+	}
 
 	return 0;
 }
@@ -1032,8 +1060,11 @@ atc_tx_status(struct dma_chan *chan,
 	else
 		dma_set_tx_state(txstate, last_complete, last_used, 0);
 
-	dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n",
-		 cookie, last_complete ? last_complete : 0,
+	if (test_bit(ATC_IS_PAUSED, &atchan->status))
+		ret = DMA_PAUSED;
+
+	dev_vdbg(chan2dev(chan), "tx_status %d: cookie = %d (d%d, u%d)\n",
+		 ret, cookie, last_complete ? last_complete : 0,
 		 last_used ? last_used : 0);
 
 	return ret;
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index ae3056d..087dbf1 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -191,6 +191,7 @@ txd_to_at_desc(struct dma_async_tx_descriptor *txd)
  */
 enum atc_status {
 	ATC_IS_ERROR = 0,
+	ATC_IS_PAUSED = 1,
 	ATC_IS_CYCLIC = 24,
 };
 
-- 
1.7.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 2/3] dmaengine: at_hdmac: implement pause and resume in atc_control
  2011-05-06 17:56     ` Nicolas Ferre
@ 2011-05-06 16:56       ` Nicolas Ferre
  -1 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-06 16:56 UTC (permalink / raw)
  To: vinod.koul; +Cc: dan.j.williams, linux-arm-kernel, linux-kernel

Le 06/05/2011 19:56, Nicolas Ferre :
> Pause and resume controls are useful for audio devices. This also returns
> correct status from atc_tx_status() in case chan is paused.
> 
> Idea from dw_dmac patch by Linus Walleij.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---

V2: In case of pause, some peripheral are not draining data out of FIFO
    if they are stopped or not clocked: we need to find a way out with
    a simple timeout.

[..]

Best regards,
-- 
Nicolas Ferre


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2 2/3] dmaengine: at_hdmac: implement pause and resume in atc_control
@ 2011-05-06 16:56       ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-06 16:56 UTC (permalink / raw)
  To: linux-arm-kernel

Le 06/05/2011 19:56, Nicolas Ferre :
> Pause and resume controls are useful for audio devices. This also returns
> correct status from atc_tx_status() in case chan is paused.
> 
> Idea from dw_dmac patch by Linus Walleij.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---

V2: In case of pause, some peripheral are not draining data out of FIFO
    if they are stopped or not clocked: we need to find a way out with
    a simple timeout.

[..]

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2 1/3] dmaengine: at_hdmac: set residue as total len in atc_tx_status
  2011-05-04 18:14 ` Nicolas Ferre
@ 2011-05-06 17:56   ` Nicolas Ferre
  -1 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-06 17:56 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams, linux-arm-kernel; +Cc: linux-kernel, Nicolas Ferre

If transfer status is !=DMA_SUCCESS, return total transfer len as residue,
instead of zero.

Idea from dw_dmac patch by Viresh Kumar.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index f52c9e3..ba0b5ec 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1026,7 +1026,12 @@ atc_tx_status(struct dma_chan *chan,
 
 	spin_unlock_bh(&atchan->lock);
 
-	dma_set_tx_state(txstate, last_complete, last_used, 0);
+	if (ret != DMA_SUCCESS)
+		dma_set_tx_state(txstate, last_complete, last_used,
+			atc_first_active(atchan)->len);
+	else
+		dma_set_tx_state(txstate, last_complete, last_used, 0);
+
 	dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n",
 		 cookie, last_complete ? last_complete : 0,
 		 last_used ? last_used : 0);
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 1/3] dmaengine: at_hdmac: set residue as total len in atc_tx_status
@ 2011-05-06 17:56   ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-06 17:56 UTC (permalink / raw)
  To: linux-arm-kernel

If transfer status is !=DMA_SUCCESS, return total transfer len as residue,
instead of zero.

Idea from dw_dmac patch by Viresh Kumar.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index f52c9e3..ba0b5ec 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1026,7 +1026,12 @@ atc_tx_status(struct dma_chan *chan,
 
 	spin_unlock_bh(&atchan->lock);
 
-	dma_set_tx_state(txstate, last_complete, last_used, 0);
+	if (ret != DMA_SUCCESS)
+		dma_set_tx_state(txstate, last_complete, last_used,
+			atc_first_active(atchan)->len);
+	else
+		dma_set_tx_state(txstate, last_complete, last_used, 0);
+
 	dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n",
 		 cookie, last_complete ? last_complete : 0,
 		 last_used ? last_used : 0);
-- 
1.7.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 2/3] dmaengine: at_hdmac: implement pause and resume in atc_control
  2011-05-04 18:14 ` Nicolas Ferre
@ 2011-05-06 17:56     ` Nicolas Ferre
  -1 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-06 17:56 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams, linux-arm-kernel; +Cc: linux-kernel, Nicolas Ferre

Pause and resume controls are useful for audio devices. This also returns
correct status from atc_tx_status() in case chan is paused.

Idea from dw_dmac patch by Linus Walleij.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c      |   97 +++++++++++++++++++++++++++++++------------
 drivers/dma/at_hdmac_regs.h |    1 +
 2 files changed, 71 insertions(+), 27 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index ba0b5ec..5968245 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -508,7 +508,8 @@ static irqreturn_t at_dma_interrupt(int irq, void *dev_id)
 			if (pending & (AT_DMA_BTC(i) | AT_DMA_ERR(i))) {
 				if (pending & AT_DMA_ERR(i)) {
 					/* Disable channel on AHB error */
-					dma_writel(atdma, CHDR, atchan->mask);
+					dma_writel(atdma, CHDR,
+						AT_DMA_RES(i) | atchan->mask);
 					/* Give information to tasklet */
 					set_bit(ATC_IS_ERROR, &atchan->status);
 				}
@@ -952,39 +953,78 @@ static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 {
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
 	struct at_dma		*atdma = to_at_dma(chan->device);
-	struct at_desc		*desc, *_desc;
+	int			chan_id = atchan->chan_common.chan_id;
+
 	LIST_HEAD(list);
 
-	/* Only supports DMA_TERMINATE_ALL */
-	if (cmd != DMA_TERMINATE_ALL)
-		return -ENXIO;
+	dev_vdbg(chan2dev(chan), "atc_control (%d)\n", cmd);
 
-	/*
-	 * This is only called when something went wrong elsewhere, so
-	 * we don't really care about the data. Just disable the
-	 * channel. We still have to poll the channel enable bit due
-	 * to AHB/HSB limitations.
-	 */
-	spin_lock_bh(&atchan->lock);
+	if (cmd == DMA_PAUSE) {
+		int pause_timeout = 1000;
 
-	dma_writel(atdma, CHDR, atchan->mask);
+		spin_lock_bh(&atchan->lock);
 
-	/* confirm that this channel is disabled */
-	while (dma_readl(atdma, CHSR) & atchan->mask)
-		cpu_relax();
+		dma_writel(atdma, CHER, AT_DMA_SUSP(chan_id));
+
+		/* wait for FIFO to be empty */
+		while (!(dma_readl(atdma, CHSR) & AT_DMA_EMPT(chan_id))) {
+			if (pause_timeout-- > 0) {
+				/* the FIFO can only drain if the peripheral
+				 * is still requesting data:
+				 * -> timeout if it is not the case. */
+				dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
+				spin_unlock_bh(&atchan->lock);
+				return -ETIMEDOUT;
+			}
+			cpu_relax();
+		}
 
-	/* active_list entries will end up before queued entries */
-	list_splice_init(&atchan->queue, &list);
-	list_splice_init(&atchan->active_list, &list);
+		set_bit(ATC_IS_PAUSED, &atchan->status);
 
-	/* Flush all pending and queued descriptors */
-	list_for_each_entry_safe(desc, _desc, &list, desc_node)
-		atc_chain_complete(atchan, desc);
+		spin_unlock_bh(&atchan->lock);
+	} else if (cmd == DMA_RESUME) {
+		if (!test_bit(ATC_IS_PAUSED, &atchan->status))
+			return 0;
 
-	/* if channel dedicated to cyclic operations, free it */
-	clear_bit(ATC_IS_CYCLIC, &atchan->status);
+		spin_lock_bh(&atchan->lock);
 
-	spin_unlock_bh(&atchan->lock);
+		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
+		clear_bit(ATC_IS_PAUSED, &atchan->status);
+
+		spin_unlock_bh(&atchan->lock);
+	} else if (cmd == DMA_TERMINATE_ALL) {
+		struct at_desc	*desc, *_desc;
+		/*
+		 * This is only called when something went wrong elsewhere, so
+		 * we don't really care about the data. Just disable the
+		 * channel. We still have to poll the channel enable bit due
+		 * to AHB/HSB limitations.
+		 */
+		spin_lock_bh(&atchan->lock);
+
+		/* disabling channel: must also remove suspend state */
+		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id) | atchan->mask);
+
+		/* confirm that this channel is disabled */
+		while (dma_readl(atdma, CHSR) & atchan->mask)
+			cpu_relax();
+
+		/* active_list entries will end up before queued entries */
+		list_splice_init(&atchan->queue, &list);
+		list_splice_init(&atchan->active_list, &list);
+
+		/* Flush all pending and queued descriptors */
+		list_for_each_entry_safe(desc, _desc, &list, desc_node)
+			atc_chain_complete(atchan, desc);
+
+		clear_bit(ATC_IS_PAUSED, &atchan->status);
+		/* if channel dedicated to cyclic operations, free it */
+		clear_bit(ATC_IS_CYCLIC, &atchan->status);
+
+		spin_unlock_bh(&atchan->lock);
+	} else {
+		return -ENXIO;
+	}
 
 	return 0;
 }
@@ -1032,8 +1072,11 @@ atc_tx_status(struct dma_chan *chan,
 	else
 		dma_set_tx_state(txstate, last_complete, last_used, 0);
 
-	dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n",
-		 cookie, last_complete ? last_complete : 0,
+	if (test_bit(ATC_IS_PAUSED, &atchan->status))
+		ret = DMA_PAUSED;
+
+	dev_vdbg(chan2dev(chan), "tx_status %d: cookie = %d (d%d, u%d)\n",
+		 ret, cookie, last_complete ? last_complete : 0,
 		 last_used ? last_used : 0);
 
 	return ret;
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index ae3056d..087dbf1 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -191,6 +191,7 @@ txd_to_at_desc(struct dma_async_tx_descriptor *txd)
  */
 enum atc_status {
 	ATC_IS_ERROR = 0,
+	ATC_IS_PAUSED = 1,
 	ATC_IS_CYCLIC = 24,
 };
 
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 2/3] dmaengine: at_hdmac: implement pause and resume in atc_control
@ 2011-05-06 17:56     ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-06 17:56 UTC (permalink / raw)
  To: linux-arm-kernel

Pause and resume controls are useful for audio devices. This also returns
correct status from atc_tx_status() in case chan is paused.

Idea from dw_dmac patch by Linus Walleij.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c      |   97 +++++++++++++++++++++++++++++++------------
 drivers/dma/at_hdmac_regs.h |    1 +
 2 files changed, 71 insertions(+), 27 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index ba0b5ec..5968245 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -508,7 +508,8 @@ static irqreturn_t at_dma_interrupt(int irq, void *dev_id)
 			if (pending & (AT_DMA_BTC(i) | AT_DMA_ERR(i))) {
 				if (pending & AT_DMA_ERR(i)) {
 					/* Disable channel on AHB error */
-					dma_writel(atdma, CHDR, atchan->mask);
+					dma_writel(atdma, CHDR,
+						AT_DMA_RES(i) | atchan->mask);
 					/* Give information to tasklet */
 					set_bit(ATC_IS_ERROR, &atchan->status);
 				}
@@ -952,39 +953,78 @@ static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 {
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
 	struct at_dma		*atdma = to_at_dma(chan->device);
-	struct at_desc		*desc, *_desc;
+	int			chan_id = atchan->chan_common.chan_id;
+
 	LIST_HEAD(list);
 
-	/* Only supports DMA_TERMINATE_ALL */
-	if (cmd != DMA_TERMINATE_ALL)
-		return -ENXIO;
+	dev_vdbg(chan2dev(chan), "atc_control (%d)\n", cmd);
 
-	/*
-	 * This is only called when something went wrong elsewhere, so
-	 * we don't really care about the data. Just disable the
-	 * channel. We still have to poll the channel enable bit due
-	 * to AHB/HSB limitations.
-	 */
-	spin_lock_bh(&atchan->lock);
+	if (cmd == DMA_PAUSE) {
+		int pause_timeout = 1000;
 
-	dma_writel(atdma, CHDR, atchan->mask);
+		spin_lock_bh(&atchan->lock);
 
-	/* confirm that this channel is disabled */
-	while (dma_readl(atdma, CHSR) & atchan->mask)
-		cpu_relax();
+		dma_writel(atdma, CHER, AT_DMA_SUSP(chan_id));
+
+		/* wait for FIFO to be empty */
+		while (!(dma_readl(atdma, CHSR) & AT_DMA_EMPT(chan_id))) {
+			if (pause_timeout-- > 0) {
+				/* the FIFO can only drain if the peripheral
+				 * is still requesting data:
+				 * -> timeout if it is not the case. */
+				dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
+				spin_unlock_bh(&atchan->lock);
+				return -ETIMEDOUT;
+			}
+			cpu_relax();
+		}
 
-	/* active_list entries will end up before queued entries */
-	list_splice_init(&atchan->queue, &list);
-	list_splice_init(&atchan->active_list, &list);
+		set_bit(ATC_IS_PAUSED, &atchan->status);
 
-	/* Flush all pending and queued descriptors */
-	list_for_each_entry_safe(desc, _desc, &list, desc_node)
-		atc_chain_complete(atchan, desc);
+		spin_unlock_bh(&atchan->lock);
+	} else if (cmd == DMA_RESUME) {
+		if (!test_bit(ATC_IS_PAUSED, &atchan->status))
+			return 0;
 
-	/* if channel dedicated to cyclic operations, free it */
-	clear_bit(ATC_IS_CYCLIC, &atchan->status);
+		spin_lock_bh(&atchan->lock);
 
-	spin_unlock_bh(&atchan->lock);
+		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
+		clear_bit(ATC_IS_PAUSED, &atchan->status);
+
+		spin_unlock_bh(&atchan->lock);
+	} else if (cmd == DMA_TERMINATE_ALL) {
+		struct at_desc	*desc, *_desc;
+		/*
+		 * This is only called when something went wrong elsewhere, so
+		 * we don't really care about the data. Just disable the
+		 * channel. We still have to poll the channel enable bit due
+		 * to AHB/HSB limitations.
+		 */
+		spin_lock_bh(&atchan->lock);
+
+		/* disabling channel: must also remove suspend state */
+		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id) | atchan->mask);
+
+		/* confirm that this channel is disabled */
+		while (dma_readl(atdma, CHSR) & atchan->mask)
+			cpu_relax();
+
+		/* active_list entries will end up before queued entries */
+		list_splice_init(&atchan->queue, &list);
+		list_splice_init(&atchan->active_list, &list);
+
+		/* Flush all pending and queued descriptors */
+		list_for_each_entry_safe(desc, _desc, &list, desc_node)
+			atc_chain_complete(atchan, desc);
+
+		clear_bit(ATC_IS_PAUSED, &atchan->status);
+		/* if channel dedicated to cyclic operations, free it */
+		clear_bit(ATC_IS_CYCLIC, &atchan->status);
+
+		spin_unlock_bh(&atchan->lock);
+	} else {
+		return -ENXIO;
+	}
 
 	return 0;
 }
@@ -1032,8 +1072,11 @@ atc_tx_status(struct dma_chan *chan,
 	else
 		dma_set_tx_state(txstate, last_complete, last_used, 0);
 
-	dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n",
-		 cookie, last_complete ? last_complete : 0,
+	if (test_bit(ATC_IS_PAUSED, &atchan->status))
+		ret = DMA_PAUSED;
+
+	dev_vdbg(chan2dev(chan), "tx_status %d: cookie = %d (d%d, u%d)\n",
+		 ret, cookie, last_complete ? last_complete : 0,
 		 last_used ? last_used : 0);
 
 	return ret;
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index ae3056d..087dbf1 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -191,6 +191,7 @@ txd_to_at_desc(struct dma_async_tx_descriptor *txd)
  */
 enum atc_status {
 	ATC_IS_ERROR = 0,
+	ATC_IS_PAUSED = 1,
 	ATC_IS_CYCLIC = 24,
 };
 
-- 
1.7.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 3/3] dmaengine: at_hdmac: use descriptor chaining help function
  2011-05-04 18:14 ` Nicolas Ferre
@ 2011-05-06 17:56     ` Nicolas Ferre
  -1 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-06 17:56 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams, linux-arm-kernel; +Cc: linux-kernel, Nicolas Ferre

A little function helps to chain descriptors:
it is already used in cyclic dma operations, now use it in memcpy and slave_sg
preparation functions.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |   33 +++------------------------------
 1 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 5968245..2c6bc3a 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -626,16 +626,7 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 
 		desc->txd.cookie = 0;
 
-		if (!first) {
-			first = desc;
-		} else {
-			/* inform the HW lli about chaining */
-			prev->lli.dscr = desc->txd.phys;
-			/* insert the link descriptor to the LD ring */
-			list_add_tail(&desc->desc_node,
-					&first->tx_list);
-		}
-		prev = desc;
+		atc_desc_chain(&first, &prev, desc);
 	}
 
 	/* First descriptor of the chain embedds additional information */
@@ -726,16 +717,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 					| len >> mem_width;
 			desc->lli.ctrlb = ctrlb;
 
-			if (!first) {
-				first = desc;
-			} else {
-				/* inform the HW lli about chaining */
-				prev->lli.dscr = desc->txd.phys;
-				/* insert the link descriptor to the LD ring */
-				list_add_tail(&desc->desc_node,
-						&first->tx_list);
-			}
-			prev = desc;
+			atc_desc_chain(&first, &prev, desc);
 			total_len += len;
 		}
 		break;
@@ -769,16 +751,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 					| len >> reg_width;
 			desc->lli.ctrlb = ctrlb;
 
-			if (!first) {
-				first = desc;
-			} else {
-				/* inform the HW lli about chaining */
-				prev->lli.dscr = desc->txd.phys;
-				/* insert the link descriptor to the LD ring */
-				list_add_tail(&desc->desc_node,
-						&first->tx_list);
-			}
-			prev = desc;
+			atc_desc_chain(&first, &prev, desc);
 			total_len += len;
 		}
 		break;
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 3/3] dmaengine: at_hdmac: use descriptor chaining help function
@ 2011-05-06 17:56     ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-06 17:56 UTC (permalink / raw)
  To: linux-arm-kernel

A little function helps to chain descriptors:
it is already used in cyclic dma operations, now use it in memcpy and slave_sg
preparation functions.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |   33 +++------------------------------
 1 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 5968245..2c6bc3a 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -626,16 +626,7 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 
 		desc->txd.cookie = 0;
 
-		if (!first) {
-			first = desc;
-		} else {
-			/* inform the HW lli about chaining */
-			prev->lli.dscr = desc->txd.phys;
-			/* insert the link descriptor to the LD ring */
-			list_add_tail(&desc->desc_node,
-					&first->tx_list);
-		}
-		prev = desc;
+		atc_desc_chain(&first, &prev, desc);
 	}
 
 	/* First descriptor of the chain embedds additional information */
@@ -726,16 +717,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 					| len >> mem_width;
 			desc->lli.ctrlb = ctrlb;
 
-			if (!first) {
-				first = desc;
-			} else {
-				/* inform the HW lli about chaining */
-				prev->lli.dscr = desc->txd.phys;
-				/* insert the link descriptor to the LD ring */
-				list_add_tail(&desc->desc_node,
-						&first->tx_list);
-			}
-			prev = desc;
+			atc_desc_chain(&first, &prev, desc);
 			total_len += len;
 		}
 		break;
@@ -769,16 +751,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 					| len >> reg_width;
 			desc->lli.ctrlb = ctrlb;
 
-			if (!first) {
-				first = desc;
-			} else {
-				/* inform the HW lli about chaining */
-				prev->lli.dscr = desc->txd.phys;
-				/* insert the link descriptor to the LD ring */
-				list_add_tail(&desc->desc_node,
-						&first->tx_list);
-			}
-			prev = desc;
+			atc_desc_chain(&first, &prev, desc);
 			total_len += len;
 		}
 		break;
-- 
1.7.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/2] dmaengine: at_hdmac: implement pause and resume in atc_control
  2011-05-04 18:14   ` Nicolas Ferre
@ 2011-05-07 18:05     ` Linus Walleij
  -1 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2011-05-07 18:05 UTC (permalink / raw)
  To: Nicolas Ferre; +Cc: vinod.koul, dan.j.williams, linux-arm-kernel, linux-kernel

2011/5/4 Nicolas Ferre <nicolas.ferre@atmel.com>:

> Pause and resume controls are useful for audio devices. This also returns
> correct status from atc_tx_status() in case chan is paused.
>
> Idea from dw_dmac patch by Linus Walleij.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Looks good 2 me!
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 2/2] dmaengine: at_hdmac: implement pause and resume in atc_control
@ 2011-05-07 18:05     ` Linus Walleij
  0 siblings, 0 replies; 26+ messages in thread
From: Linus Walleij @ 2011-05-07 18:05 UTC (permalink / raw)
  To: linux-arm-kernel

2011/5/4 Nicolas Ferre <nicolas.ferre@atmel.com>:

> Pause and resume controls are useful for audio devices. This also returns
> correct status from atc_tx_status() in case chan is paused.
>
> Idea from dw_dmac patch by Linus Walleij.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Looks good 2 me!
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
  2011-05-06 17:56     ` Nicolas Ferre
@ 2011-05-09 16:11       ` Nicolas Ferre
  -1 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-09 16:11 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams, linux-arm-kernel; +Cc: linux-kernel, Nicolas Ferre

The addition of the pause feature to atc_control an active wait was introduced
to check the FIFO empty event. This event was not always happening and
a timout contition was needed.
But, in some cases, this event depend on the peripheral connected to the
channel that is paused: FIFO becomes empty if the peripheral consumes data.
The timeout is pretty difficult to evaluate. Moreover, this check is not
needed.
In conclusion, it seems sensible to entirely remove the checking of
"FIFO empty" status when pausing.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Vinod,

This additional patch goes on top of your current "next" branch. It is a
removing of some code added to the pause/resume patch sent earlier and can be
folded into this one if you want to.

Thanks, best regards,

Nicolas.

 drivers/dma/at_hdmac.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 2c6bc3a..3134003 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -933,25 +933,9 @@ static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 	dev_vdbg(chan2dev(chan), "atc_control (%d)\n", cmd);
 
 	if (cmd == DMA_PAUSE) {
-		int pause_timeout = 1000;
-
 		spin_lock_bh(&atchan->lock);
 
 		dma_writel(atdma, CHER, AT_DMA_SUSP(chan_id));
-
-		/* wait for FIFO to be empty */
-		while (!(dma_readl(atdma, CHSR) & AT_DMA_EMPT(chan_id))) {
-			if (pause_timeout-- > 0) {
-				/* the FIFO can only drain if the peripheral
-				 * is still requesting data:
-				 * -> timeout if it is not the case. */
-				dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
-				spin_unlock_bh(&atchan->lock);
-				return -ETIMEDOUT;
-			}
-			cpu_relax();
-		}
-
 		set_bit(ATC_IS_PAUSED, &atchan->status);
 
 		spin_unlock_bh(&atchan->lock);
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
@ 2011-05-09 16:11       ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-09 16:11 UTC (permalink / raw)
  To: linux-arm-kernel

The addition of the pause feature to atc_control an active wait was introduced
to check the FIFO empty event. This event was not always happening and
a timout contition was needed.
But, in some cases, this event depend on the peripheral connected to the
channel that is paused: FIFO becomes empty if the peripheral consumes data.
The timeout is pretty difficult to evaluate. Moreover, this check is not
needed.
In conclusion, it seems sensible to entirely remove the checking of
"FIFO empty" status when pausing.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Vinod,

This additional patch goes on top of your current "next" branch. It is a
removing of some code added to the pause/resume patch sent earlier and can be
folded into this one if you want to.

Thanks, best regards,

Nicolas.

 drivers/dma/at_hdmac.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 2c6bc3a..3134003 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -933,25 +933,9 @@ static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 	dev_vdbg(chan2dev(chan), "atc_control (%d)\n", cmd);
 
 	if (cmd == DMA_PAUSE) {
-		int pause_timeout = 1000;
-
 		spin_lock_bh(&atchan->lock);
 
 		dma_writel(atdma, CHER, AT_DMA_SUSP(chan_id));
-
-		/* wait for FIFO to be empty */
-		while (!(dma_readl(atdma, CHSR) & AT_DMA_EMPT(chan_id))) {
-			if (pause_timeout-- > 0) {
-				/* the FIFO can only drain if the peripheral
-				 * is still requesting data:
-				 * -> timeout if it is not the case. */
-				dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
-				spin_unlock_bh(&atchan->lock);
-				return -ETIMEDOUT;
-			}
-			cpu_relax();
-		}
-
 		set_bit(ATC_IS_PAUSED, &atchan->status);
 
 		spin_unlock_bh(&atchan->lock);
-- 
1.7.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
  2011-05-09 16:11       ` Nicolas Ferre
@ 2011-05-10 11:56         ` Sergei Shtylyov
  -1 siblings, 0 replies; 26+ messages in thread
From: Sergei Shtylyov @ 2011-05-10 11:56 UTC (permalink / raw)
  To: Nicolas Ferre; +Cc: vinod.koul, dan.j.williams, linux-arm-kernel, linux-kernel

Hello.

On 09-05-2011 20:11, Nicolas Ferre wrote:

> The addition of the pause feature to atc_control an active wait was introduced
> to check the FIFO empty event.

    Couldn't parse this -- did you forget "with"at the start of the statement?

> This event was not always happening and
> a timout contition was needed.
> But, in some cases, this event depend on the peripheral connected to the
> channel that is paused: FIFO becomes empty if the peripheral consumes data.
> The timeout is pretty difficult to evaluate. Moreover, this check is not
> needed.
> In conclusion, it seems sensible to entirely remove the checking of
> "FIFO empty" status when pausing.

> Signed-off-by: Nicolas Ferre<nicolas.ferre@atmel.com>

WBR, Sergei

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
@ 2011-05-10 11:56         ` Sergei Shtylyov
  0 siblings, 0 replies; 26+ messages in thread
From: Sergei Shtylyov @ 2011-05-10 11:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 09-05-2011 20:11, Nicolas Ferre wrote:

> The addition of the pause feature to atc_control an active wait was introduced
> to check the FIFO empty event.

    Couldn't parse this -- did you forget "with"at the start of the statement?

> This event was not always happening and
> a timout contition was needed.
> But, in some cases, this event depend on the peripheral connected to the
> channel that is paused: FIFO becomes empty if the peripheral consumes data.
> The timeout is pretty difficult to evaluate. Moreover, this check is not
> needed.
> In conclusion, it seems sensible to entirely remove the checking of
> "FIFO empty" status when pausing.

> Signed-off-by: Nicolas Ferre<nicolas.ferre@atmel.com>

WBR, Sergei

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
  2011-05-10 11:56         ` Sergei Shtylyov
@ 2011-05-10 12:05           ` Nicolas Ferre
  -1 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-10 12:05 UTC (permalink / raw)
  To: Sergei Shtylyov, vinod.koul
  Cc: dan.j.williams, linux-arm-kernel, linux-kernel

Le 10/05/2011 13:56, Sergei Shtylyov :
> Hello.
> 
> On 09-05-2011 20:11, Nicolas Ferre wrote:
> 
>> The addition of the pause feature to atc_control an active wait was
>> introduced
>> to check the FIFO empty event.
> 
>    Couldn't parse this -- did you forget "with"at the start of the
> statement?

Absolutely. A comma can also improve things... is it better like this?

"
With the addition of the "pause" feature, an active wait loop was
introduced to check the "FIFO empty" event.
"

Vinod, tell me if you want me to send a new patch.

>> This event was not always happening and
>> a timout contition was needed.
>> But, in some cases, this event depend on the peripheral connected to the
>> channel that is paused: FIFO becomes empty if the peripheral consumes
>> data.
>> The timeout is pretty difficult to evaluate. Moreover, this check is not
>> needed.
>> In conclusion, it seems sensible to entirely remove the checking of
>> "FIFO empty" status when pausing.
> 
>> Signed-off-by: Nicolas Ferre<nicolas.ferre@atmel.com>
> 
> WBR, Sergei

Thanks, best regards,
-- 
Nicolas Ferre


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
@ 2011-05-10 12:05           ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-10 12:05 UTC (permalink / raw)
  To: linux-arm-kernel

Le 10/05/2011 13:56, Sergei Shtylyov :
> Hello.
> 
> On 09-05-2011 20:11, Nicolas Ferre wrote:
> 
>> The addition of the pause feature to atc_control an active wait was
>> introduced
>> to check the FIFO empty event.
> 
>    Couldn't parse this -- did you forget "with"at the start of the
> statement?

Absolutely. A comma can also improve things... is it better like this?

"
With the addition of the "pause" feature, an active wait loop was
introduced to check the "FIFO empty" event.
"

Vinod, tell me if you want me to send a new patch.

>> This event was not always happening and
>> a timout contition was needed.
>> But, in some cases, this event depend on the peripheral connected to the
>> channel that is paused: FIFO becomes empty if the peripheral consumes
>> data.
>> The timeout is pretty difficult to evaluate. Moreover, this check is not
>> needed.
>> In conclusion, it seems sensible to entirely remove the checking of
>> "FIFO empty" status when pausing.
> 
>> Signed-off-by: Nicolas Ferre<nicolas.ferre@atmel.com>
> 
> WBR, Sergei

Thanks, best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
  2011-05-10 12:05           ` Nicolas Ferre
@ 2011-05-11 16:53             ` Koul, Vinod
  -1 siblings, 0 replies; 26+ messages in thread
From: Koul, Vinod @ 2011-05-11 16:53 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Sergei Shtylyov, dan.j.williams, linux-arm-kernel, linux-kernel

On Tue, 2011-05-10 at 14:05 +0200, Nicolas Ferre wrote:
> Le 10/05/2011 13:56, Sergei Shtylyov :
> > Hello.
> > 
> > On 09-05-2011 20:11, Nicolas Ferre wrote:
> > 
> >> The addition of the pause feature to atc_control an active wait was
> >> introduced
> >> to check the FIFO empty event.
> > 
> >    Couldn't parse this -- did you forget "with"at the start of the
> > statement?
> 
> Absolutely. A comma can also improve things... is it better like this?
> 
> "
> With the addition of the "pause" feature, an active wait loop was
> introduced to check the "FIFO empty" event.
> "
> 
> Vinod, tell me if you want me to send a new patch.
Its okay, I can fix the commit


-- 
~Vinod


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
@ 2011-05-11 16:53             ` Koul, Vinod
  0 siblings, 0 replies; 26+ messages in thread
From: Koul, Vinod @ 2011-05-11 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2011-05-10 at 14:05 +0200, Nicolas Ferre wrote:
> Le 10/05/2011 13:56, Sergei Shtylyov :
> > Hello.
> > 
> > On 09-05-2011 20:11, Nicolas Ferre wrote:
> > 
> >> The addition of the pause feature to atc_control an active wait was
> >> introduced
> >> to check the FIFO empty event.
> > 
> >    Couldn't parse this -- did you forget "with"at the start of the
> > statement?
> 
> Absolutely. A comma can also improve things... is it better like this?
> 
> "
> With the addition of the "pause" feature, an active wait loop was
> introduced to check the "FIFO empty" event.
> "
> 
> Vinod, tell me if you want me to send a new patch.
Its okay, I can fix the commit


-- 
~Vinod

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
  2011-05-09 16:11       ` Nicolas Ferre
@ 2011-05-12  8:28         ` Koul, Vinod
  -1 siblings, 0 replies; 26+ messages in thread
From: Koul, Vinod @ 2011-05-12  8:28 UTC (permalink / raw)
  To: Nicolas Ferre; +Cc: dan.j.williams, linux-arm-kernel, linux-kernel

On Mon, 2011-05-09 at 18:11 +0200, Nicolas Ferre wrote:
> The addition of the pause feature to atc_control an active wait was introduced
> to check the FIFO empty event. This event was not always happening and
> a timout contition was needed.
> But, in some cases, this event depend on the peripheral connected to the
> channel that is paused: FIFO becomes empty if the peripheral consumes data.
> The timeout is pretty difficult to evaluate. Moreover, this check is not
> needed.
> In conclusion, it seems sensible to entirely remove the checking of
> "FIFO empty" status when pausing.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> Vinod,
> 
> This additional patch goes on top of your current "next" branch. It is a
> removing of some code added to the pause/resume patch sent earlier and can be
> folded into this one if you want to.
> 
Applied with edit in commit msg, Thanks

-- 
~Vinod


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
@ 2011-05-12  8:28         ` Koul, Vinod
  0 siblings, 0 replies; 26+ messages in thread
From: Koul, Vinod @ 2011-05-12  8:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2011-05-09 at 18:11 +0200, Nicolas Ferre wrote:
> The addition of the pause feature to atc_control an active wait was introduced
> to check the FIFO empty event. This event was not always happening and
> a timout contition was needed.
> But, in some cases, this event depend on the peripheral connected to the
> channel that is paused: FIFO becomes empty if the peripheral consumes data.
> The timeout is pretty difficult to evaluate. Moreover, this check is not
> needed.
> In conclusion, it seems sensible to entirely remove the checking of
> "FIFO empty" status when pausing.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> Vinod,
> 
> This additional patch goes on top of your current "next" branch. It is a
> removing of some code added to the pause/resume patch sent earlier and can be
> folded into this one if you want to.
> 
Applied with edit in commit msg, Thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
  2011-05-12  8:28         ` Koul, Vinod
@ 2011-05-12  9:20           ` Nicolas Ferre
  -1 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-12  9:20 UTC (permalink / raw)
  To: Koul, Vinod; +Cc: dan.j.williams, linux-arm-kernel, linux-kernel

Le 12/05/2011 10:28, Koul, Vinod :
> On Mon, 2011-05-09 at 18:11 +0200, Nicolas Ferre wrote:
>> The addition of the pause feature to atc_control an active wait was introduced
>> to check the FIFO empty event. This event was not always happening and
>> a timout contition was needed.
>> But, in some cases, this event depend on the peripheral connected to the
>> channel that is paused: FIFO becomes empty if the peripheral consumes data.
>> The timeout is pretty difficult to evaluate. Moreover, this check is not
>> needed.
>> In conclusion, it seems sensible to entirely remove the checking of
>> "FIFO empty" status when pausing.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> ---
>> Vinod,
>>
>> This additional patch goes on top of your current "next" branch. It is a
>> removing of some code added to the pause/resume patch sent earlier and can be
>> folded into this one if you want to.
>>
> Applied with edit in commit msg, Thanks

Thanks a lot.

Bye,
-- 
Nicolas Ferre


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty
@ 2011-05-12  9:20           ` Nicolas Ferre
  0 siblings, 0 replies; 26+ messages in thread
From: Nicolas Ferre @ 2011-05-12  9:20 UTC (permalink / raw)
  To: linux-arm-kernel

Le 12/05/2011 10:28, Koul, Vinod :
> On Mon, 2011-05-09 at 18:11 +0200, Nicolas Ferre wrote:
>> The addition of the pause feature to atc_control an active wait was introduced
>> to check the FIFO empty event. This event was not always happening and
>> a timout contition was needed.
>> But, in some cases, this event depend on the peripheral connected to the
>> channel that is paused: FIFO becomes empty if the peripheral consumes data.
>> The timeout is pretty difficult to evaluate. Moreover, this check is not
>> needed.
>> In conclusion, it seems sensible to entirely remove the checking of
>> "FIFO empty" status when pausing.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> ---
>> Vinod,
>>
>> This additional patch goes on top of your current "next" branch. It is a
>> removing of some code added to the pause/resume patch sent earlier and can be
>> folded into this one if you want to.
>>
> Applied with edit in commit msg, Thanks

Thanks a lot.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2011-05-12  9:20 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 18:14 [PATCH 1/2] dmaengine: at_hdmac: set residue as total len in atc_tx_status Nicolas Ferre
2011-05-04 18:14 ` Nicolas Ferre
2011-05-04 18:14 ` [PATCH 2/2] dmaengine: at_hdmac: implement pause and resume in atc_control Nicolas Ferre
2011-05-04 18:14   ` Nicolas Ferre
2011-05-07 18:05   ` Linus Walleij
2011-05-07 18:05     ` Linus Walleij
2011-05-06 17:56 ` [PATCH v2 1/3] dmaengine: at_hdmac: set residue as total len in atc_tx_status Nicolas Ferre
2011-05-06 17:56   ` Nicolas Ferre
2011-05-06 17:56   ` [PATCH v2 2/3] dmaengine: at_hdmac: implement pause and resume in atc_control Nicolas Ferre
2011-05-06 17:56     ` Nicolas Ferre
2011-05-06 16:56     ` Nicolas Ferre
2011-05-06 16:56       ` Nicolas Ferre
2011-05-09 16:11     ` [PATCH] dmaengine: at_hdmac: pause: no need to wait for FIFO empty Nicolas Ferre
2011-05-09 16:11       ` Nicolas Ferre
2011-05-10 11:56       ` Sergei Shtylyov
2011-05-10 11:56         ` Sergei Shtylyov
2011-05-10 12:05         ` Nicolas Ferre
2011-05-10 12:05           ` Nicolas Ferre
2011-05-11 16:53           ` Koul, Vinod
2011-05-11 16:53             ` Koul, Vinod
2011-05-12  8:28       ` Koul, Vinod
2011-05-12  8:28         ` Koul, Vinod
2011-05-12  9:20         ` Nicolas Ferre
2011-05-12  9:20           ` Nicolas Ferre
2011-05-06 17:56   ` [PATCH v2 3/3] dmaengine: at_hdmac: use descriptor chaining help function Nicolas Ferre
2011-05-06 17:56     ` Nicolas Ferre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.