From patchwork Thu Jul 4 15:53:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Moysan X-Patchwork-Id: 13723983 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 A3D88C30653 for ; Thu, 4 Jul 2024 15:57:56 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0B95414E4; Thu, 4 Jul 2024 17:57:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0B95414E4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1720108669; bh=sBoMD9MZcO/eEa6Y0GofDYQ2HWRU2LzOiLiKm9wzPJ4=; h=From:To:CC:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=bpyneh/h5HzZa4NzWlvPzx9yq36f+hxWnyw0iXk7wML8x16BqHceQ5q9cx4MUTsa5 sH0INYMkgk0feAPVMS1oMk3s52oeZFJz9jWmUbSY68nkHfx/b3FXsnDZfkYnQxx/i+ UVo5FjlJbIsBBYwl047jc10vn42TmuQlA5gCF93A= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C4F18F8025E; Thu, 4 Jul 2024 17:57:17 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 72E76F805B4; Thu, 4 Jul 2024 17:57:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A6D52F8025E; Thu, 4 Jul 2024 17:57:10 +0200 (CEST) Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3864AF800F8 for ; Thu, 4 Jul 2024 17:56:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3864AF800F8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector1 header.b=XGoZaxhk Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 464BNjGm007786; Thu, 4 Jul 2024 17:56:57 +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=ibw80CV7lP34NHZuwWXqpZ j47HpMI7ZCa8Fr+wu/PcA=; b=XGoZaxhkEsY8QHgtBzEDNtOUTlCYOK7HfWg92N b7/VdYCIEr3Hx7erdPZBvzasz7Sa+RiRFl+q6PovlDdCtNWAqlcr5W+s8mznBj7R Hj4yjpeFxKReTQq5dEiFAKx4LQIr2IAQtifeWKC7miJCy/QMHOG42clDel0bAlpU T5UecT3hFHuIGYudiO+b/x48mIH63IBCOkprT0abOw5aJ/Vw+ET2fxlSdAM+EHpC B1j76efepq2AgHfOe2tQBZvRQuXOeUVxdh4aYHUSi9EA736o8ce5dmUN7RnOcspS LsID4ULKluepH/AWaWNQvCgYr51rShz/O3+WjmdY4x1Cy1gA== 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 402w7jbg21-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 17:56:57 +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 3ECA140044; Thu, 4 Jul 2024 17:56:47 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 63DB82291CC; Thu, 4 Jul 2024 17:55:44 +0200 (CEST) Received: from localhost (10.48.86.132) 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; Thu, 4 Jul 2024 17:55:44 +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 v4 0/8] iio: adc: dfsdm: add scaling support Date: Thu, 4 Jul 2024 17:53:28 +0200 Message-ID: <20240704155338.2387858-1-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.48.86.132] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) 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-04_10,2024-07-03_01,2024-05-17_01 Message-ID-Hash: LK4WWMUGOJBUFW3MQYD3E3W7P4OY25UN X-Message-ID-Hash: LK4WWMUGOJBUFW3MQYD3E3W7P4OY25UN X-MailFrom: prvs=7915accfb9=olivier.moysan@foss.st.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 Olivier Moysan (8): 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 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 | 23 +- .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml | 153 ++++++++- drivers/iio/adc/Kconfig | 2 + drivers/iio/adc/sd_adc_modulator.c | 92 +++++- drivers/iio/adc/stm32-dfsdm-adc.c | 298 +++++++++++++++--- drivers/iio/industrialio-backend.c | 116 ++++++- include/linux/iio/backend.h | 14 +- 7 files changed, 633 insertions(+), 65 deletions(-) base-commit: 529d2e1900642eba6df28307e26e19793e227546