Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2478310img; Sun, 24 Mar 2019 09:47:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY/p6hZk+goF/FiYhejS/QwqGrYYhA6GKUCG9H69NTp+2hrXYaAylzqaGdOP08OqOSQUDd X-Received: by 2002:a63:2a8f:: with SMTP id q137mr18973742pgq.31.1553446036848; Sun, 24 Mar 2019 09:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553446036; cv=none; d=google.com; s=arc-20160816; b=Tg3EjBrF2fU7LpUqYeroYZAoncg+Kupn9tcFBF/RE8JGT8FlzzcGO96HfWF1Y9e4Jq FFo3j8MDPY4FX80k9ciJPSvEgSQcW/75Orfb+VEX2NrDBS5+uxm6QYA234txSxu8cnKl Wd3z8CKjBFxs5RDGfWjEQnkpUYkYuoyS5PPnhvucq4e/zJnrRj0SXcU5PtPrRuLnNMqv VpSUpf5WEpwgFSod9krHJNBB59ZkbvDSuVOUu1SOAJGzxDdNrzyyE6TtzwcobqWvW/T8 bRxx74QQQ+H6NaZ0tPmLY69Mk1dQCZNU2vSE/fyCuO1vH3WkuX4en2mft3pK4HRHyQtE Vlvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=LrAjttEORLcXVSPT5jSgEuCFOI6ibgiE73Gv88ywXKM=; b=V63lCsm3kuwBhpux/UcdahvuhNZxQCwy/SXzU2EFJ7XZKQt/zxk88JxsqJD6ZpVCl0 7G9hFkwHKWrD2i8oyXnePuXUefYgFO51q+w7uup0zbgT6p0zHg1RcFutnkG9s7/7LdkK wV0QpbbKv97vF34E4JcAIX+GnxyY4O07Zc8iu2kdScbvJDFAjeITBfWH/nvgxEfSFQGA CPwffMJdIrI9GTmvCGRXdNW1IOcW0ol4nA25dHfnYBulhPraoC2X0mUB5nysDgPzi5jf aSddrndAs5A6BV4w1qubLxZXJUoPCML12734lnTQIC6T/vMEm8ZaXtjP/bMXKCksdJyo R1cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xry1T2bb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ci1si13474570plb.352.2019.03.24.09.47.02; Sun, 24 Mar 2019 09:47:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xry1T2bb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728799AbfCXQpO (ORCPT + 99 others); Sun, 24 Mar 2019 12:45:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:55286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfCXQpN (ORCPT ); Sun, 24 Mar 2019 12:45:13 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E541B20823; Sun, 24 Mar 2019 16:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553445912; bh=9ha9iBJSrGdfQRy3Kni8G5gidcJyEqeEedHg+5Xl4YA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Xry1T2bbvtbtYni9DHlD7dRIRNvGhX4gV/WG7eKmfKRdfEFpC6UDk615FlLm1+NrI ONipWs8ywh6J6/1xz0lSo0YgWqP+EhxjLAZioacKiBzUroIyqf6VMrRkvvuW45NbeA rWlxB6G13ETSD+yty33km+WLlRJKA3v0eyy3PDjE= Date: Sun, 24 Mar 2019 16:45:06 +0000 From: Jonathan Cameron To: Fabrice Gasnier Cc: , , , , , , , , , , Subject: Re: [PATCH v2 4/8] iio: adc: stm32-dfsdm: move dma slave config to start routine Message-ID: <20190324164506.595f35e3@archlinux> In-Reply-To: <1553186849-6261-5-git-send-email-fabrice.gasnier@st.com> References: <1553186849-6261-1-git-send-email-fabrice.gasnier@st.com> <1553186849-6261-5-git-send-email-fabrice.gasnier@st.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Mar 2019 17:47:25 +0100 Fabrice Gasnier wrote: > Move DMA slave configuration to start routine: depending on regular or > injected mode is in use, DMA needs to read resp. RDATAR or JDATAR. > This is precursor patch to introduce injected mode (used for scan). > > Signed-off-by: Fabrice Gasnier Applied, thanks, Jonathan > --- > drivers/iio/adc/stm32-dfsdm-adc.c | 31 +++++++++++-------------------- > 1 file changed, 11 insertions(+), 20 deletions(-) > > diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c > index 818627f..66e2ea0 100644 > --- a/drivers/iio/adc/stm32-dfsdm-adc.c > +++ b/drivers/iio/adc/stm32-dfsdm-adc.c > @@ -556,6 +556,11 @@ static void stm32_dfsdm_audio_dma_buffer_done(void *data) > static int stm32_dfsdm_adc_dma_start(struct iio_dev *indio_dev) > { > struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); > + struct dma_slave_config config = { > + .src_addr = (dma_addr_t)adc->dfsdm->phys_base + > + DFSDM_RDATAR(adc->fl_id), > + .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, > + }; > struct dma_async_tx_descriptor *desc; > dma_cookie_t cookie; > int ret; > @@ -566,6 +571,10 @@ static int stm32_dfsdm_adc_dma_start(struct iio_dev *indio_dev) > dev_dbg(&indio_dev->dev, "%s size=%d watermark=%d\n", __func__, > adc->buf_sz, adc->buf_sz / 2); > > + ret = dmaengine_slave_config(adc->dma_chan, &config); > + if (ret) > + return ret; > + > /* Prepare a DMA cyclic transaction */ > desc = dmaengine_prep_dma_cyclic(adc->dma_chan, > adc->dma_buf, > @@ -925,12 +934,6 @@ static void stm32_dfsdm_dma_release(struct iio_dev *indio_dev) > static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev) > { > struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); > - struct dma_slave_config config = { > - .src_addr = (dma_addr_t)adc->dfsdm->phys_base + > - DFSDM_RDATAR(adc->fl_id), > - .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, > - }; > - int ret; > > adc->dma_chan = dma_request_slave_channel(&indio_dev->dev, "rx"); > if (!adc->dma_chan) > @@ -940,23 +943,11 @@ static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev) > DFSDM_DMA_BUFFER_SIZE, > &adc->dma_buf, GFP_KERNEL); > if (!adc->rx_buf) { > - ret = -ENOMEM; > - goto err_release; > + dma_release_channel(adc->dma_chan); > + return -ENOMEM; > } > > - ret = dmaengine_slave_config(adc->dma_chan, &config); > - if (ret) > - goto err_free; > - > return 0; > - > -err_free: > - dma_free_coherent(adc->dma_chan->device->dev, DFSDM_DMA_BUFFER_SIZE, > - adc->rx_buf, adc->dma_buf); > -err_release: > - dma_release_channel(adc->dma_chan); > - > - return ret; > } > > static int stm32_dfsdm_adc_chan_init_one(struct iio_dev *indio_dev,