From patchwork Tue Jul 30 08:46:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Moysan X-Patchwork-Id: 13747068 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 8681AC3DA49 for ; Tue, 30 Jul 2024 08:49:38 +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=EiPoUOUSjYhFBaJhI0Ab50w3gl5kD8XTqym4TetSUeU=; b=qLb7KtN0VYOLrCmFHExl9g/MMG bkezbM1u5tRIEXag0lq2hc8aSVTr2wvqQ2VOzLJXnZfK3XVix4xVsIRx53hLVp3fv9T8dntWnJcr9 Hnh8oXZEEeEoJvbROhA01gNtP7y9J3npS7IQDaaaa7YBBXrTyJ1Gpdjf9ghLG82xAg3Tmvb6PKoIG kb0Z/VGnunjoDnAnrVZrbQ75VQRLprEBAxTwt/bBMb8OEtw5J1vdLQjLAwg6aMFcjYXd2+7p85CPs Vd0q+wAZS0DIwJK8bovF4uc06HVNrcndLS0xU/Q5/P6zply+zigAynhiAsEAJWu4cWm2tfp0oTXVi la4epdRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYiXw-0000000EN0r-1lkd; Tue, 30 Jul 2024 08:49:28 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYiX5-0000000EMiP-0GXQ for linux-arm-kernel@lists.infradead.org; Tue, 30 Jul 2024 08:48:37 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46U7FGQ9015481; Tue, 30 Jul 2024 10:48:18 +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=EiPoUOUSjYhFBaJhI0Ab50 w3gl5kD8XTqym4TetSUeU=; b=sJ/74LV7SEcl74BnY7JA6cH4323/T3m6zTyH6O WaFd6TwOmN4D8AAg8obZyyJx7jsghWrqK98HZY7hS29w5S4810zvXaBnUIwkbh6Q Zl9o9mkNXXad1o9Gi2VTcD6RhXP2g4m4KTfLBDEOZyFCNFfxXvBzRMDv5fxus/F1 CXgyvutyIj7kL0JMyWl6lPQdv7sFtLCn/n8qjpKAGVK1LFC1g6cy+Gkv7EmN2L1x Et9Ahn2zUPMxsLpuTwDOGEG2wzePPh97J+TnPBuPuv0ciwwSGL5cgFG+syXzBZhu v0KDdhiELZIr0YE8QQBi93xvibAmW8ua3PiLBFcCUgn91lMA== 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 40mr7wus4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jul 2024 10:48:18 +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 C971540048; Tue, 30 Jul 2024 10:48:06 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id BD14F21ED50; Tue, 30 Jul 2024 10:47:14 +0200 (CEST) Received: from localhost (10.252.3.32) 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.37; Tue, 30 Jul 2024 10:47:14 +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 CC: , , , , , Subject: [PATCH v6 0/9] iio: adc: dfsdm: add scaling support Date: Tue, 30 Jul 2024 10:46:30 +0200 Message-ID: <20240730084640.1307938-1-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.252.3.32] X-ClientProxiedBy: EQNCAS1NODE3.st.com (10.75.129.80) 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-07-30_09,2024-07-26_01,2024-05-17_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240730_014835_453760_9D2F790D X-CRM114-Status: GOOD ( 17.00 ) 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: - iio_backend_read_raw: This API is intented to retrieve channel attributes from the backend. It is based on IIO framework read_raw API. - iio_backend_read_scale / iio_backend_read_offset Dedicated APIs to read scale and offset channel values. - iio_backend_disable / iio_backend_enable: backend enable/disable to be used for PM management - devm_iio_backend_fwnode_get Intended for parsing DT subnodes to allow generic channel binding support, as generic channel DT nodes are not populated as devices. [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 Changes in v2: - Update enable/disable backend API - Rename devm_iio_backend_subnode_get(), as devm_iio_backend_fwnode_get() - Update iio_backend_read_raw() prototype to fully match IIO framework read_raw callback prototype. - Change st,adc-channel-type property name and type in DFSDM binding - Remove sd-backend and rename ads1201 compatibles in SD binding Changes in v3: - Add iio_backend_read_scale and iio_backend_read_offset - Remove sd-backend compatible. Adapt existing sd modulator driver and binding to support backend topology. - Misc corrections in DFSDM binding & minor changes in DFSDM driver Changes in v4: - Remove allOf and rework examples in SD modulator binding - Wrap lines to 80 characters in IIO code Changes in v5: - Move iio_backend_read_scale and iio_backend_read_offset to inline and update prototype - Fix channel number & remove legacy binding example in DFSDM binding - Rearrange DFSDM patches to fix build issue in serie - Split SD modulator binding patch. Move reference voltage change in a separate patch Changes in v6: - Minor cleanup in DFSDM binding - Fix vref-supply dependency condition in SD modulator binding Olivier Moysan (9): iio: add read scale and offset services 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 backend support to sd modulator dt-bindings: iio: add vref support to sd modulator iio: adc: stm32-dfsdm: adopt generic channels bindings iio: add iio backend support to sd modulator iio: adc: stm32-dfsdm: add scaling support to dfsdm .../iio/adc/sigma-delta-modulator.yaml | 25 +- .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml | 122 +++++++- drivers/iio/adc/Kconfig | 2 + drivers/iio/adc/sd_adc_modulator.c | 92 +++++- drivers/iio/adc/stm32-dfsdm-adc.c | 293 +++++++++++++++--- drivers/iio/industrialio-backend.c | 101 +++++- include/linux/iio/backend.h | 29 +- 7 files changed, 592 insertions(+), 72 deletions(-) base-commit: bf829a98bc4bb9076a2fd70f4a69ea7e281863fa