All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chanho Park <chanho61.park@samsung.com>
To: 'Padmavathi Venna' <padma.v@samsung.com>,
	linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, padma.kvr@gmail.com
Cc: kgene.kim@samsung.com, arnd@arndb.de, sbkim73@samsung.com,
	vinod.koul@intel.com, broonie@kernel.org, dgreid@chromium.org,
	olofj@chromium.org
Subject: RE: [PATCH 1/3] dmaengine: pl330: Set residue in tx_status callback.
Date: Thu, 12 Sep 2013 20:40:32 +0900	[thread overview]
Message-ID: <00b401ceafac$e3a88170$aaf98450$@samsung.com> (raw)
In-Reply-To: <1378879685-5352-2-git-send-email-padma.v@samsung.com>

Hi Padmavathi,

> -----Original Message-----
> From: linux-arm-kernel [mailto:linux-arm-kernel-
> bounces@lists.infradead.org] On Behalf Of Padmavathi Venna
> Sent: Wednesday, September 11, 2013 3:08 PM
> To: linux-samsung-soc@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; padma.v@samsung.com; padma.kvr@gmail.com
> Cc: kgene.kim@samsung.com; arnd@arndb.de; sbkim73@samsung.com;
> vinod.koul@intel.com; broonie@kernel.org; dgreid@chromium.org;
> olofj@chromium.org
> Subject: [PATCH 1/3] dmaengine: pl330: Set residue in tx_status callback.
> 
> From: Dylan Reid <dgreid@chromium.org>
> 
> Fill txstate.residue with the amount of bytes remaining in the current
> transfer if the transfer is not complete.  This will be of particular use
> to i2s DMA transfers, providing more accurate hw_ptr values to ASoC.
> 
> Signed-off-by: Dylan Reid <dgreid@chromium.org>
> Reviewed-by: Olof Johansson <olofj@chromium.org>
> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
> ---
>  drivers/dma/pl330.c |   55
> ++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 54 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index
> 593827b..7ab9136 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2476,11 +2476,64 @@ static void pl330_free_chan_resources(struct
> dma_chan *chan)
>  	spin_unlock_irqrestore(&pch->lock, flags);  }
> 
> +static inline int
> +pl330_src_addr_in_desc(struct dma_pl330_desc *desc, unsigned int sar) {
> +	return ((desc->px.src_addr <= sar) &&
> +		(sar <= (desc->px.src_addr + desc->px.bytes))); }
> +
> +static inline int
> +pl330_dst_addr_in_desc(struct dma_pl330_desc *desc, unsigned int dar) {
> +	return ((desc->px.dst_addr <= dar) &&
> +		(dar <= (desc->px.dst_addr + desc->px.bytes))); }
> +
> +static unsigned int pl330_tx_residue(struct dma_chan *chan) {
> +	struct dma_pl330_chan *pch = to_pchan(chan);
> +	void __iomem *regs = pch->dmac->pif.base;
> +	struct pl330_thread *thrd = pch->pl330_chid;
> +	struct dma_pl330_desc *desc;
> +	unsigned int sar, dar;
> +	unsigned int residue = 0;
> +	unsigned long flags;
> +
> +	sar = readl(regs + SA(thrd->id));
> +	dar = readl(regs + DA(thrd->id));
> +
> +	spin_lock_irqsave(&pch->lock, flags);
> +
> +	/* Find the desc related to the current buffer. */
> +	list_for_each_entry(desc, &pch->work_list, node) {
> +		if (desc->rqcfg.src_inc && pl330_src_addr_in_desc(desc,
> sar)) {
> +			residue = desc->px.bytes - (sar -
desc->px.src_addr);
> +			goto found_unlock;
> +		}
> +		if (desc->rqcfg.dst_inc && pl330_dst_addr_in_desc(desc,
> dar)) {
> +			residue = desc->px.bytes - (dar -
desc->px.dst_addr);
> +			goto found_unlock;
> +		}
> +	}
> +
> +found_unlock:
> +	spin_unlock_irqrestore(&pch->lock, flags);
> +
> +	return residue;
> +}
> +
>  static enum dma_status
>  pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
>  		 struct dma_tx_state *txstate)
>  {
> -	return dma_cookie_status(chan, cookie, txstate);
> +	enum dma_status ret;
> +
> +	ret = dma_cookie_status(chan, cookie, txstate);
> +	if (ret != DMA_SUCCESS) /* Not complete, check amount left. */
> +		dma_set_residue(txstate, pl330_tx_residue(chan));
> +
> +	return ret;

Why didn't you use a cookie value to track the request?
The cookie is assigned when each transfer is submitted.
If you save the value in the desc, we can find the request easily.

Thanks,

Best  Regards,
Chanho Park

WARNING: multiple messages have this Message-ID (diff)
From: chanho61.park@samsung.com (Chanho Park)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] dmaengine: pl330: Set residue in tx_status callback.
Date: Thu, 12 Sep 2013 20:40:32 +0900	[thread overview]
Message-ID: <00b401ceafac$e3a88170$aaf98450$@samsung.com> (raw)
In-Reply-To: <1378879685-5352-2-git-send-email-padma.v@samsung.com>

Hi Padmavathi,

> -----Original Message-----
> From: linux-arm-kernel [mailto:linux-arm-kernel-
> bounces at lists.infradead.org] On Behalf Of Padmavathi Venna
> Sent: Wednesday, September 11, 2013 3:08 PM
> To: linux-samsung-soc at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org; padma.v at samsung.com; padma.kvr at gmail.com
> Cc: kgene.kim at samsung.com; arnd at arndb.de; sbkim73 at samsung.com;
> vinod.koul at intel.com; broonie at kernel.org; dgreid at chromium.org;
> olofj at chromium.org
> Subject: [PATCH 1/3] dmaengine: pl330: Set residue in tx_status callback.
> 
> From: Dylan Reid <dgreid@chromium.org>
> 
> Fill txstate.residue with the amount of bytes remaining in the current
> transfer if the transfer is not complete.  This will be of particular use
> to i2s DMA transfers, providing more accurate hw_ptr values to ASoC.
> 
> Signed-off-by: Dylan Reid <dgreid@chromium.org>
> Reviewed-by: Olof Johansson <olofj@chromium.org>
> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
> ---
>  drivers/dma/pl330.c |   55
> ++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 54 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index
> 593827b..7ab9136 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2476,11 +2476,64 @@ static void pl330_free_chan_resources(struct
> dma_chan *chan)
>  	spin_unlock_irqrestore(&pch->lock, flags);  }
> 
> +static inline int
> +pl330_src_addr_in_desc(struct dma_pl330_desc *desc, unsigned int sar) {
> +	return ((desc->px.src_addr <= sar) &&
> +		(sar <= (desc->px.src_addr + desc->px.bytes))); }
> +
> +static inline int
> +pl330_dst_addr_in_desc(struct dma_pl330_desc *desc, unsigned int dar) {
> +	return ((desc->px.dst_addr <= dar) &&
> +		(dar <= (desc->px.dst_addr + desc->px.bytes))); }
> +
> +static unsigned int pl330_tx_residue(struct dma_chan *chan) {
> +	struct dma_pl330_chan *pch = to_pchan(chan);
> +	void __iomem *regs = pch->dmac->pif.base;
> +	struct pl330_thread *thrd = pch->pl330_chid;
> +	struct dma_pl330_desc *desc;
> +	unsigned int sar, dar;
> +	unsigned int residue = 0;
> +	unsigned long flags;
> +
> +	sar = readl(regs + SA(thrd->id));
> +	dar = readl(regs + DA(thrd->id));
> +
> +	spin_lock_irqsave(&pch->lock, flags);
> +
> +	/* Find the desc related to the current buffer. */
> +	list_for_each_entry(desc, &pch->work_list, node) {
> +		if (desc->rqcfg.src_inc && pl330_src_addr_in_desc(desc,
> sar)) {
> +			residue = desc->px.bytes - (sar -
desc->px.src_addr);
> +			goto found_unlock;
> +		}
> +		if (desc->rqcfg.dst_inc && pl330_dst_addr_in_desc(desc,
> dar)) {
> +			residue = desc->px.bytes - (dar -
desc->px.dst_addr);
> +			goto found_unlock;
> +		}
> +	}
> +
> +found_unlock:
> +	spin_unlock_irqrestore(&pch->lock, flags);
> +
> +	return residue;
> +}
> +
>  static enum dma_status
>  pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
>  		 struct dma_tx_state *txstate)
>  {
> -	return dma_cookie_status(chan, cookie, txstate);
> +	enum dma_status ret;
> +
> +	ret = dma_cookie_status(chan, cookie, txstate);
> +	if (ret != DMA_SUCCESS) /* Not complete, check amount left. */
> +		dma_set_residue(txstate, pl330_tx_residue(chan));
> +
> +	return ret;

Why didn't you use a cookie value to track the request?
The cookie is assigned when each transfer is submitted.
If you save the value in the desc, we can find the request easily.

Thanks,

Best  Regards,
Chanho Park

  reply	other threads:[~2013-09-12 11:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11  6:08 [PATCH 0/3] Add pl330 residue support Padmavathi Venna
2013-09-11  6:08 ` Padmavathi Venna
2013-09-11  6:08 ` [PATCH 1/3] dmaengine: pl330: Set residue in tx_status callback Padmavathi Venna
2013-09-11  6:08   ` Padmavathi Venna
2013-09-12 11:40   ` Chanho Park [this message]
2013-09-12 11:40     ` Chanho Park
2013-09-13  3:03     ` Padma Venkat
2013-09-13  3:03       ` Padma Venkat
2013-10-02  4:33     ` Dylan Reid
2013-10-02  4:33       ` Dylan Reid
2013-10-07  1:39       ` Chanho Park
2013-10-07  1:39         ` Chanho Park
2013-10-07  3:48         ` Vinod Koul
2013-10-07  3:48           ` Vinod Koul
2013-10-09 20:37           ` Dylan Reid
2013-10-09 20:37             ` Dylan Reid
2013-10-10 15:58             ` Vinod Koul
2013-10-10 15:58               ` Vinod Koul
2013-12-03 23:56       ` Alban Browaeys
2013-12-03 23:56         ` Alban Browaeys
2013-09-17  7:01   ` Vinod Koul
2013-09-17  7:01     ` Vinod Koul
2013-09-11  6:08 ` [PATCH 2/3] ARM: SAMSUNG: Add residue DMA operation Padmavathi Venna
2013-09-11  6:08   ` Padmavathi Venna
2013-09-11  6:08 ` [PATCH 3/3] ASoC: Update pointer to account for pending dma transfers Padmavathi Venna
2013-09-11  6:08   ` Padmavathi Venna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00b401ceafac$e3a88170$aaf98450$@samsung.com' \
    --to=chanho61.park@samsung.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=dgreid@chromium.org \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=olofj@chromium.org \
    --cc=padma.kvr@gmail.com \
    --cc=padma.v@samsung.com \
    --cc=sbkim73@samsung.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.