From patchwork Thu Jul 27 14:59:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier MOYSAN X-Patchwork-Id: 12702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1179062vqo; Thu, 27 Jul 2023 08:27:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlG+dw+i7qO4Q8p0ah82NyzjGik8E83XnWFn67aB2C4LbD/UMcd8wpJd5Kw4Filo/KBFHl4p X-Received: by 2002:a05:6512:e8f:b0:4f8:5d0f:c779 with SMTP id bi15-20020a0565120e8f00b004f85d0fc779mr2166415lfb.40.1690471654046; Thu, 27 Jul 2023 08:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690471654; cv=none; d=google.com; s=arc-20160816; b=Ro1R9tD+ziJV+YP3rJZUt5Un7X4J6IzUgKDxAMm4imaUw2zAYQ+ZAGobly/TLZ0ojH 4TgNZDarNaVKSdBL4qKla/OxNpsSGekUfQKz9XETcAHu2McKV845dQOh9LGub2E5bvQV QBh+KeD3NPzRcvv5W6Ve4K8FRo6uRQJYhd6TuBVzlwxqTVQ7fDn++66FeolE7bnfj+Jx hY6WeANtdA2ZuB4TSxCtkGtI1dDDvUffn/Y2HeZawSBFjnUNvXshnDDL1ZN10wCH+xlW kjQeW/zsnYSKFj5x2nmi7EHeWKhIZZcEMuLRDRaRppViEBRRj5RH5IaRv1akz5cS9E/O zgxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=doC1Pd1d3NibZb37WWHiE70DKjD6XTr1B8pDdUXXdeU=; fh=buK60UNhofE0AifNK/e0rZlyhHSN+Fo11AblTiLupic=; b=PVOTmsC1WjTXZw+O8x8a2/jDKxQPsHLjFAQe/ivMlcuVEnd0gNWJhAF6KWudYwUhkc iuulzyo3mXXO1qVuNPphtgUmF2iqhuXu7pDsaS1nQA/NXwP9CnE89YuQuzSRDMnAHMYm UPiPkp7kwtx3eL2NBdsSnGAx3V//aHKTkF5j86s2kj3qqDqsUAA3JvJfugbL8z87yplP i844ky17IJ4ogRLCFpn0f2I/ZX+Xnw3p8X7JmilM+qDtR9mW6dkOwFHZV2N4DLyYPsFS oqTuo6x6wKdnOLne9N/RgB+VscvEwSkuJRKJf0WRRmSTJ955Wk2juUXYT7LJ6Flb2whU oHdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=kXoqR2HH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020aa7d293000000b0051e15629c02si1014878edq.564.2023.07.27.08.26.59; Thu, 27 Jul 2023 08:27:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=kXoqR2HH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233957AbjG0PAe (ORCPT + 99 others); Thu, 27 Jul 2023 11:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233918AbjG0PA2 (ORCPT ); Thu, 27 Jul 2023 11:00:28 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD4F430DF; Thu, 27 Jul 2023 08:00:22 -0700 (PDT) Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36RAH1wh027816; Thu, 27 Jul 2023 16:59:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=doC1Pd1d3NibZb37WWHiE70DKjD6XTr1B8pDdUXXdeU=; b=kXoqR2HH0CWHQ1GPMt9yevGGyieem0U7ABUHEI8AmP2jQ74X6lp+4e/m9W1c3cfgJAlG I9c66gZAgkGwIQpL9H1UMF6EvN2OQyzcIKohIHp5uPysjh9skOJA39QRfRDtdPNjiJ86 35aaX6kA73vd6cJ3jOBIMVozJ42aY33abrMRiPWyrxkc+HKv7Hz1VyMxUf9aAo7Ofssm x8zFgTbacmiCB70yHXShcna0D9XLE3G1WcNJEQX9vOVqOvUoR5pMZmlTkhWWUHxMqmmh 2q7paXg/5Tdm9VbdmYqn7lIrdtqf1wdL0hiRKK2E3uNbGyWhhyjFDCDqpyMRbN+5i0WF 1g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3s3kn2b15h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 16:59:46 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D66C710002A; Thu, 27 Jul 2023 16:59:44 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 787F2209721; Thu, 27 Jul 2023 16:59:44 +0200 (CEST) Received: from localhost (10.201.20.178) 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.21; Thu, 27 Jul 2023 16:59: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 , Frank Rowand , Liam Girdwood , Mark Brown , Fabrice Gasnier CC: , , , , , Subject: [RFC v2 00/11] iio: add iio backend device type Date: Thu, 27 Jul 2023 16:59:26 +0200 Message-ID: <20230727145939.1157607-1-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.201.20.178] 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.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_07,2023-07-26_01,2023-05-22_02 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772587621301351333 X-GMAIL-MSGID: 1772588004986456220 This v2 is an addon to initial RFC: https://lore.kernel.org/lkml/20230623140944.2613002-1-olivier.moysan@foss.st.com/ Despite the "IIO backend" naming has to be changed (as pointed out by Jonathan previously), it has been kept here, for time being. The appropriated naming still has to be discussed later on. In the previous RFC the "IIO backend" concept was proposed through a set of template APIs. This v2 implements a functionnal exemple based on STM32 DFSDM, to bring scaling support to this peripheral. Olivier Moysan (11): iio: introduce iio backend device of: property: add device link support for io-backends dt-bindings: iio: stm32-dfsdm-adc: add scaling support dt-bindings: iio: adc: add scaling support to sd modulator iio: adc: stm32-dfsdm: manage dfsdm as a channel provider iio: adc: stm32-dfsdm: adopt generic channel bindings iio: adc: stm32-dfsdm: add scaling support to dfsdm iio: adc: sd modulator: add scale and offset support ARM: dts: stm32: adopt new dfsdm bindings on stm32mp151 ARM: dts: stm32: add dfsdm pins muxing on stm32mp15 ARM: dts: stm32: add dfsdm iio support on stm32mp157c-ev .../iio/adc/sigma-delta-modulator.yaml | 9 +- .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml | 189 ++++++------------ arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | 39 ++++ arch/arm/boot/dts/st/stm32mp151.dtsi | 18 +- arch/arm/boot/dts/st/stm32mp157c-ev1.dts | 68 +++++++ drivers/iio/Makefile | 1 + drivers/iio/adc/sd_adc_modulator.c | 106 ++++++++-- drivers/iio/adc/stm32-dfsdm-adc.c | 187 +++++++++++------ drivers/iio/industrialio-backend.c | 107 ++++++++++ drivers/of/property.c | 2 + include/linux/iio/backend.h | 56 ++++++ 11 files changed, 561 insertions(+), 221 deletions(-) create mode 100644 drivers/iio/industrialio-backend.c create mode 100644 include/linux/iio/backend.h