From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vinod Koul Subject: Re: [PATCH 3/6] dma: Add a jz4740 dmaengine driver Date: Fri, 24 May 2013 13:24:03 +0530 Message-ID: <20130524075403.GS30200@intel.com> References: <1369341387-19147-1-git-send-email-lars@metafoo.de> <1369341387-19147-4-git-send-email-lars@metafoo.de> <20130524045935.GM30200@intel.com> <519F016C.4040901@metafoo.de> <20130524055453.GR30200@intel.com> <519F0B81.1090009@metafoo.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id 35035261A48 for ; Fri, 24 May 2013 10:30:45 +0200 (CEST) Content-Disposition: inline In-Reply-To: <519F0B81.1090009@metafoo.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Lars-Peter Clausen Cc: linux-mips@linux-mips.org, alsa-devel@alsa-project.org, Liam Girdwood , Ralf Baechle , linux-kernel@vger.kernel.org, Mark Brown , Maarten ter Huurne List-Id: alsa-devel@alsa-project.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 24 May 2013 10:31:04 +0200 (CEST) Received: from mga01.intel.com ([192.55.52.88]:51269 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6816642Ab3EXIavxilHz (ORCPT ); Fri, 24 May 2013 10:30:51 +0200 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 24 May 2013 01:30:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,733,1363158000"; d="scan'208";a="342725940" Received: from vkoul-udesk3.iind.intel.com ([10.223.84.41]) by fmsmga002.fm.intel.com with ESMTP; 24 May 2013 01:30:41 -0700 Received: from vkoul-udesk3.iind.intel.com (localhost [127.0.0.1]) by vkoul-udesk3.iind.intel.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id r4O7s9vb016881; Fri, 24 May 2013 13:24:09 +0530 Received: (from vkoul@localhost) by vkoul-udesk3.iind.intel.com (8.14.3/8.14.3/Submit) id r4O7s3Za016763; Fri, 24 May 2013 13:24:03 +0530 X-Authentication-Warning: vkoul-udesk3.iind.intel.com: vkoul set sender to vinod.koul@intel.com using -f Date: Fri, 24 May 2013 13:24:03 +0530 From: Vinod Koul To: Lars-Peter Clausen Cc: Ralf Baechle , Liam Girdwood , Mark Brown , Maarten ter Huurne , 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 Message-ID: <20130524075403.GS30200@intel.com> References: <1369341387-19147-1-git-send-email-lars@metafoo.de> <1369341387-19147-4-git-send-email-lars@metafoo.de> <20130524045935.GM30200@intel.com> <519F016C.4040901@metafoo.de> <20130524055453.GR30200@intel.com> <519F0B81.1090009@metafoo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <519F0B81.1090009@metafoo.de> User-Agent: Mutt/1.5.20 (2009-06-14) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 36584 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: vinod.koul@intel.com Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips 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