From: Vinod Koul <vinod.koul@intel.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-mips@linux-mips.org, alsa-devel@alsa-project.org,
Liam Girdwood <lgirdwood@gmail.com>,
Ralf Baechle <ralf@linux-mips.org>,
linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>,
Maarten ter Huurne <maarten@treewalker.org>
Subject: Re: [PATCH 3/6] dma: Add a jz4740 dmaengine driver
Date: Fri, 24 May 2013 13:24:03 +0530 [thread overview]
Message-ID: <20130524075403.GS30200@intel.com> (raw)
In-Reply-To: <519F0B81.1090009@metafoo.de>
On Fri, May 24, 2013 at 08:41:05AM +0200, Lars-Peter Clausen wrote:
> On 05/24/2013 07:54 AM, Vinod Koul wrote:
> > On Fri, May 24, 2013 at 07:58:04AM +0200, Lars-Peter Clausen wrote:
> >> This one needs both.
> >>
> >>>> + jzcfg.mode = JZ4740_DMA_MODE_SINGLE;
> >>>> + jzcfg.request_type = config->slave_id;
> >>>> +
> >>>> + chan->config = *config;
> >>>> +
> >>>> + jz4740_dma_configure(chan->jz_chan, &jzcfg);
> >>>> +
> >>>> + return 0;
> >>> You are NOT use src_addr/dstn_addr? How else are you passing the periphral
> >>> address?
> >> I'm saving the whole config, which will later be used to retrieve the source or
> >> dest address.
> > well I missed that and it is a bad idea. You dont know when client has
> > freed/thrown the pointer so copy this instead..
>
> I do copy the full config, not just the pointer to the config. Although
> src_addr and dest_addr are the only two fields which are used later on at this
> point. So I could change it to just copy src_addr and dest_addr, or well just
> one of them depending on the direction.
One of them based on direction would be right
>
> >
> >>
> >>>> +}
> >> [...]
> >>>> +static int jz4740_dma_alloc_chan_resources(struct dma_chan *c)
> >>>> +{
> >>>> + struct jz4740_dmaengine_chan *chan = to_jz4740_dma_chan(c);
> >>>> +
> >>>> + chan->jz_chan = jz4740_dma_request(chan, NULL);
> >>>> + if (!chan->jz_chan)
> >>>> + return -EBUSY;
> >>>> +
> >>>> + jz4740_dma_set_complete_cb(chan->jz_chan, jz4740_dma_complete_cb);
> >>>> +
> >>>> + return 0;
> >>> Zero is not expected value, you need to return the descriptors allocated
> >>> sucessfully.
> >>
> >> Well, zero descriptors have been allocated. As far as I can see only a negative
> >> return value is treated as an error. Also the core doesn't seem to use the
> >> return value for anything else but checking if it is an error.
> > This is the API defination
> > * @device_alloc_chan_resources: allocate resources and return the
> > * number of allocated descriptors
> >
>
> But 0 is still the number of descriptors that have been pre-allocated.
and that should change, typically the driver will preallocate a pool of
descriptors. These are to be used later for .device_prep_xxx calls.
--
~Vinod
WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vinod.koul@intel.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Ralf Baechle <ralf@linux-mips.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Maarten ter Huurne <maarten@treewalker.org>,
linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
alsa-devel@alsa-project.org
Subject: Re: [PATCH 3/6] dma: Add a jz4740 dmaengine driver
Date: Fri, 24 May 2013 13:24:03 +0530 [thread overview]
Message-ID: <20130524075403.GS30200@intel.com> (raw)
In-Reply-To: <519F0B81.1090009@metafoo.de>
On Fri, May 24, 2013 at 08:41:05AM +0200, Lars-Peter Clausen wrote:
> On 05/24/2013 07:54 AM, Vinod Koul wrote:
> > On Fri, May 24, 2013 at 07:58:04AM +0200, Lars-Peter Clausen wrote:
> >> This one needs both.
> >>
> >>>> + jzcfg.mode = JZ4740_DMA_MODE_SINGLE;
> >>>> + jzcfg.request_type = config->slave_id;
> >>>> +
> >>>> + chan->config = *config;
> >>>> +
> >>>> + jz4740_dma_configure(chan->jz_chan, &jzcfg);
> >>>> +
> >>>> + return 0;
> >>> You are NOT use src_addr/dstn_addr? How else are you passing the periphral
> >>> address?
> >> I'm saving the whole config, which will later be used to retrieve the source or
> >> dest address.
> > well I missed that and it is a bad idea. You dont know when client has
> > freed/thrown the pointer so copy this instead..
>
> I do copy the full config, not just the pointer to the config. Although
> src_addr and dest_addr are the only two fields which are used later on at this
> point. So I could change it to just copy src_addr and dest_addr, or well just
> one of them depending on the direction.
One of them based on direction would be right
>
> >
> >>
> >>>> +}
> >> [...]
> >>>> +static int jz4740_dma_alloc_chan_resources(struct dma_chan *c)
> >>>> +{
> >>>> + struct jz4740_dmaengine_chan *chan = to_jz4740_dma_chan(c);
> >>>> +
> >>>> + chan->jz_chan = jz4740_dma_request(chan, NULL);
> >>>> + if (!chan->jz_chan)
> >>>> + return -EBUSY;
> >>>> +
> >>>> + jz4740_dma_set_complete_cb(chan->jz_chan, jz4740_dma_complete_cb);
> >>>> +
> >>>> + return 0;
> >>> Zero is not expected value, you need to return the descriptors allocated
> >>> sucessfully.
> >>
> >> Well, zero descriptors have been allocated. As far as I can see only a negative
> >> return value is treated as an error. Also the core doesn't seem to use the
> >> return value for anything else but checking if it is an error.
> > This is the API defination
> > * @device_alloc_chan_resources: allocate resources and return the
> > * number of allocated descriptors
> >
>
> But 0 is still the number of descriptors that have been pre-allocated.
and that should change, typically the driver will preallocate a pool of
descriptors. These are to be used later for .device_prep_xxx calls.
--
~Vinod
next prev parent reply other threads:[~2013-05-24 8:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 20:36 [PATCH 0/6] Convert JZ4740 to dmaengine Lars-Peter Clausen
2013-05-23 20:36 ` Lars-Peter Clausen
2013-05-23 20:36 ` [PATCH 1/6] MIPS: jz4740: Correct clock gate bit for DMA controller Lars-Peter Clausen
2013-05-23 20:36 ` [PATCH 2/6] MIPS: jz4740: Acquire and enable DMA controller clock Lars-Peter Clausen
2013-05-23 20:36 ` [PATCH 3/6] dma: Add a jz4740 dmaengine driver Lars-Peter Clausen
2013-05-24 4:59 ` Vinod Koul
2013-05-24 5:58 ` Lars-Peter Clausen
2013-05-24 5:58 ` Lars-Peter Clausen
2013-05-24 5:54 ` Vinod Koul
2013-05-24 6:41 ` Lars-Peter Clausen
2013-05-24 7:54 ` Vinod Koul [this message]
2013-05-24 7:54 ` Vinod Koul
2013-05-24 8:39 ` [alsa-devel] " Lars-Peter Clausen
2013-05-23 20:36 ` [PATCH 4/6] MIPS: jz4740: Register jz4740 DMA device Lars-Peter Clausen
2013-05-23 20:36 ` Lars-Peter Clausen
2013-05-23 20:36 ` [PATCH 5/6] ASoC: jz4740: Use the generic dmaengine PCM driver Lars-Peter Clausen
2013-05-25 15:16 ` Mark Brown
2013-05-23 20:36 ` [PATCH 6/6] MIPS: jz4740: Remove custom DMA API Lars-Peter Clausen
2013-05-29 9:31 ` [PATCH 0/6] Convert JZ4740 to dmaengine Ralf Baechle
2013-05-29 9:31 ` Ralf Baechle
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=20130524075403.GS30200@intel.com \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=maarten@treewalker.org \
--cc=ralf@linux-mips.org \
/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.