Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3936766imb; Wed, 6 Mar 2019 00:59:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxLdGlJe4HO+jomc18x1jhHwQeeRwJhbcvCrRfaWlAR49YDZh9AZMu/4dj9GbPVq361uqvP X-Received: by 2002:a17:902:1008:: with SMTP id b8mr5707512pla.120.1551862760286; Wed, 06 Mar 2019 00:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551862760; cv=none; d=google.com; s=arc-20160816; b=i/QfQkNorI3KrzP513V8g5B0QOjQmAYXpsNvKyiAy3pIt86o5KrvZNFqodSKVJHevF 6RmEt0Z8eaTw/VPJeN8yAE+d1lKu+/x5O6oP6TIlPWxOHUq3dvQWP9bHYWNZ5rvs909a SgHzgFRi1oC9+N+KZqgDkbGS5F9X/57+CthmdyjFuo3GQG3/MKN2gtox/RQOnKOu+3e6 l3PVMejFNDzOon9QyHK8b5Jagq4m15olHa7V78sd3hM5PUL+/bJ/rk1Qz/5Mqvo6xYKH 18YDtbEZ03ahrvDnhU46iNMNS2d4J4yO4zhrGA7f7xfEoHx9Y7vDD16L3iMqsq+hvvbc xEBA== 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=F9xMrQwC1Fyb+lyYoyL6wn/kdss1sbxBE4YFEYapA8KpJ7kEOGwfggK++YD0YCE372 JGw6lx5ptvwUJGW0o5cxSb8mGubknAihNtDgUivJmds0tNljd3SWIXU4B6JbpdrUq3RX WmjdufSXQuBHZS84Rvs2DvoCozV+p8CjZZ7ysCyUiqLwxV8q8VoavqPYBL2Qe3b2JEZM YUzkvGgratB4N9sU/AzVTS4ObrmMIr2frGiK6+h+QEKOCN4RUEC/rmnjltC3tKne2K33 YmhJ6/UDq085fDVFWjmML7WBksXi88/FgwNqbhBub7+TqFI3vC+vCW96gz8KdbTkZjJu 7ADw== 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 t6si989890pgo.409.2019.03.06.00.59.05; Wed, 06 Mar 2019 00:59:20 -0800 (PST) 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 S1729648AbfCFI41 (ORCPT + 99 others); Wed, 6 Mar 2019 03:56:27 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:56134 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729563AbfCFI4X (ORCPT ); Wed, 6 Mar 2019 03:56:23 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x268q6XN022884; Wed, 6 Mar 2019 09:55:52 +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 2qyhkn6rcx-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 06 Mar 2019 09:55:52 +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 4213D34; Wed, 6 Mar 2019 08:55:51 +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 0FDAA23FE; Wed, 6 Mar 2019 08:55:51 +0000 (GMT) Received: from localhost (10.75.127.44) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 6 Mar 2019 09:55:50 +0100 From: Fabrice Gasnier To: CC: , , , , , , , , , , , Subject: [PATCH 5/8] iio: adc: stm32-dfsdm: enable hw consumer Date: Wed, 6 Mar 2019 09:55:21 +0100 Message-ID: <1551862524-25098-6-git-send-email-fabrice.gasnier@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551862524-25098-1-git-send-email-fabrice.gasnier@st.com> References: <1551862524-25098-1-git-send-email-fabrice.gasnier@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.44] 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-06_05:,, 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