From patchwork Thu Jul 27 15:03:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier MOYSAN X-Patchwork-Id: 12701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1175709vqo; Thu, 27 Jul 2023 08:21:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlH0SoApeISgxOkycPBFJ/4y/a7Qfvklk99OR+LlZp5L464X7ZzTOBbM2oQqa4YsaBGMl8XD X-Received: by 2002:a17:90b:1804:b0:268:4807:eab9 with SMTP id lw4-20020a17090b180400b002684807eab9mr4352709pjb.16.1690471288296; Thu, 27 Jul 2023 08:21:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690471288; cv=none; d=google.com; s=arc-20160816; b=YMSWDgnxlUPj7ntfm9zjZLxaDVCzAE8Rj4xj24q1XEITdRZ3GTxuNEn4KlW/DtOpOi C9AWHXz4Qx19WMH8nRULEhu9dOpMVx8cfLqmMFajJX/kdICvRTz0HNCAjdnQT4ZMTaeT GSkJER7R3pH+enuRbGajntocIR2I0YFo07yH3CAZpbNWpfXJLVMH3FP6HjMO3RYcrbC9 /gmFjBmN+gpiIigsU5M+LNXgPPOucIVaoDvpUkZZjMi8g3iK3d1qWGpMKuNQapesdEnz iakp/LLUv4upbrPXnAT+aLBA2dv8Ee8yHtUW35VfM5wTyoovWm+LLBuo1r6dB/xpRkgP VGdA== 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=ZgRtArTmYv8KeIh8tEQlPQzOgCzsV5G+v9o8NBs4pLivu+Yp8tKICpO3NNFsyPkxsL em5lYe2SjIg/UpY6SyYQEbotK4sNOJ/xL4AJ2SpKAPjYxtjA35NOKr7EqcizzzBJb3K2 LUj6vocompPJFNyr42PT1PwacRAofIn7hlj0ijKTj/2jSt4nQWtixqmWFAP1viRg8iVx KDS3YJr9Y2FHUPwYNtPCbl3iNKmQ4ZgHYQvddH7lDP5lSOOyKPpb+gL33uy5Ql5nm7tT 1tA4WBw7OKrhJiMlgF7Fzq2R7Vw61mnI7p0cnyuXd7VJbxNFFP9hhD0L2WoAVB702e2J sQ5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=WKh8WR22; 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 h12-20020a17090adb8c00b0025ea4dd9071si1504283pjv.61.2023.07.27.08.21.13; Thu, 27 Jul 2023 08:21:28 -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=WKh8WR22; 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 S229526AbjG0PE2 (ORCPT + 99 others); Thu, 27 Jul 2023 11:04:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234256AbjG0PE0 (ORCPT ); Thu, 27 Jul 2023 11:04:26 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDF8CF2; Thu, 27 Jul 2023 08:04:23 -0700 (PDT) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36RBD8l4020221; Thu, 27 Jul 2023 17:03:35 +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=WKh8WR22AxBJ/QxFWaS3op28d0rl7a8Nyuf6roe+2yyfevhAi98xg0CqHDltNkrDgyCQ cNGzI37Wav5oon8GfmjPvsK5pvTKyvP5Li5Saxd7N15R8t87i/2RCDrx3Yoqj/haszej HsgcbTr9VqAs50j6UB6X28DAq7G5/Mx6ah0v/eg4zZUVfyeLLhX2MHCmJgLSDWST6NIB r9bRDSvd10mF/j4yGAj88HdwyJ54sPzWV5wF+J/hMKLnx0od6XRv09VPyNNSDi8LKtla xQ6DWpi3LzqPNU++36daT5H/8/mF2t15BFr7jtJWvhBOotJ202ikt8n3HS0WS3xpGXy4 8w== 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 3s3qgy97v8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 17:03:35 +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 4313010002A; Thu, 27 Jul 2023 17:03:35 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3859B209BA1; Thu, 27 Jul 2023 17:03:35 +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 17:03:34 +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 17:03:11 +0200 Message-ID: <20230727150324.1157933-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: 1772587621301351333 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