From patchwork Thu Nov 28 12:55:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alisa-Dariana Roman X-Patchwork-Id: 13888047 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 479ED1A2622; Thu, 28 Nov 2024 12:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732798713; cv=none; b=VxXn6wnoY/FEK57RmMJyc2G5Tvh6pH2CYNkNEhNSAHnlJaek74yHVAmdOCqV0P8L1nJKZatBuc8smMPn98Wybx9q84lSRCG6C4oY3Yxf/G8oSBui/+8gC6oAsZLRjJB6/LyHQQ+dQksfR88scX/co87fkPe4AYX/FLH6m3EKzNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732798713; c=relaxed/simple; bh=6WO/KoksPPfNy/Nque/H3GqjWusPWnebfA4rwnNUK3Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aluho/ReZXyhBY8gkxcetwkKP8mRPHgtxqMhHZMqmbkqoVxmllATuBq+1erEO15eOVrZTOSHe9hJ0HzqgYxFeR3IRlez1hgDgavnlMPnTV2F3dEE8LZ7AbTwjPVvDt0MHoUeK1wxygsTZc4SsUXpFo4KUiDpFckkh+sMd8WPiFY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RGNmvPWr; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RGNmvPWr" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-382423f4082so601307f8f.3; Thu, 28 Nov 2024 04:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732798711; x=1733403511; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p9VRPpihSbruXIfzlqTllph5cE02i7sBNzb47RuvXOE=; b=RGNmvPWrmr8+wratp+TWBvcweuD1GbeRDClATsoI4pj2cPZdBtpR/hvOH2H7r17M+8 J3suoMnHJs6n8daY97by2wIGVKnqFUd60IDGKv2tFYmGBA9++Rzj7+3GdlUJ/smhdfhy 4a9oC2sjbG7RAU47NHY3y+Lf2+tCzuTHdoAHi50Xveh7vRwRbQZR1qyPb5BdxrR5vKw1 fBPBelHQUZep+X9P/jN+TpeTrB2S3/nYn1uuklhT0HN3ES2hRY8Wnhhh2edfVg8SaWTp jTqv+Hui8Q7wy0LbSs67hHu52m3zjeShbgpQhhUre7lvbPEvE8lJ97rBSzLsXk36MKUT Ys0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732798711; x=1733403511; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p9VRPpihSbruXIfzlqTllph5cE02i7sBNzb47RuvXOE=; b=GaYkLiJGIVHALz4DCiPgNOKi45uQXohqbkjxh0DvLjoK4XskHWAv5dJM/0bmdgoIW7 frF+m5LpDYEGeevqTxvts/LXJTIpNq9x0sjDG189BMRFQHSRCR+TFlM28tFTFOhFnJno 0TSzC0TTO/UHKXq3jYhcJ+GzErXODLTHC4PRS5BzH2qTnsdF7Rf445SCmjK9RK0rWfbW 38+529RCx9Ab+1/Jbnr1ur/7z9CE/WQgdK6HTvL0bNKWwo+YMaf11hKPM9008FZ7hYEW azBJ+cIlU3RRLzKXIIOm+zMHkm6JqpaH/mEkh5jEe4JNTpEST3YfYNoRyYtsMj2xYR1j I36A== X-Forwarded-Encrypted: i=1; AJvYcCVZ8aL/VT55Ter3V+EE3f/mvgPS5xbtCGE67habVPJEE8LhG9g9e/u/56ir2DdN9Ph7VYE2BtD2xRb+@vger.kernel.org, AJvYcCVcItk1He0UYGAh6ZGFWRfgJ7EjXg74opBIGw6NRgZViJfBSGZToCqWAaZZnnZSMufU3pnpx2TRcm42NQCO@vger.kernel.org, AJvYcCXIelC9ZuVw2lslmeFFwaE7skD/hfu9IaWFt/P8K0VHx+CLqM6y7j9AbPx6TpCkTIvEd59rCPlF0wCz@vger.kernel.org X-Gm-Message-State: AOJu0YzBxHyE3EOKtIIGihBL8tmh5fHdK0m1rtwmDAJQkHGEYhrzCV7x tPHdjq4pyowrJJWPNbamFSfiN/aw5reUvLl3gRT5wUxWfjUDbr/1k8nQ7PWw X-Gm-Gg: ASbGncs3pOXC8Ac5mV2b2YbeJ0UwF+hPT5qmLaS+JfEfFvNyHszLi3ihBSG3pOoRVO0 XmWxWeGs5H7wp6GBrCO8n9U1xX2qiuZgsQe9yEmHfx7UkP5fFlXBo5oQR020TvyWz+FXhaDkWcc yF8+02hsUdr5OgwkvPQifIdob/sTY++eqH+vLBKlMga52WgMyklbylhi5KWVJF/9x4QA1RtcqYZ Jtelq//4L4KVetcGLctDizeNp2F6rUVRCrH4/wsC7uGT6+EYCne X-Google-Smtp-Source: AGHT+IF/oR+PTz4tovShzWZzj4voHRHDL1lCv3HXzMcxAMQPcv7/yJBk8E30bjkM2sX7ZCAK3t1n7A== X-Received: by 2002:a05:6000:178a:b0:37d:4647:154e with SMTP id ffacd0b85a97d-385c6eb4accmr5814760f8f.9.1732798710404; Thu, 28 Nov 2024 04:58:30 -0800 (PST) Received: from spiri.. ([2a02:2f0e:3506:d600:5f69:ea1c:6c79:3753]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385ccd68d08sm1611853f8f.70.2024.11.28.04.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2024 04:58:30 -0800 (PST) From: Alisa-Dariana Roman X-Google-Original-From: Alisa-Dariana Roman To: Alisa-Dariana Roman , Jonathan Cameron , Michael Hennerich , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH v1 1/3] dt-bindings: iio: adc: ad7192: Add maintainer Date: Thu, 28 Nov 2024 14:55:01 +0200 Message-ID: <20241128125811.11913-2-alisa.roman@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241128125811.11913-1-alisa.roman@analog.com> References: <20241128125811.11913-1-alisa.roman@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add myself as a maintainer for AD7192 devicetree bindings. Signed-off-by: Alisa-Dariana Roman Acked-by: Conor Dooley --- Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml index 66dd1c549bd3..f70caefdace7 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml @@ -9,6 +9,7 @@ title: Analog Devices AD7192 ADC device driver maintainers: - Michael Hennerich + - Alisa-Dariana Roman description: | Bindings for the Analog Devices AD7192 ADC device. Datasheet can be From patchwork Thu Nov 28 12:55:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alisa-Dariana Roman X-Patchwork-Id: 13888048 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 978541A9B59; Thu, 28 Nov 2024 12:58:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732798716; cv=none; b=rchfLgM69A5PBMoZIfNcqCdbpdTS2l1eAGFn7LDIoedGw9mGnvIVdqkxv4zfJtgQ5BY+hZT3AcAp4LQQqVR1BX/wfA5X0xnEgfJtPY9xrIj1CDAS0T6IciI+FI1eME5JAIUtA1HpL14TSYjyinnSpDAOH0PglCj6wiZLCoCnnjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732798716; c=relaxed/simple; bh=y6ARW7jwOnB9s9Q7vQ2VFZdk1e6GcROGNYG+IZP7w1c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hBgkIztHqU1p1ikktowEjPVb3fj2lPLc29r/Kx7VA5Q62dgnXzD6uEMHOB+HxV6t5Vhgt7Oil0bcKQVM3hWC6HPJzQHeAQarl4gum4qo2PGeVkg6p0qtETc/GIu3oA4AjlyU9iaq5+PgVI2nfBTELVEWsxjfmxBLNncLdYdM/Co= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D2Z8AwcB; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D2Z8AwcB" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-37ed3bd6114so543468f8f.2; Thu, 28 Nov 2024 04:58:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732798713; x=1733403513; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=irkHT9QLfhUmX9zXxtTyZkxthUZ9+/+vuANslCRONZM=; b=D2Z8AwcBSszgj7ClBa5frB21A6yy+pO8fKS89rdxtcvWL38qCl1/vD8NHriNuLEHq7 G52ZeShYyIf0yDQ2uLdaffyogo9Ln9K5o5zKxhfWGx9P4itKgOU31THiTZ52658s2ngB gbP5FV/nRupnQ7n/YtFMSpmCzJOlFJsgheefw1MS4JW6mNgbRgmQRDQ0TWXC7INrmJim c9REBA4bm0ojd6mieBqzrO0hPlkAqhymMA4EPeLQCm1lvmfnD0e8LoxJbBhX88+6qjFb be9V6xeZimkZbGzvMN6Xr/2Ai12CpNoA0gEAsLrIsAaxMMcdIpgpzPPTecJo9xzPVWGe w/CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732798713; x=1733403513; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=irkHT9QLfhUmX9zXxtTyZkxthUZ9+/+vuANslCRONZM=; b=VuynAMu8F0O0T3yRcCym6ZiHoeRyewLhc/itq7ejH5EYoC3BQUpmZKMiw7eUjx2CBV ikJib28wx8SqfjqlRoMq5r/pfCm5pSe/QigjqTrSueW3htWmu9H5bUMQwSk/T9tMolzP nciPSbt4+NUf4rc3cLBpl8QSFGFNdkABee3HN1guH0cxAv238G6TU/enslKHXL3zC0YK mXZJS9IACMK6dFM0ElFSqkBlWG+871TCNNzGf9C2eAccszB3k7v1vC4Ciie1PUuNdAJd yKsJqBcxJzHVKoJK2gnBQlkqN0lJOkkO5EaNeLDIOMaheaUy9zRFslQhrn4Yx+gE9noZ vXgA== X-Forwarded-Encrypted: i=1; AJvYcCUO64MkVmxs2gx3TwTWN3PnwUI9Q8zoaAuKdunB/PThbStTN3YzMl9GOw2cX//2WlE0e6mXsHPUcAoK@vger.kernel.org, AJvYcCVALzIxB98Tt26Ec+XbOKb9gYVQ73Rmgqr0Snb1HkzHuL4cPKCKkGcW1VmVVYZvcLcUArdykLYLbyTb07kB@vger.kernel.org, AJvYcCXroC+ZatW6GiBV9jk0IamW+hZt/5AkP7HTPa3m4aKeVZmx1qs5jZf/BXrMMCUTpOniRI4dQ6sLwKb3@vger.kernel.org X-Gm-Message-State: AOJu0YwYrQjl1NxqH1nwaup2cEN4CJHnYJXCnrcdu3amP6kGk55XtrrT N+Y+XogUGIG/eQOHjmvwqxnb//48mRoP/LTu0MR0/86cqrJuovJmi9mrB1LT X-Gm-Gg: ASbGncuxRDCX8NU1WTgaaIKaJ4/yh1dHNnoyjb5SxzEBtreq0vFfcUr2TF8MsvFFAzZ tib9I8TWvJuw9ROOKEetsP7U2aaEUvWxa5uJldL06uQ2DKp2c6Ksse/rxxDXMAPCXzkhjmJUQyd GGIiRrwT0kwXQcfjyjEgRVUt0jCW+ygo3ovCdGHIYUSgpcBzkOExhZA0C+ABon297KlhXpg2cFZ VopsFTJ+jljHYN/4FcaRO7xGXSE/WjAXKxkqVZjVSCEdlXqUxDc X-Google-Smtp-Source: AGHT+IHvoYRXmIawy7MgbZGpQ7dgNR35LsP2fDwjO9gG1TlMIkq0Cn92wmNeStATm3Ygwii7GD6s9A== X-Received: by 2002:a05:6000:2d12:b0:37c:d244:bdb1 with SMTP id ffacd0b85a97d-385c6ebae04mr4724248f8f.26.1732798712792; Thu, 28 Nov 2024 04:58:32 -0800 (PST) Received: from spiri.. ([2a02:2f0e:3506:d600:5f69:ea1c:6c79:3753]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385ccd68d08sm1611853f8f.70.2024.11.28.04.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2024 04:58:32 -0800 (PST) From: Alisa-Dariana Roman X-Google-Original-From: Alisa-Dariana Roman To: Alisa-Dariana Roman , Jonathan Cameron , Michael Hennerich , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH v1 2/3] dt-bindings: iio: adc: ad7192: Add sync gpio Date: Thu, 28 Nov 2024 14:55:02 +0200 Message-ID: <20241128125811.11913-3-alisa.roman@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241128125811.11913-1-alisa.roman@analog.com> References: <20241128125811.11913-1-alisa.roman@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add support for the SYNC pin GPIO specification in the devicetree bindings. This pin allows synchronization of digital filters and analog modulators when using multiple devices. Update the examples to demonstrate the usage of the new property. Also update the interrupt type in the examples to use the proper IRQ_TYPE_EDGE_FALLING macro instead of the raw value. Signed-off-by: Alisa-Dariana Roman Acked-by: Conor Dooley --- .../bindings/iio/adc/adi,ad7192.yaml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml index f70caefdace7..1cd0fd13bc42 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml @@ -59,6 +59,17 @@ properties: interrupts: maxItems: 1 + sync-gpios: + description: | + Optional GPIO spec for the SYNC pin. The SYNC pin allows synchronization + of the digital filters and analog modulators when using multiple AD7192 + devices. When SYNC is pulled low, it resets the digital filter nodes, + filter control logic, calibration control logic, and holds the analog + modulator in reset state. Only specify this property if you need to + actively control SYNC for multi-device synchronization, otherwise it + defaults to HIGH. + maxItems: 1 + aincom-supply: description: | AINCOM voltage supply. Analog inputs AINx are referenced to this input @@ -182,6 +193,8 @@ unevaluatedProperties: false examples: - | + #include + #include spi { #address-cells = <1>; #size-cells = <0>; @@ -194,8 +207,9 @@ examples: spi-cpha; clocks = <&ad7192_mclk>; clock-names = "mclk"; - interrupts = <25 0x2>; + interrupts = <25 IRQ_TYPE_EDGE_FALLING>; interrupt-parent = <&gpio>; + sync-gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; aincom-supply = <&aincom>; dvdd-supply = <&dvdd>; avdd-supply = <&avdd>; @@ -208,6 +222,7 @@ examples: }; }; - | + #include spi { #address-cells = <1>; #size-cells = <0>; @@ -223,7 +238,7 @@ examples: spi-cpol; spi-cpha; #clock-cells = <0>; - interrupts = <25 0x2>; + interrupts = <25 IRQ_TYPE_EDGE_FALLING>; interrupt-parent = <&gpio>; aincom-supply = <&aincom>; dvdd-supply = <&dvdd>; From patchwork Thu Nov 28 12:55:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alisa-Dariana Roman X-Patchwork-Id: 13888049 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E3561AA1E0; Thu, 28 Nov 2024 12:58:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732798718; cv=none; b=SZHeM/7JKVEzkDj/BmfRlpDtaT5T1JYA3P+xdv30v8CjXTjyRCXQjFHVVIuZDnVMzXaeTrdiGzouNjbSqCSQycD0Ho6G+aSdhjVDMTXGNKmDMN81mJSV3Ra0nepQ2hjdrSSHgzyZwjqE1X4Le7oWQ4v+3bRUrvgsI6ofSa1n/Kw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732798718; c=relaxed/simple; bh=OVRm53299Oh2RBtSDM/Cw/Sa4S8tUwXVvN9qZ8E+CJ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FSBtoFNO4fr8aftk77g9HKmip3HskhUj6I/AW5vrfbyw03PQPyXRoYqjGXbU8P55QDcFmpQwSsaHGwHHC3SkJ50UU/eS4tP4m1bzWBirQw46erciNJS90x+QTclOzvEwKRoeVNN3zPsgznXv7jjXgaI7FPR7cw2ynmHu/6CEshw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dGI7+5oO; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dGI7+5oO" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-38231e9d518so566440f8f.0; Thu, 28 Nov 2024 04:58:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732798715; x=1733403515; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nXGhOrQavhFBrDDrZb+1U4b8mAecq/hLNguuuXdg22g=; b=dGI7+5oONOulya2RnwNBBM7KCBya8B7LHgJgVbIlLtTfXBJ+FBK6bH1ZYs3n4T/k7e N4F35GF2v2QY2IJykuYsQ2VZDyBH9MwIxE2sMZc20Aw7BrXMpfg0pMraJmvhwNpGVdz6 m3D9qmW+Lus91ku0xl64sDV6lcKuFZBUvOsrNhuec/AsT5dMHFUDdhXPAEhlR5aiMSx0 cyr1oeuY4VHrj8xdwxWgGIEMQYHzi73QZyL+w/u9RhEqY7EiuogydkmmekiH1B7yM+kr cLs+ZBL4suZItJ9RbAoeRaU4HBWMLeQAC0qp9VP9P9IK1dJAGBXEip0U8X7Yj51VStzF CIeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732798715; x=1733403515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nXGhOrQavhFBrDDrZb+1U4b8mAecq/hLNguuuXdg22g=; b=gXHYhYf5/WyI+i0mesClV07U1XrRSwCcwT7ByM3vqUx686I+yQVaewCxATbCFmPbp3 bvO0RRCvUQcmy1aGIeuTax9TPMqVw5xd+o1RG3xN8oSmSymNXG6VekXlKsRwZF1CIFwu H8CPoVLGCJCN3tzaf9InRTxNA50dCUPX2JYLVh+p/kL2nJvSfPFcvM6pCAN+suV5idjU oHUSRFEmKuo7/q9CpcHA64SrdjcCZemH8nlWZqZtAMQ3NRWWJSU5A3DrPd4OMwVxKhOn 4ioPzaEbizB/xU8gnIduk0DOe+Dkb57bqq45MfF34wN1Y808GfLCeiGFdwW17KGSEP+b y1pg== X-Forwarded-Encrypted: i=1; AJvYcCU3JkVW2EexSdkgN9gIArX9/R2c3MLxZ7Cs+4zPMvc6LBxMKNFUMCBXRNzwumqebqeZvqGRyuT7MICm@vger.kernel.org, AJvYcCXJTtnAWDcpaVIc1Pb3VgV4P5h5WcytAWpxF+AUijN2i5pQGJTYEAwhxteuv0bCb8dmKuu5ke6WA/KtMfeX@vger.kernel.org, AJvYcCXNPfNhtl/t32ZudErbdoBNB3J8KnJxXDASEQlEjkd2jPfNnYvOcAi9qD95/8SsaQ/9xpsImf9KZv1B@vger.kernel.org X-Gm-Message-State: AOJu0YyOlUgCPMgTKcYWhNFUmM9ZFBAJVtLP9p6kB0Gcf9FIBfuoCpvw ShHtT11cp1J3OdbekY+Q+BjkzIvmg7NnXSZzGOj5W3faaCIbpQyG X-Gm-Gg: ASbGncvFC7TrPooXeGfX8w1/UTqUJn4i0wijnWMNGu9tnuDbpO42oE1+D8l4dSTvCVA 8eXT58QURSNuAFMCaFRNKpY2HwEk5fuzggVM5YphOqsFHp8POCr4wcD9sH3V2M1LFQ/xOoy3UfX Trxi8IW6A6cQ4TBJZiw5iEu82xTJwMv6lSrzoEOBcr7gJdBSoLua51xIzU5c3+XSIPj8L611uCD dP5J0e+vGwgx2sPnnRg/0HNVPSjswtRkmwt4Cc2ECWJmOy0UOaF X-Google-Smtp-Source: AGHT+IHp6F0r+EDXhHXXQKMfwVptsCJSH4AhVCDh8ZWKQfM8PMaQRFrFsR7JRmt71/BIYAa2FaWAXg== X-Received: by 2002:a05:6000:1562:b0:382:383e:84e2 with SMTP id ffacd0b85a97d-385c6edb2a4mr6480529f8f.46.1732798714803; Thu, 28 Nov 2024 04:58:34 -0800 (PST) Received: from spiri.. ([2a02:2f0e:3506:d600:5f69:ea1c:6c79:3753]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385ccd68d08sm1611853f8f.70.2024.11.28.04.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2024 04:58:34 -0800 (PST) From: Alisa-Dariana Roman X-Google-Original-From: Alisa-Dariana Roman To: Alisa-Dariana Roman , Jonathan Cameron , Michael Hennerich , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH v1 3/3] iio: adc: ad7192: Add sync gpio Date: Thu, 28 Nov 2024 14:55:03 +0200 Message-ID: <20241128125811.11913-4-alisa.roman@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241128125811.11913-1-alisa.roman@analog.com> References: <20241128125811.11913-1-alisa.roman@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add support for the SYNC pin of AD719x devices. This pin is controlled through a GPIO. The pin allows synchronization of digital filters and analog modulators when using multiple devices. Signed-off-by: Alisa-Dariana Roman --- drivers/iio/adc/ad7192.c | 112 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 955e9eff0099..542db7280e99 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -196,6 +197,7 @@ struct ad7192_chip_info { u8 num_channels; const struct ad_sigma_delta_info *sigma_delta_info; const struct iio_info *info; + const struct iio_info *info_sync; int (*parse_channels)(struct iio_dev *indio_dev); }; @@ -216,6 +218,8 @@ struct ad7192_state { struct mutex lock; /* protect sensor state */ u8 syscalib_mode[8]; + struct gpio_desc *sync_gpio; + struct ad_sigma_delta sd; }; @@ -783,6 +787,36 @@ static void ad7192_update_filter_freq_avail(struct ad7192_state *st) st->filter_freq_avail[3][0] = DIV_ROUND_CLOSEST(fadc * 272, 1024); } +static ssize_t sync_gpio_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct ad7192_state *st = iio_priv(indio_dev); + + return sysfs_emit(buf, "%d\n", gpiod_get_value(st->sync_gpio)); +} + +static ssize_t sync_gpio_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t len) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct ad7192_state *st = iio_priv(indio_dev); + int val; + int ret; + + ret = kstrtoint(buf, 0, &val); + if (ret < 0) + return ret; + + if (st->sync_gpio) + gpiod_set_value(st->sync_gpio, val); + + return len; +} + static IIO_DEVICE_ATTR(bridge_switch_en, 0644, ad7192_show_bridge_switch, ad7192_set, AD7192_REG_GPOCON); @@ -791,25 +825,57 @@ static IIO_DEVICE_ATTR(ac_excitation_en, 0644, ad7192_show_ac_excitation, ad7192_set, AD7192_REG_CONF); +static IIO_DEVICE_ATTR_RW(sync_gpio, 0); + static struct attribute *ad7192_attributes[] = { &iio_dev_attr_bridge_switch_en.dev_attr.attr, NULL }; +static struct attribute *ad7192_attributes_sync[] = { + &iio_dev_attr_bridge_switch_en.dev_attr.attr, + &iio_dev_attr_sync_gpio.dev_attr.attr, + NULL +}; + static const struct attribute_group ad7192_attribute_group = { .attrs = ad7192_attributes, }; +static const struct attribute_group ad7192_attribute_group_sync = { + .attrs = ad7192_attributes_sync, +}; + +static struct attribute *ad7194_attributes_sync[] = { + &iio_dev_attr_sync_gpio.dev_attr.attr, + NULL +}; + +static const struct attribute_group ad7194_attribute_group_sync = { + .attrs = ad7194_attributes_sync, +}; + static struct attribute *ad7195_attributes[] = { &iio_dev_attr_bridge_switch_en.dev_attr.attr, &iio_dev_attr_ac_excitation_en.dev_attr.attr, NULL }; +static struct attribute *ad7195_attributes_sync[] = { + &iio_dev_attr_bridge_switch_en.dev_attr.attr, + &iio_dev_attr_ac_excitation_en.dev_attr.attr, + &iio_dev_attr_sync_gpio.dev_attr.attr, + NULL +}; + static const struct attribute_group ad7195_attribute_group = { .attrs = ad7195_attributes, }; +static const struct attribute_group ad7195_attribute_group_sync = { + .attrs = ad7195_attributes_sync, +}; + static unsigned int ad7192_get_temp_scale(bool unipolar) { return unipolar ? 2815 * 2 : 2815; @@ -1103,6 +1169,16 @@ static const struct iio_info ad7192_info = { .update_scan_mode = ad7192_update_scan_mode, }; +static const struct iio_info ad7192_info_sync = { + .read_raw = ad7192_read_raw, + .write_raw = ad7192_write_raw, + .write_raw_get_fmt = ad7192_write_raw_get_fmt, + .read_avail = ad7192_read_avail, + .attrs = &ad7192_attribute_group_sync, + .validate_trigger = ad_sd_validate_trigger, + .update_scan_mode = ad7192_update_scan_mode, +}; + static const struct iio_info ad7194_info = { .read_raw = ad7192_read_raw, .write_raw = ad7192_write_raw, @@ -1111,6 +1187,15 @@ static const struct iio_info ad7194_info = { .validate_trigger = ad_sd_validate_trigger, }; +static const struct iio_info ad7194_info_sync = { + .read_raw = ad7192_read_raw, + .write_raw = ad7192_write_raw, + .write_raw_get_fmt = ad7192_write_raw_get_fmt, + .read_avail = ad7192_read_avail, + .attrs = &ad7194_attribute_group_sync, + .validate_trigger = ad_sd_validate_trigger, +}; + static const struct iio_info ad7195_info = { .read_raw = ad7192_read_raw, .write_raw = ad7192_write_raw, @@ -1121,6 +1206,16 @@ static const struct iio_info ad7195_info = { .update_scan_mode = ad7192_update_scan_mode, }; +static const struct iio_info ad7195_info_sync = { + .read_raw = ad7192_read_raw, + .write_raw = ad7192_write_raw, + .write_raw_get_fmt = ad7192_write_raw_get_fmt, + .read_avail = ad7192_read_avail, + .attrs = &ad7195_attribute_group_sync, + .validate_trigger = ad_sd_validate_trigger, + .update_scan_mode = ad7192_update_scan_mode, +}; + #define __AD719x_CHANNEL(_si, _channel1, _channel2, _address, _type, \ _mask_all, _mask_type_av, _mask_all_av, _ext_info) \ { \ @@ -1292,6 +1387,7 @@ static const struct ad7192_chip_info ad7192_chip_info_tbl[] = { .num_channels = ARRAY_SIZE(ad7192_channels), .sigma_delta_info = &ad7192_sigma_delta_info, .info = &ad7192_info, + .info_sync = &ad7192_info_sync, }, [ID_AD7192] = { .chip_id = CHIPID_AD7192, @@ -1300,6 +1396,7 @@ static const struct ad7192_chip_info ad7192_chip_info_tbl[] = { .num_channels = ARRAY_SIZE(ad7192_channels), .sigma_delta_info = &ad7192_sigma_delta_info, .info = &ad7192_info, + .info_sync = &ad7192_info_sync, }, [ID_AD7193] = { .chip_id = CHIPID_AD7193, @@ -1308,11 +1405,13 @@ static const struct ad7192_chip_info ad7192_chip_info_tbl[] = { .num_channels = ARRAY_SIZE(ad7193_channels), .sigma_delta_info = &ad7192_sigma_delta_info, .info = &ad7192_info, + .info_sync = &ad7192_info_sync, }, [ID_AD7194] = { .chip_id = CHIPID_AD7194, .name = "ad7194", .info = &ad7194_info, + .info_sync = &ad7194_info_sync, .sigma_delta_info = &ad7194_sigma_delta_info, .parse_channels = ad7194_parse_channels, }, @@ -1323,6 +1422,7 @@ static const struct ad7192_chip_info ad7192_chip_info_tbl[] = { .num_channels = ARRAY_SIZE(ad7192_channels), .sigma_delta_info = &ad7192_sigma_delta_info, .info = &ad7195_info, + .info_sync = &ad7195_info_sync, }, }; @@ -1344,6 +1444,11 @@ static int ad7192_probe(struct spi_device *spi) mutex_init(&st->lock); + st->sync_gpio = devm_gpiod_get_optional(dev, "sync", GPIOD_OUT_HIGH); + if (IS_ERR(st->sync_gpio)) + return dev_err_probe(dev, PTR_ERR(st->sync_gpio), + "Failed to get sync gpio.\n"); + /* * Regulator aincom is optional to maintain compatibility with older DT. * Newer firmware should provide a zero volt fixed supply if wired to @@ -1399,7 +1504,12 @@ static int ad7192_probe(struct spi_device *spi) indio_dev->name = st->chip_info->name; indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->info = st->chip_info->info; + + if (st->sync_gpio) + indio_dev->info = st->chip_info->info_sync; + else + indio_dev->info = st->chip_info->info; + if (st->chip_info->parse_channels) { ret = st->chip_info->parse_channels(indio_dev); if (ret)