From patchwork Tue Jun 18 16:08:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier MOYSAN X-Patchwork-Id: 13702662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54869C27C4F for ; Tue, 18 Jun 2024 16:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=z5NFMMQZPHGp3gWcmS7/W4PryNOHDlUiWMV40ZjgePg=; b=eek06AtxcjSP4BP7jjpU9w1zEp BnSGedidYStjx9MJOyXkb4Irc4ZPrGpJl4I1AaqmIJk6Q6JQmfD8KiwWnN0huKJ30olWU16Ps2rKV FGyAEkc0gxzFxffqwmdfsTSIeeEXdB2gokrRDpgZuPlKSh16xpTFiASIsjwUrdDMIgJzisPys2akR Sx6t1GWcKhzChRbIYv+ipDV7ibZ2FhwXa5g/GO37cbzroKctAwima+FsLdTzdOLnOgU7YS/Xeh5+B PNYIcnvoogjvarcb70zCVkBnqNprbcw6cgK1io+i4Cbe48MPRKnzIOYcSi6R1CgzKadM623ckvcWY 7s18bfZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJbQv-0000000FmWC-0YPf; Tue, 18 Jun 2024 16:11:45 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJbQ2-0000000Fltv-3iF4 for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2024 16:10:58 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45IG79xx022142; Tue, 18 Jun 2024 18:10:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=selector1; bh=z5NFMMQZPHGp3gWcmS7/W4 PryNOHDlUiWMV40ZjgePg=; b=FpKjfsjYe0UVIP+QQtTdvaQXnWCVXGDk+0nyYT VMrq1aGxqwh/BYEyjx3zPbzo4w55eDVXrVlD/TeEnDZTjYvKJWZigq8PWceQ9fxq RMvKyGzBH7TngcD/ZVRei/LQJsyCqg8Ry26HFoLH6/LUSX9PpW2+pA4mo8KN+IPZ +9kHhGS1oBmpg5xq3ddYoBvU83HAfqMnpGBYn1LgPHy+Jda/4E2ljDNmiYcbqIcV Y1XPxuGv01WZC5jFnjZKcK8iDW6ckcyNRNFAG7fQPDKNTBb7lPbaSRwKcq0chGsK A9ZX/ikCiuhqnjRyik2IA+OmiIQj+WzvQY55sMVdCbd416NA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3ys1ucv1py-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 18:10:36 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 5C25040044; Tue, 18 Jun 2024 18:10:26 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 612BA21D3C9; Tue, 18 Jun 2024 18:09:22 +0200 (CEST) Received: from localhost (10.252.27.64) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 18 Jun 2024 18:09:22 +0200 From: Olivier Moysan To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Olivier Moysan , Arnaud Pouliquen , Maxime Coquelin , Alexandre Torgue , Nuno Sa , Liam Girdwood , Mark Brown , Fabrice Gasnier CC: , , , , , Subject: [PATCH 0/8] iio: adc: dfsdm: add scaling support Date: Tue, 18 Jun 2024 18:08:26 +0200 Message-ID: <20240618160836.945242-1-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.252.27.64] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-18_02,2024-06-17_01,2024-05-17_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240618_091051_569031_9FFAFD1B X-CRM114-Status: GOOD ( 15.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The aim of this serie is to add scaling support to STM32 DFSDM peripheral in the analog context. The DFSDM currently operates as a consumer of IIO channels provided by a generic SD modulator. As previously discussed in RFC [1], this topology is not suitable for implementing scaling. This series brings the integration of the DFSDM driver with the new IIO backend framework [2], enabling the DFSDM IIO device to offer scaling feature based on reference voltage data obtained from the IIO SD modulator backend. This generic SD modulator backend takes the place of the former SD modulator, used with legacy implementation. The DFSDM driver has been updated to adopt the generic ADC channel binding [3]. The reasons for this include: - Reducing the use of proprietary properties - Simplifying the coexistence of legacy and new backend bindings - Prepare the support of the MDF peripheral on STM32MP25 SoC Backward compatibility is maintained through legacy support. This series extends the backend framework with the following APIs (which may need further refinement): - read_raw: This API is intented to retrieve the voltage information from the backend. It is based on IIO read_raw API, but maybe we need a more specialized API here. - iio_backend_disable / iio_backend_enable: backend enable/disable to be used for PM management - devm_iio_backend_subnode_get Intended for parsing DT subnodes to allow generic channel binding support, as generic channel DT nodes are not populated as devices. Ideally, a single API would be better, but I could not identify a suitable alternative that doesn't affect the existing API (devm_iio_backend_get). [1]: https://lore.kernel.org/lkml/20200204101008.11411-1-olivier.moysan@st.com/ [2]: https://lore.kernel.org/all/20240206-iio-backend-v9-0-df66d159c000@analog.com/ [3]: devicetree/bindings/iio/adc/adc.yaml Olivier Moysan (8): iio: add read raw service to iio backend framework iio: add enable and disable services to iio backend framework iio: add child nodes support in iio backend framework dt-bindings: iio: dfsdm: move to backend framework dt-bindings: iio: add sigma delta modulator backend iio: adc: stm32-dfsdm: adopt generic channels bindings iio: add sd modulator generic iio backend iio: adc: stm32-dfsdm: add scaling support to dfsdm .../iio/adc/sd-modulator-backend.yaml | 43 +++ .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml | 158 ++++++++- drivers/iio/adc/Kconfig | 11 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/sd_adc_backend.c | 110 +++++++ drivers/iio/adc/stm32-dfsdm-adc.c | 302 +++++++++++++++--- drivers/iio/industrialio-backend.c | 90 +++++- include/linux/iio/backend.h | 7 + 8 files changed, 664 insertions(+), 58 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/sd-modulator-backend.yaml create mode 100644 drivers/iio/adc/sd_adc_backend.c base-commit: 7db8a847f98caae68c70bdab9ba92d1af38e5656