From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 488DCC388F9 for ; Sun, 8 Nov 2020 15:33:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D313E206E0 for ; Sun, 8 Nov 2020 15:33:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="n7BulsBW"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="jHVr2WEC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D313E206E0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=T9BkEliPlwVa35mdTPx9/winkvuaZWkIXfXOUc7yLsU=; b=n7BulsBW/9tJuOqQp8yKF8J0b bR44Tne3NnwwFz14RloPRBQyYSw5q41d1jun6p6sKQJRy0Rp4Rlg3m2BYDbs7issAm5R5koiucz4M KeuAkZvm5Xm972IZVi4zKqxjHUzH8iSIZUInuocZd9b5oRVH0Tqu4cZf9DfbfWvtSWskfnwJqeyHD p3JmoABnULXMDWXvW5JdDL1kBkbbG/llbZX0aqhzI1C6uoRcdj+AUdFbzyZVWk9App7O54nBUqDjK A9avmiP+SRZmf63M14vg7rep07/PMex4Rx7yIlWwKDhnShw/3Y0wcJ9QliOmuhJfSaWkl3bVZPfS2 7AvfgVDYA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kbmfu-0005uT-EC; Sun, 08 Nov 2020 15:32:14 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kbmfs-0005u0-5j for linux-arm-kernel@lists.infradead.org; Sun, 08 Nov 2020 15:32:13 +0000 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 4B492206E0; Sun, 8 Nov 2020 15:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604849530; bh=hzzEOE8KcptRT00HXVKeMWjrWy6JY/zrHz1aMOEGi3E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jHVr2WECv/0IdgCFKzHdh5muE4w7tm8d8q1IPaWS+X4OAPlhyEAGFJkde8FiIeMw7 PpLE+x4nTEoWiBHYrMyZbYkyj+892C4WspqY480pRssqTNn6VxETb3aNBjmBqb9JCm CyifnZdf8bO4i/KdGGqVDbXVEQYXf0HwiODXa1SQ= Date: Sun, 8 Nov 2020 15:32:05 +0000 From: Jonathan Cameron To: Fabrice Gasnier Subject: Re: [PATCH] iio: adc: stm32-adc: dma transfers cleanup Message-ID: <20201108153205.7aa4fa28@archlinux> In-Reply-To: <8ed73130-57e7-4073-cdf2-5f31596e728c@st.com> References: <20201105142941.27301-1-olivier.moysan@st.com> <8ed73130-57e7-4073-cdf2-5f31596e728c@st.com> X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201108_103212_406998_1225B478 X-CRM114-Status: GOOD ( 25.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lars@metafoo.de, Olivier Moysan , alexandre.torgue@st.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, pmeerw@pmeerw.net, knaack.h@gmx.de, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 5 Nov 2020 18:38:27 +0100 Fabrice Gasnier wrote: > On 11/5/20 3:29 PM, Olivier Moysan wrote: > > - Remove processing related to DMA in irq handler as this > > data transfer is managed directly in DMA callback. > > - Update comment in stm32_adc_set_watermark() function. > > > > Signed-off-by: Olivier Moysan > > Hi Olivier, > > Reviewed-by: Fabrice Gasnier Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at it. Thanks, Jonathan > > Thanks, > Fabrice > > --- > > drivers/iio/adc/stm32-adc.c | 29 ++++++----------------------- > > 1 file changed, 6 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c > > index b3f31f147347..08be826f1462 100644 > > --- a/drivers/iio/adc/stm32-adc.c > > +++ b/drivers/iio/adc/stm32-adc.c > > @@ -1310,7 +1310,7 @@ static int stm32_adc_set_watermark(struct iio_dev *indio_dev, unsigned int val) > > * dma cyclic transfers are used, buffer is split into two periods. > > * There should be : > > * - always one buffer (period) dma is working on > > - * - one buffer (period) driver can push with iio_trigger_poll(). > > + * - one buffer (period) driver can push data. > > */ > > watermark = min(watermark, val * (unsigned)(sizeof(u16))); > > adc->rx_buf_sz = min(rx_buf_sz, watermark * 2 * adc->num_conv); > > @@ -1573,31 +1573,14 @@ static irqreturn_t stm32_adc_trigger_handler(int irq, void *p) > > > > dev_dbg(&indio_dev->dev, "%s bufi=%d\n", __func__, adc->bufi); > > > > - if (!adc->dma_chan) { > > - /* reset buffer index */ > > - adc->bufi = 0; > > - iio_push_to_buffers_with_timestamp(indio_dev, adc->buffer, > > - pf->timestamp); > > - } else { > > - int residue = stm32_adc_dma_residue(adc); > > - > > - while (residue >= indio_dev->scan_bytes) { > > - u16 *buffer = (u16 *)&adc->rx_buf[adc->bufi]; > > - > > - iio_push_to_buffers_with_timestamp(indio_dev, buffer, > > - pf->timestamp); > > - residue -= indio_dev->scan_bytes; > > - adc->bufi += indio_dev->scan_bytes; > > - if (adc->bufi >= adc->rx_buf_sz) > > - adc->bufi = 0; > > - } > > - } > > - > > + /* reset buffer index */ > > + adc->bufi = 0; > > + iio_push_to_buffers_with_timestamp(indio_dev, adc->buffer, > > + pf->timestamp); > > iio_trigger_notify_done(indio_dev->trig); > > > > /* re-enable eoc irq */ > > - if (!adc->dma_chan) > > - stm32_adc_conv_irq_enable(adc); > > + stm32_adc_conv_irq_enable(adc); > > > > return IRQ_HANDLED; > > } > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel