From: Vinod Koul <vinod.koul@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.jf.intel.com>
Cc: Viresh Kumar <viresh.linux@gmail.com>,
linux-kernel@vger.kernel.org,
spear-devel <spear-devel@list.st.com>
Subject: Re: [PATCH 2/2] dw_dmac: return proper residue value
Date: Mon, 21 Jan 2013 00:49:24 -0800 [thread overview]
Message-ID: <20130121084924.GA26562@intel.com> (raw)
In-Reply-To: <1358758844-24711-2-git-send-email-andriy.shevchenko@linux.intel.com>
On Mon, Jan 21, 2013 at 11:00:44AM +0200, Andy Shevchenko wrote:
> Currently the driver returns full length of the active descriptor which is
> wrong. We have to go throught the active descriptor and sum up the length of
> unsent children in the chain along with the actual data in the DMA channel
why do you mean by children here?
> registers.
>
> The cyclic case is not handled by this patch due to len field in the descriptor
> structure is left untouched by the original code.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/dma/dw_dmac.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 92 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index d1b9ba2..4325c68 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -941,6 +941,97 @@ err_desc_get:
> return NULL;
> }
>
> +/* --------------------- Calculate residue ---------------------------- */
> +
> +static inline size_t dwc_get_rest(struct dw_dma_chan *dwc, struct dw_desc *desc)
> +{
> + enum dma_transfer_direction direction = dwc->direction;
> +
> + if (direction == DMA_MEM_TO_DEV || direction == DMA_MEM_TO_MEM)
> + return desc->len - (channel_readl(dwc, SAR) - desc->lli.sar);
> + else if (direction == DMA_DEV_TO_MEM)
> + return desc->len - (channel_readl(dwc, DAR) - desc->lli.dar);
> +
> + return 0;
hmmm, why not use BLOCK_TS value. That way you dont need to look at direction
and along with burst can easily calculate residue...
--
~Vinod
next prev parent reply other threads:[~2013-01-21 9:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-21 9:00 [PATCH 1/2] dw_dmac: fill len field of the descriptor Andy Shevchenko
2013-01-21 9:00 ` [PATCH 2/2] dw_dmac: return proper residue value Andy Shevchenko
2013-01-21 8:49 ` Vinod Koul [this message]
2013-01-21 9:45 ` Andy Shevchenko
2013-01-21 14:22 ` Vinod Koul
2013-01-22 7:24 ` Andy Shevchenko
2013-01-22 8:11 ` Viresh Kumar
2013-01-22 9:22 ` Andy Shevchenko
2013-01-22 9:40 ` Viresh Kumar
2013-01-23 9:12 ` Andy Shevchenko
2013-01-23 9:22 ` Viresh Kumar
2013-01-23 9:36 ` Andy Shevchenko
2013-01-23 9:51 ` Viresh Kumar
2013-01-23 10:20 ` Andy Shevchenko
2013-01-23 10:24 ` Viresh Kumar
2013-01-23 10:33 ` Andy Shevchenko
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=20130121084924.GA26562@intel.com \
--to=vinod.koul@intel.com \
--cc=andriy.shevchenko@linux.jf.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=spear-devel@list.st.com \
--cc=viresh.linux@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox