Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp831555img; Thu, 21 Mar 2019 09:50:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFkH0kUyziyAg47ZLvF0i4LAXya0kd352p5EqaBMDihSRW5ALr59BMgLPtPY2poV5bFh4e X-Received: by 2002:a17:902:900a:: with SMTP id a10mr4605404plp.183.1553187001982; Thu, 21 Mar 2019 09:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553187001; cv=none; d=google.com; s=arc-20160816; b=INZDMn+vvz24xBgQceNooCW64yPQmyaJ8IbGlDLLBn/EQnLdtQXTmpr5GQltLb0joJ ssseYP39ctygf9QVv8hu6+/wX8mzC/He1wq14PdrSTGqO36TEfnXUCX3Qt2kE72vdXZh ERlOhCNfZ7A/l3j5s2gRAhx/9iQTYoYauJHcbTZLezFU3IU7h7ArCsB1rAOyACs3egbx IE9faWqwKilaMtQYO+YzqrkHmPmuAdZp3Vbviy6lLZSoi01QjjJ6ksP3NITYegaolcju ydQMVxMkUGvTFGw0DxzojKtPNnDiMLNEEsZTmJZ+9PHypFlWklsjLhf1Bm6WgymtsXnM 4eyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=eYrAWca4nv1BmjXXCcupYnvA9eFd/Rm4+DJvoxLxuuA=; b=QLQ6jFxRGyEXnsiowA3IYd+UDB1pNDACjdZwKXob0nMMn1+lgt6XdSQnqZEABSBUDt VmqRe/PAlxikx+SnrXXTpgarSVqeCE1tf0fYFT6LFjIlAya3iTeMAaHA2P92ngDu83Ff fxL0c/Q+W4xdX/E5AIy8dw4SsQw4MlM9HW1xfsnCZfmuPDy3nmn1KWhFMYn6bvu8fny5 Vf+y6SmRp9H06uT62D1wTwOPhBcmHhdgAddfI/9YkCA4nG8LKsbz3XnoEkTjz+Eva17X 6LtjAVB9xZz/nhKmuTX0eyGKq9t36UzCeR3dNv37kYOirxo5YtOIFHXg20NEf6Ih4uzc pHfQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si4439632pgc.576.2019.03.21.09.49.47; Thu, 21 Mar 2019 09:50:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728658AbfCUQsK (ORCPT + 99 others); Thu, 21 Mar 2019 12:48:10 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:19884 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728606AbfCUQsH (ORCPT ); Thu, 21 Mar 2019 12:48:07 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2LGlcCk004726; Thu, 21 Mar 2019 17:47:40 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2r8q5bpymk-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 21 Mar 2019 17:47:40 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id CEF0D31; Thu, 21 Mar 2019 16:47:39 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id AB5265670; Thu, 21 Mar 2019 16:47:39 +0000 (GMT) Received: from localhost (10.75.127.46) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 21 Mar 2019 17:47:39 +0100 From: Fabrice Gasnier To: CC: , , , , , , , , , , , Subject: [PATCH v2 5/8] iio: adc: stm32-dfsdm: enable hw consumer Date: Thu, 21 Mar 2019 17:47:26 +0100 Message-ID: <1553186849-6261-6-git-send-email-fabrice.gasnier@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553186849-6261-1-git-send-email-fabrice.gasnier@st.com> References: <1553186849-6261-1-git-send-email-fabrice.gasnier@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG7NODE1.st.com (10.75.127.19) To SFHDAG5NODE3.st.com (10.75.127.15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-21_07:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Optionally enable IIO hw consumer, when provided (e.g. for DFSDM_IIO type). This is precursor patch to introduce buffer modes. Signed-off-by: Fabrice Gasnier --- drivers/iio/adc/stm32-dfsdm-adc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c index 66e2ea0..b491424 100644 --- a/drivers/iio/adc/stm32-dfsdm-adc.c +++ b/drivers/iio/adc/stm32-dfsdm-adc.c @@ -630,9 +630,15 @@ static int stm32_dfsdm_postenable(struct iio_dev *indio_dev) /* Reset adc buffer index */ adc->bufi = 0; + if (adc->hwc) { + ret = iio_hw_consumer_enable(adc->hwc); + if (ret < 0) + return ret; + } + ret = stm32_dfsdm_start_dfsdm(adc->dfsdm); if (ret < 0) - return ret; + goto err_stop_hwc; ret = stm32_dfsdm_adc_dma_start(indio_dev); if (ret) { @@ -652,6 +658,9 @@ static int stm32_dfsdm_postenable(struct iio_dev *indio_dev) stm32_dfsdm_adc_dma_stop(indio_dev); stop_dfsdm: stm32_dfsdm_stop_dfsdm(adc->dfsdm); +err_stop_hwc: + if (adc->hwc) + iio_hw_consumer_disable(adc->hwc); return ret; } @@ -667,6 +676,9 @@ static int stm32_dfsdm_predisable(struct iio_dev *indio_dev) stm32_dfsdm_stop_dfsdm(adc->dfsdm); + if (adc->hwc) + iio_hw_consumer_disable(adc->hwc); + return 0; } -- 2.7.4