From nobody Wed Nov 27 00:38:57 2024 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 DD2E11D0942 for ; Tue, 15 Oct 2024 09:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728983351; cv=none; b=hR+3St9qWhskhxRTJOAEvv6tPb6rQDjleaY2i9i4IJDx1p+Y4o6gocE/ws2hbLE0E3STNIek/J4OmfgvW4+Eq80mS4M9Idimah3UoSJO/V7OvJHYvTaQ10w0ZuO+L8eF6fyrOXn48h5dnB4wbhiVaeZogwO3/Cy/H46JtndwM/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728983351; c=relaxed/simple; bh=4dh88fpXjWM2OkXXxXiBrZ3khkFNnpHj68cspok1yCQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lelqjuTjD3oxkROXUjqL3iQjMHL0fhr3kmHjhO1woJ/IRxFIa9vls8V/A0tIZEwZ6L/m/IEiuVXvbd9yAY3UbGpcCGHGVS40IbDj4KfMnJEwWeVXZ16Q2mSw4tTxiyl/2I47p4mpgO+Mye2CZp35NWEzCfDS7ZktDWDyi20g8Nk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=v1uG+uOb; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="v1uG+uOb" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-431286f50e1so32567325e9.0 for ; Tue, 15 Oct 2024 02:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728983347; x=1729588147; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=X4aYmJuLHLzqYiMUL6guFj8BGFqJEWSohxxnej/Omg0=; b=v1uG+uObJu3IZcR6YJNdrLbqPhyizsIclt9SzLyJh2cZ7lPU57aYVajd9dVndzOP2N 4FA/pTfX2TKSILTy4sFDvXpQj3pD2mbtFdbhlR7oXiun5JGEwlTwcQGs19TgZELYZtmc 9EYWQwCnP/S48rUZU7vwx3MHHgi8OR3gvIIPGUcXDuqelKj8bx8FOhwd9aXFWaN0WZWY bHaPyt0UBEqg/JRTQQfMwwOZB/6BAxsjrFPtjxlJlnOjomM7mo0rpFexU/vsD6IiuaFj 8Fg6zfSTTa1Je3EY5nCRan6KM2SoUF4Lp88OSTzvGeOsYP9JZg4/SaM9kDxquUtfIJ0N l4Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728983347; x=1729588147; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X4aYmJuLHLzqYiMUL6guFj8BGFqJEWSohxxnej/Omg0=; b=fu/wttAg6cYneZ80puyI+rprRk2g8vgOSDKf1/04kW0lKAWmyxg58QDY+McHk+neI4 nDGsPFLlG4KDTVnuYGBq8Qau3eD40VnS66431nCr74sJzp9ezR6EbbaGEIYDqvYRsb3X urqJlqEA46B9WOI8tMtI6PCUrYEkK1bTyHxmypxH9GG8E9zFuFlX43byYar918TbSBGK s7kgMZJVt+snKe2cBBkD59ybYMjluIl8duJH8VO+I10YMdsQSBIdxnH54H3UUcuZYSgz rPA7QvcENUasGiIpZtVwheBBFLwKjeGHMntr7kFRKdmuTsHQ3r7AWMs851mqa0FGoBBA eP8g== X-Forwarded-Encrypted: i=1; AJvYcCX+BHkTewdqkrTCqLxvpJ/pPc5TKNWm2RcuEFqqIRwMbVec21aqbcLbOb4ZEgJVP0gcZMwEhOV10/motQY=@vger.kernel.org X-Gm-Message-State: AOJu0YzbJU/tKb0ZxxeiSQkX5dkMj27KL0u1xrZPcnooaNS9dts/+aZn mRRDxSU8qBHtFSP7hST2FgAxCRS6WFP1rgT6sZTflkwEgPwxWhovqUjkc/MUP8U= X-Google-Smtp-Source: AGHT+IGxNNQhVbtGbCkgXPmG3o6BbJ/J81pJA5d4mXr1AJozq0VK+SfWfQmL++k8I6rL/CKCWrwDLg== X-Received: by 2002:a05:600c:1d0b:b0:42b:ac3d:3abc with SMTP id 5b1f17b1804b1-43125607986mr137958365e9.24.1728983347147; Tue, 15 Oct 2024 02:09:07 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d7fc123dasm1012882f8f.94.2024.10.15.02.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 02:09:06 -0700 (PDT) From: Julien Stephan Date: Tue, 15 Oct 2024 11:09:06 +0200 Subject: [PATCH RFC 1/4] dt-bindings: iio: adc: ad7380: add adaq4370-4 and adaq4380-4 compatible parts Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241015-ad7380-add-adaq4380-4-support-v1-1-d2e1a95fb248@baylibre.com> References: <20241015-ad7380-add-adaq4380-4-support-v1-0-d2e1a95fb248@baylibre.com> In-Reply-To: <20241015-ad7380-add-adaq4380-4-support-v1-0-d2e1a95fb248@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data acquisition signal chain =CE=BCModule solutions compatible with the ad738x family, with the following differences: - configurable gain in front of each 4 adc - internal reference is 3V derived from refin-supply (5V) - additional supplies To configure the gain a new patternProperties is added to describe each channel. It is restricted to adaq devices. Signed-off-by: Julien Stephan --- .../devicetree/bindings/iio/adc/adi,ad7380.yaml | 117 +++++++++++++++++= ++++ 1 file changed, 117 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Do= cumentation/devicetree/bindings/iio/adc/adi,ad7380.yaml index 74d82721637c..3007d8e39684 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml @@ -25,6 +25,8 @@ description: | * https://www.analog.com/en/products/ad7386-4.html * https://www.analog.com/en/products/ad7387-4.html * https://www.analog.com/en/products/ad7388-4.html + * https://www.analog.com/en/products/adaq4370-4.html + * https://www.analog.com/en/products/adaq4380-4.html =20 =20 $ref: /schemas/spi/spi-peripheral-props.yaml# @@ -46,6 +48,8 @@ properties: - adi,ad7386-4 - adi,ad7387-4 - adi,ad7388-4 + - adi,adaq4370-4 + - adi,adaq4380-4 =20 reg: maxItems: 1 @@ -59,6 +63,9 @@ properties: vlogic-supply: true refio-supply: true refin-supply: true + vs-p-supply: true + vs-n-supply: true + ldo-supply: true =20 aina-supply: description: @@ -86,12 +93,43 @@ properties: specify the ALERT interrupt. maxItems: 1 =20 + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + required: - compatible - reg - vcc-supply - vlogic-supply =20 +patternProperties: + "^channel@([0-3])$": + $ref: adc.yaml + type: object + + properties: + reg: + description: + The channel number. From 0 to 3 corresponding to channels A,B,C,D + items: + minimum: 0 + maximum: 3 + + adi,gain-milli: + description: + The hardware gain applied to the ADC input (in milli units). + If not present, default to 1000 (no actual gain applied). + $ref: /schemas/types.yaml#/definitions/uint32 + default: 1000 + + required: + - reg + + additionalProperties: false + unevaluatedProperties: false =20 allOf: @@ -128,7 +166,21 @@ allOf: ainc-supply: false aind-supply: false =20 + # Using channel to declare gain property only applies to adaq devices + - if: + properties: + compatible: + not: + contains: + enum: + - adi,adaq4370-4 + - adi,adaq4380-4 + then: + patternProperties: + "^channel@([0-3])$": false + # ad7380-4 uses refin-supply as external reference. + # adaq devices use internal reference only, derived from refin-supply # All other chips from ad738x family use refio as optional external refe= rence. # When refio-supply is omitted, internal reference is used. - if: @@ -136,6 +188,8 @@ allOf: compatible: enum: - adi,ad7380-4 + - adi,adaq4370-4 + - adi,adaq4380-4 then: properties: refio-supply: false @@ -145,6 +199,24 @@ allOf: properties: refin-supply: false =20 + # adaq devices need more supplies + - if: + properties: + compatible: + enum: + - adi,adaq4370-4 + - adi,adaq4380-4 + then: + required: + - vs-p-supply + - vs-n-supply + - ldo-supply + else: + properties: + vs-p-supply: false + vs-n-supply: false + ldo-supply: false + examples: - | #include @@ -169,3 +241,48 @@ examples: refio-supply =3D <&supply_2_5V>; }; }; + + - | + #include + + spi { + #address-cells =3D <1>; + #size-cells =3D <0>; + + adc@0 { + compatible =3D "adi,adaq4380-4"; + reg =3D <0>; + + spi-cpol; + spi-cpha; + spi-max-frequency =3D <80000000>; + + interrupts =3D <27 IRQ_TYPE_EDGE_FALLING>; + interrupt-parent =3D <&gpio0>; + + vcc-supply =3D <&supply_3_3V>; + vlogic-supply =3D <&supply_3_3V>; + refin-supply =3D <&supply_5V>; + vs-p-supply =3D <&supply_5V>; + vs-n-supply =3D <&supply_0V>; + ldo-supply =3D <&supply_5V>; + + #address-cells =3D <1>; + #size-cells =3D <0>; + + channel@0 { + reg =3D <0>; + adi,gain-milli =3D <300>; + }; + + channel@2 { + reg =3D <2>; + adi,gain-milli =3D <600>; + }; + + channel@3 { + reg =3D <3>; + adi,gain-milli =3D <1000>; + }; + }; + }; --=20 2.46.0 From nobody Wed Nov 27 00:38:57 2024 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.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 F3CC81D5AB4 for ; Tue, 15 Oct 2024 09:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728983352; cv=none; b=t/08V9VY8MZHzMVtbpIGFR7F4jYYOv7wKlLWoceNeOpUqfT0pMRXVbro6nHi7ZXv7A69CCv3sAtKd43h4sW4I4beuD0dJTeQSuiFW6/Mgm0kug58ntkXuI4Y5slE5QqqO0fcvFuqbwjyt1IvG2SXyNsiwFCGtKCb3WBRAYdELPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728983352; c=relaxed/simple; bh=o62uOnLdet39sGOU8s7LXAinW57s1Px5F5MzWy4QaUo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MYSRNJ9etbmmBPU+f+e+g/7uvT90n5vuCEVv0eXkTFMqYYGt90XrGCGK5S3VYIDYIWNiMdXuJR/fGvpbVRLc40PpFqcxSthItTvnNuGlgCz8y4EUzLOTXtawICO87bl+J2Zt13bgjWG+vMw3giqNhx97AQugTRNKF/b7Fn9t6wQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=TwT9OVU+; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="TwT9OVU+" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-430ee5c9570so60280075e9.3 for ; Tue, 15 Oct 2024 02:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728983348; x=1729588148; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sTy6VNLKeEKKTg69S3uNulsgrGlXdqfWHluaJ2NZUNs=; b=TwT9OVU+6mFxf4V+J65VJ4T2lg07misEpxnK53KwbDdZTr4x4AxiGTYKON64Bcmzh0 ikUQzPwOp3ZSL5+FGjEGqsQx2UjAmZYXeecSTW7dzt0vM0ZsbzE8aPCVAZhkcxlJpP30 NYWQpCmy2csXBuNPGNq2bvbkGTvXQmGg+F0dhr/nmc917yrBiuVlsqhlQSZuL6QVj71X hm25L3XKTX4pFQ9JCNJf5FFOuMxX1DfaW3lZPQOmNKYdU+M6pALdq9KR+cngbJWv3Xzn rRLjYy2L0m+XwPEoEnobEVwFZw+V0F66NTubBWf6mMXhXPveGjoKuQtNXifcAzXNidqg elfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728983348; x=1729588148; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sTy6VNLKeEKKTg69S3uNulsgrGlXdqfWHluaJ2NZUNs=; b=w7k3Q93LSbZ05caVyrzpGQl3Gu1wGIdBtVbFgcuEyo/24eDr+uN3EfBnMLexWZtwo8 wjvSNb/kdhOrfoukUCmLa6pPwIK64F97w+QEidFCvH5XA3RlPzJ78mf/4gwxm8cU7J7R t0jTMQvvYjCFXdM+ti6+S1RscrGAXzmkQm+GyfYDesQvyzTcnsq7OW32G+nR46XUp748 iKSybiAvlaIcEpzxkSsaCBEDjsHQ3J9jqG0GsHfX4lVKdTlIx7cPoU2O0FtWx/3F2d2s vCvBTbxx4kKHqv+lif+h2tJMzODrMcmUdFhv4bPT0BEkLsOSQdPb5w6eNeeFSHLNVxpg vFbg== X-Forwarded-Encrypted: i=1; AJvYcCVGapgnBDJRs1BXXGZVXbUDApI9QbvU/VKQBkrT8ZKyZ2Hc9Q0j20lrE4upAI1HAzjKhdZDRpqH0Oc4GqE=@vger.kernel.org X-Gm-Message-State: AOJu0YzAVTIqTpp5KnfqaziNXPGWdX7ohysncZzVxXlnrDcB6y57zm0f hfe033qV7LbwXdXneL/qzcy3ebS41E+c1hYcOd9zu4K9eyvOD3nejsNRT7JaKyY= X-Google-Smtp-Source: AGHT+IF1h+oXQTPOArXM1QcDAmgctLATg+guTpS56FPH/LhpgaycB2RtXYhpBTIaJ3MVVN/32EmSvA== X-Received: by 2002:a05:600c:1c9c:b0:42c:a8cb:6a5a with SMTP id 5b1f17b1804b1-431255df67amr113061465e9.15.1728983348183; Tue, 15 Oct 2024 02:09:08 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d7fc123dasm1012882f8f.94.2024.10.15.02.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 02:09:07 -0700 (PDT) From: Julien Stephan Date: Tue, 15 Oct 2024 11:09:07 +0200 Subject: [PATCH RFC 2/4] iio: adc: ad7380: fix oversampling formula Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241015-ad7380-add-adaq4380-4-support-v1-2-d2e1a95fb248@baylibre.com> References: <20241015-ad7380-add-adaq4380-4-support-v1-0-d2e1a95fb248@baylibre.com> In-Reply-To: <20241015-ad7380-add-adaq4380-4-support-v1-0-d2e1a95fb248@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 The formula in the datasheet for oversampling time conversion seems to be valid when device is at full speed using the maximum number of SDO lines. The driver currently support only 1 SDO line. The formula will produce larger delays than what is currently set, but some devices actually require it. Signed-off-by: Julien Stephan --- drivers/iio/adc/ad7380.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c index e9784769baa9..15ca85c70ebd 100644 --- a/drivers/iio/adc/ad7380.c +++ b/drivers/iio/adc/ad7380.c @@ -77,6 +77,12 @@ #define T_CONVERT_X_NS 500 /* xth conversion start time (oversampling) */ #define T_POWERUP_MS 5 /* Power up */ =20 +/* + * AD738x support several SDO lines to increase throughput, but driver cur= rently + * supports only 1 SDO line (standard SPI transaction) + */ +#define AD7380_NUM_SDO_LINES 1 + struct ad7380_timing_specs { const unsigned int t_csh_ns; /* CS minimum high time */ }; @@ -649,7 +655,8 @@ static int ad7380_set_ch(struct ad7380_state *st, unsig= ned int ch) =20 if (st->oversampling_ratio > 1) xfer.delay.value =3D T_CONVERT_0_NS + - T_CONVERT_X_NS * (st->oversampling_ratio - 1); + T_CONVERT_X_NS * (st->oversampling_ratio - 1) * + st->chip_info->num_simult_channels / AD7380_NUM_SDO_LINES; =20 return spi_sync_transfer(st->spi, &xfer, 1); } @@ -667,12 +674,13 @@ static void ad7380_update_xfers(struct ad7380_state *= st, =20 /* * In the case of oversampling, conversion time is higher than in normal - * mode. Technically T_CONVERT_X_NS is lower for some chips, but we use - * the maximum value for simplicity for now. + * mode: t_convert =3D T_CONVERT_0_NS + T_CONVERT_X_NS*(x - 1)*num_channe= l/number_of_sdo_lines + * where x is the oversampling ratio */ if (st->oversampling_ratio > 1) t_convert =3D T_CONVERT_0_NS + T_CONVERT_X_NS * - (st->oversampling_ratio - 1); + (st->oversampling_ratio - 1) * + st->chip_info->num_simult_channels / AD7380_NUM_SDO_LINES; =20 if (st->seq) { xfer[0].delay.value =3D xfer[1].delay.value =3D t_convert; @@ -1021,7 +1029,8 @@ static int ad7380_init(struct ad7380_state *st, bool = external_ref_en) /* SPI 1-wire mode */ return regmap_update_bits(st->regmap, AD7380_REG_ADDR_CONFIG2, AD7380_CONFIG2_SDO, - FIELD_PREP(AD7380_CONFIG2_SDO, 1)); + FIELD_PREP(AD7380_CONFIG2_SDO, + AD7380_NUM_SDO_LINES)); } =20 static int ad7380_probe(struct spi_device *spi) --=20 2.46.0 From nobody Wed Nov 27 00:38:57 2024 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 58ED81CF7AA for ; Tue, 15 Oct 2024 09:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728983353; cv=none; b=pZyfHLFlBwZgDPfHYQiKEYqhrIIRIr3O0/EKDdUx7XYDtiU3Y1e54OlvkpLooRzJdvvepYFuIv9PCgKGsoLBDC/o6BcGWGUJsIYLnmmSKzvjxT9zJWX2zP0Zo4QFuxPbe1EDJN4THubis4F0QH9Qjb1bBgHQmZFh7cdRkP5qaEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728983353; c=relaxed/simple; bh=94lx/Ld+E5OpKCzIM1RHwElY0Ulkx3QoxENTPuiFl9g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kz4EK91KBQ+eJFZ/bKYGrmiYx2iT9Auk6A/hWj4Lz4b5tEzIS5c8BARTF9wAACGTPX5Wii7VxScC3r8Enggir6JZUTOyEXpbX51sX9Egoe4efI95oF746xaDXGe/d/Z/MiM64LPAoTia1yhLGWyayO28LI1N0mulrE7Qlpc6qAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=KAXVz5YS; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="KAXVz5YS" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-539f0f9ee49so2354404e87.1 for ; Tue, 15 Oct 2024 02:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728983349; x=1729588149; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=p4P9jNsfxGTdEuN0LRJp473yLVkeaSpjLa8sbBb+pIE=; b=KAXVz5YSDcMmApFA9KnHdXehmna9LSRDY5xVnj8Ghjq7BCI1DN1uTCWW4izN7gMJff Rkpg8Nn3ukm9VdU06YrqLpqv+BKbD93xgkCQVCf1+MnsxjewXBcmme6I6e3QU4N3Xdqx mmSohwuNT2NieMtt1LoHxbf+tI+O5sUAg2F8EKIU8fQ7LM2/KGd9UA+13jtmEJ3kr2FO 28efpJ9RAl6EPgbn6518BR61QqENukUDz+m/xNYr2l0AptYz5it7RWZkhGrl2s/GFzOm gCXhBYYjkN4cdC3hNbfmYi2Dugn2QtE52cmFcMJevJ+pkQaas3nid7dk5Tnc/9XK/LCE adKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728983349; x=1729588149; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p4P9jNsfxGTdEuN0LRJp473yLVkeaSpjLa8sbBb+pIE=; b=T8S0EiTK44+LI6+dAJQnAIYj9K0uyR0KqdtHa9yiGB50DWqAo/wGXT7uMDSMM09EjG fEzAgkPKHDvQIuHXU9o3nT92Qpp89olrcMp0EqWv+nun8CfMMgiGdl38vt7OqB9TbVZk et2gilwXHUCx2KjH6neYbJtbtSdZXONztvJz/JWdTK4lR2BEfcs0TkHNiCfCNThpugF1 pRCcq+uADyfXdEif6qhJo+vz9F8KTtOYq9GQZnLhGwRflT07YModEWv328KthtP20+Se 8Y8c0Ok0CorXlLzIZBinzS9MrAd7h5rCC6Ms3hkB+/RJZuWHJM1ZwKHEWWHtyzSr4Szu Ar0g== X-Forwarded-Encrypted: i=1; AJvYcCVQNWbsB82fKfotq8zKbLDSSC2UBy2rIlLomfO0/YBGqnI9vhS4H50xuQ7TxTfpFOPYQMOe2futzKkOkg4=@vger.kernel.org X-Gm-Message-State: AOJu0Yzf0UnQmqB8ICS5FJSxUEdPboRCNrzUch+PunYghjeRY+R2GzzO +f8opSmIQDshVDvmsNjramIWzekMjCANmXtqm+NHL/Jt8uyTRgG2E4lgPCjV3Gc= X-Google-Smtp-Source: AGHT+IHd8e0yHmD2HzmJcPRRsYNsSRuc0ugXHhF0fxJhFxcPmLKetgBbkAYd1+oBgEa1tGvuF19TFg== X-Received: by 2002:a05:6512:3c95:b0:534:3cdc:dbef with SMTP id 2adb3069b0e04-539da547affmr7726602e87.43.1728983349304; Tue, 15 Oct 2024 02:09:09 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d7fc123dasm1012882f8f.94.2024.10.15.02.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 02:09:08 -0700 (PDT) From: Julien Stephan Date: Tue, 15 Oct 2024 11:09:08 +0200 Subject: [PATCH RFC 3/4] iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241015-ad7380-add-adaq4380-4-support-v1-3-d2e1a95fb248@baylibre.com> References: <20241015-ad7380-add-adaq4380-4-support-v1-0-d2e1a95fb248@baylibre.com> In-Reply-To: <20241015-ad7380-add-adaq4380-4-support-v1-0-d2e1a95fb248@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data acquisition signal chain =CE=BCModule solutions compatible with the ad738x family, with the following differences: - configurable gain in front of each 4 adc - internal reference is 3V derived from refin-supply (5V) - additional supplies This implies that IIO_CHAN_INFO_SCALE can not be shared by type. Signed-off-by: Julien Stephan --- drivers/iio/adc/ad7380.c | 116 +++++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 112 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c index 15ca85c70ebd..12c19913d75d 100644 --- a/drivers/iio/adc/ad7380.c +++ b/drivers/iio/adc/ad7380.c @@ -13,6 +13,8 @@ * ad7381-4 : https://www.analog.com/media/en/technical-documentation/data= -sheets/ad7381-4.pdf * ad7383/4-4 : https://www.analog.com/media/en/technical-documentation/da= ta-sheets/ad7383-4-ad7384-4.pdf * ad7386/7/8-4 : https://www.analog.com/media/en/technical-documentation/= data-sheets/ad7386-4-7387-4-7388-4.pdf + * adaq4370-4 : https://www.analog.com/media/en/technical-documentation/da= ta-sheets/adaq4370-4.pdf + * adaq4380-4 : https://www.analog.com/media/en/technical-documentation/da= ta-sheets/adaq4380-4.pdf */ =20 #include @@ -22,11 +24,13 @@ #include #include #include +#include #include #include #include #include #include +#include =20 #include #include @@ -36,6 +40,8 @@ #define MAX_NUM_CHANNELS 8 /* 2.5V internal reference voltage */ #define AD7380_INTERNAL_REF_MV 2500 +/* 3.3V internal reference voltage for ADAQ */ +#define ADAQ4380_INTERNAL_REF_MV 3300 =20 /* reading and writing registers is more reliable at lower than max speed = */ #define AD7380_REG_WR_SPEED_HZ 10000000 @@ -82,6 +88,7 @@ * supports only 1 SDO line (standard SPI transaction) */ #define AD7380_NUM_SDO_LINES 1 +#define AD7380_DEFAULT_GAIN_MILLI 1000 =20 struct ad7380_timing_specs { const unsigned int t_csh_ns; /* CS minimum high time */ @@ -92,10 +99,12 @@ struct ad7380_chip_info { const struct iio_chan_spec *channels; unsigned int num_channels; unsigned int num_simult_channels; + bool has_hardware_gain; bool has_mux; const char * const *supplies; unsigned int num_supplies; bool external_ref_only; + bool adaq_internal_ref_only; const char * const *vcm_supplies; unsigned int num_vcm_supplies; const unsigned long *available_scan_masks; @@ -187,11 +196,12 @@ static const struct iio_scan_type ad7380_scan_type_16= _u[] =3D { }, }; =20 -#define AD7380_CHANNEL(index, bits, diff, sign) { \ +#define _AD7380_CHANNEL(index, bits, diff, sign, gain) { \ .type =3D IIO_VOLTAGE, \ .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | \ + ((gain) ? BIT(IIO_CHAN_INFO_SCALE) : 0) | \ ((diff) ? 0 : BIT(IIO_CHAN_INFO_OFFSET)), \ - .info_mask_shared_by_type =3D BIT(IIO_CHAN_INFO_SCALE) | \ + .info_mask_shared_by_type =3D ((gain) ? 0 : BIT(IIO_CHAN_INFO_SCALE)) | \ BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \ .info_mask_shared_by_type_available =3D \ BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \ @@ -205,6 +215,12 @@ static const struct iio_scan_type ad7380_scan_type_16_= u[] =3D { .num_ext_scan_type =3D ARRAY_SIZE(ad7380_scan_type_##bits##_##sign), \ } =20 +#define AD7380_CHANNEL(index, bits, diff, sign) \ + _AD7380_CHANNEL(index, bits, diff, sign, false) + +#define ADAQ4380_CHANNEL(index, bits, diff, sign) \ + _AD7380_CHANNEL(index, bits, diff, sign, true) + #define DEFINE_AD7380_2_CHANNEL(name, bits, diff, sign) \ static const struct iio_chan_spec name[] =3D { \ AD7380_CHANNEL(0, bits, diff, sign), \ @@ -221,6 +237,15 @@ static const struct iio_chan_spec name[] =3D { \ IIO_CHAN_SOFT_TIMESTAMP(4), \ } =20 +#define DEFINE_ADAQ4380_4_CHANNEL(name, bits, diff, sign) \ +static const struct iio_chan_spec name[] =3D { \ + ADAQ4380_CHANNEL(0, bits, diff, sign), \ + ADAQ4380_CHANNEL(1, bits, diff, sign), \ + ADAQ4380_CHANNEL(2, bits, diff, sign), \ + ADAQ4380_CHANNEL(3, bits, diff, sign), \ + IIO_CHAN_SOFT_TIMESTAMP(4), \ +} + #define DEFINE_AD7380_8_CHANNEL(name, bits, diff, sign) \ static const struct iio_chan_spec name[] =3D { \ AD7380_CHANNEL(0, bits, diff, sign), \ @@ -239,6 +264,7 @@ DEFINE_AD7380_2_CHANNEL(ad7380_channels, 16, 1, s); DEFINE_AD7380_2_CHANNEL(ad7381_channels, 14, 1, s); DEFINE_AD7380_4_CHANNEL(ad7380_4_channels, 16, 1, s); DEFINE_AD7380_4_CHANNEL(ad7381_4_channels, 14, 1, s); +DEFINE_ADAQ4380_4_CHANNEL(adaq4380_4_channels, 16, 1, s); /* pseudo differential */ DEFINE_AD7380_2_CHANNEL(ad7383_channels, 16, 0, s); DEFINE_AD7380_2_CHANNEL(ad7384_channels, 14, 0, s); @@ -257,6 +283,10 @@ static const char * const ad7380_supplies[] =3D { "vcc", "vlogic", }; =20 +static const char * const adaq4380_supplies[] =3D { + "ldo", "vcc", "vlogic", "vs-p", "vs-n", "refin", +}; + static const char * const ad7380_2_channel_vcm_supplies[] =3D { "aina", "ainb", }; @@ -516,6 +546,32 @@ static const struct ad7380_chip_info ad7388_4_chip_inf= o =3D { .timing_specs =3D &ad7380_4_timing, }; =20 +static const struct ad7380_chip_info adaq4370_4_chip_info =3D { + .name =3D "adaq4370-4", + .channels =3D adaq4380_4_channels, + .num_channels =3D ARRAY_SIZE(adaq4380_4_channels), + .num_simult_channels =3D 4, + .supplies =3D adaq4380_supplies, + .num_supplies =3D ARRAY_SIZE(adaq4380_supplies), + .adaq_internal_ref_only =3D true, + .has_hardware_gain =3D true, + .available_scan_masks =3D ad7380_4_channel_scan_masks, + .timing_specs =3D &ad7380_4_timing, +}; + +static const struct ad7380_chip_info adaq4380_4_chip_info =3D { + .name =3D "adaq4380-4", + .channels =3D adaq4380_4_channels, + .num_channels =3D ARRAY_SIZE(adaq4380_4_channels), + .num_simult_channels =3D 4, + .supplies =3D adaq4380_supplies, + .num_supplies =3D ARRAY_SIZE(adaq4380_supplies), + .adaq_internal_ref_only =3D true, + .has_hardware_gain =3D true, + .available_scan_masks =3D ad7380_4_channel_scan_masks, + .timing_specs =3D &ad7380_4_timing, +}; + struct ad7380_state { const struct ad7380_chip_info *chip_info; struct spi_device *spi; @@ -526,6 +582,7 @@ struct ad7380_state { bool seq; unsigned int vref_mv; unsigned int vcm_mv[MAX_NUM_CHANNELS]; + unsigned int gain_milli[MAX_NUM_CHANNELS]; /* xfers, message an buffer for reading sample data */ struct spi_transfer normal_xfer[2]; struct spi_message normal_msg; @@ -876,8 +933,15 @@ static int ad7380_read_raw(struct iio_dev *indio_dev, * * (2 =C3=97 VREF) / 2^N, for differential chips * * VREF / 2^N, for pseudo-differential chips * where N is the ADC resolution (i.e realbits) + * + * The gain is stored as a fraction of 1000 and, as we need to + * divide vref_mv by the gain, we invert the gain/1000 fraction. */ - *val =3D st->vref_mv; + if (st->chip_info->has_hardware_gain) + *val =3D mult_frac(st->vref_mv, MILLI, + st->gain_milli[chan->scan_index]); + else + *val =3D st->vref_mv; *val2 =3D scan_type->realbits - chan->differential; =20 return IIO_VAL_FRACTIONAL_LOG2; @@ -1058,7 +1122,19 @@ static int ad7380_probe(struct spi_device *spi) "Failed to enable power supplies\n"); msleep(T_POWERUP_MS); =20 - if (st->chip_info->external_ref_only) { + if (st->chip_info->adaq_internal_ref_only) { + /* + * ADAQ chips use fixed internal reference but still + * require an external reference supply to power it. + * "refin" is already enabled with other power supplies + * in bulk_get_enable(). + */ + + st->vref_mv =3D ADAQ4380_INTERNAL_REF_MV; + + /* these chips don't have a register bit for this */ + external_ref_en =3D false; + } else if (st->chip_info->external_ref_only) { ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "refin"); if (ret < 0) @@ -1104,6 +1180,34 @@ static int ad7380_probe(struct spi_device *spi) st->vcm_mv[i] =3D ret / 1000; } =20 + for (i =3D 0; i < MAX_NUM_CHANNELS; i++) + st->gain_milli[i] =3D AD7380_DEFAULT_GAIN_MILLI; + + if (st->chip_info->has_hardware_gain) { + device_for_each_child_node_scoped(&spi->dev, node) { + unsigned int channel, gain; + + ret =3D fwnode_property_read_u32(node, "reg", &channel); + if (ret) + return dev_err_probe(&spi->dev, ret, + "Failed to read reg property\n"); + + if (channel >=3D st->chip_info->num_channels - 1) + return dev_err_probe(&spi->dev, -EINVAL, + "Invalid channel number %i\n", + channel); + + ret =3D fwnode_property_read_u32(node, "adi,gain-milli", + &gain); + if (ret && ret !=3D -EINVAL) + return dev_err_probe(&spi->dev, ret, + "Failed to read gain for channel %i\n", + channel); + if (ret !=3D -EINVAL) + st->gain_milli[channel] =3D gain; + } + } + st->regmap =3D devm_regmap_init(&spi->dev, NULL, st, &ad7380_regmap_confi= g); if (IS_ERR(st->regmap)) return dev_err_probe(&spi->dev, PTR_ERR(st->regmap), @@ -1186,6 +1290,8 @@ static const struct of_device_id ad7380_of_match_tabl= e[] =3D { { .compatible =3D "adi,ad7386-4", .data =3D &ad7386_4_chip_info }, { .compatible =3D "adi,ad7387-4", .data =3D &ad7387_4_chip_info }, { .compatible =3D "adi,ad7388-4", .data =3D &ad7388_4_chip_info }, + { .compatible =3D "adi,adaq4370-4", .data =3D &adaq4370_4_chip_info }, + { .compatible =3D "adi,adaq4380-4", .data =3D &adaq4380_4_chip_info }, { } }; =20 @@ -1204,6 +1310,8 @@ static const struct spi_device_id ad7380_id_table[] = =3D { { "ad7386-4", (kernel_ulong_t)&ad7386_4_chip_info }, { "ad7387-4", (kernel_ulong_t)&ad7387_4_chip_info }, { "ad7388-4", (kernel_ulong_t)&ad7388_4_chip_info }, + { "adaq4370-4", (kernel_ulong_t)&adaq4370_4_chip_info }, + { "adaq4380-4", (kernel_ulong_t)&adaq4380_4_chip_info }, { } }; MODULE_DEVICE_TABLE(spi, ad7380_id_table); --=20 2.46.0 From nobody Wed Nov 27 00:38:57 2024 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 C0C571DC19D for ; Tue, 15 Oct 2024 09:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728983354; cv=none; b=uprksopJfZOLQivhelNG3YyPzk2N9kgUI0elBqgxB9BsUHtNshMX7GbDj1zhyIO4Ye74dfrQ4lsnjRKTMJhWhEq7lN/v3E7eYkqG8XjLa3D/mzGaW9k0+POL0Nw3eX9aHNrzaMJGJ6H2oEUKv99HzgmpNKxbSYCNO28dGKOV1sA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728983354; c=relaxed/simple; bh=Xf+1p1dhNaBSOlyYJsyHP6TW4PzwOUZ7+GLCro93QzI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FFtQy3S4PJWxIqTkpbAJFZ1V2j7WUmtk3H8PGfvdqyzRwpekbya86IlO9u/E8+NIkD61ip2EYqZ3st0QXvoA4lVh8W8qZpjBGPSHTnvN62YOXOMc62mOFRMKxFs8p43pGyAoW90dL9ohL/p5B7E7MRjlNwX/S4OtndKmigtjhfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=V54wJyEK; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="V54wJyEK" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-43117ed8adbso57220875e9.2 for ; Tue, 15 Oct 2024 02:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728983351; x=1729588151; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0uiUgc2lMDswctm/8bBLpifbXnHpYVOogncCBqrFxao=; b=V54wJyEKeFL0R/9HTBYUmOXBHmTOTKarTmRjYb4lc6gEbq62XqT6O4Mt+iSl1g+WQY SraV8m3ZRWBPfYZkW8Vj6pxBAeki44iE0unoqLy9zhqRadZXahwzqgHfoRXHP1NmeRQV 4QL/2jO8QOUV1yCQ1hchWCRgtUzU0oLdWoVzDvbiuP6SXrq3iLgjKqdFj5yQ4FI4jYLl 78+QxmsdrlhVpjfPMZPMa8o/vTFDATicLjK9DuRM69r2YuGfMQtQl5jmRmnNlt/Ip7/K Femp1MYZ0WD9WgplK0LNNsPY9yGQp+cSEoxvWEfNs3NeVeJz24mCM/dI3p4qqNRBRjDD FoRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728983351; x=1729588151; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0uiUgc2lMDswctm/8bBLpifbXnHpYVOogncCBqrFxao=; b=vnHZbEMJjLQTu2YCyYwNUgTOoAHrjLzV8rxSXCg+lWdaSgs/Fpei+TI+dR2tXS167x RE3lL3YvlVhntOIt2f2wbA4pURSvD9MCpbigwa7ZB30liExYDcbJgx/booMfNa+jJtNN 40kTuk8Mc5UPDIUGZ3h673T/wpRM3LWJUJADk0Lzc+sGId2mh3/6V/C5USXdHETQk2tj pswDvlFHBNZPNpXGHa8Jxv07rg8VFkxphl+KOvRLr8BdP1q3kFN1kMNG7LBidgVV5knl A6O+f6jSMjayH3F5ovuv51TsK43tSNdZ/dlzd1oewxAim3TDiCeaYL6Flhno4gOk1c2g NVzA== X-Forwarded-Encrypted: i=1; AJvYcCWtX5Po7OHSqqsMpSGfuINQOzfGw13OtDyK+mrqKA5FR9x9g+E5sZUmlIBQGuIGb1DkFfTEUinJrMMf8tM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+W1hGkNCllzDOdw/hdJVqBsYq+GQYvmgFtWr7OobzprgieyHZ BHvqKZLUQC05kprTtnTcjyVu1Yi66FZb2AFMvFsW++6hnomncaXGqfx/QCE5GmQ= X-Google-Smtp-Source: AGHT+IEUX37M/knbAn5SKR1nohLrXr6gCko+RdOrWyp0Mui4xUOkxNxxb3hi8uVAPtADPhLB4yiVMQ== X-Received: by 2002:a5d:448e:0:b0:37c:d1fb:82f4 with SMTP id ffacd0b85a97d-37d600d2fe3mr9913019f8f.36.1728983350979; Tue, 15 Oct 2024 02:09:10 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d7fc123dasm1012882f8f.94.2024.10.15.02.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 02:09:09 -0700 (PDT) From: Julien Stephan Date: Tue, 15 Oct 2024 11:09:09 +0200 Subject: [PATCH RFC 4/4] docs: iio: ad7380: add adaq4370-4 and adaq4380-4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241015-ad7380-add-adaq4380-4-support-v1-4-d2e1a95fb248@baylibre.com> References: <20241015-ad7380-add-adaq4380-4-support-v1-0-d2e1a95fb248@baylibre.com> In-Reply-To: <20241015-ad7380-add-adaq4380-4-support-v1-0-d2e1a95fb248@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.1 Adding documentation for adaq4370-4 and adaq4380-4 supported devices. In particular, document the reference voltage mechanism and the gain parameter that are specific to adaq devices. Signed-off-by: Julien Stephan --- Documentation/iio/ad7380.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/iio/ad7380.rst b/Documentation/iio/ad7380.rst index 6f70b49b9ef2..eeffd19db642 100644 --- a/Documentation/iio/ad7380.rst +++ b/Documentation/iio/ad7380.rst @@ -27,6 +27,8 @@ The following chips are supported by this driver: * `AD7386-4 `_ * `AD7387-4 `_ * `AD7388-4 `_ +* `ADAQ4370-4 `_ +* `ADAQ4380-4 `_ =20 =20 Supported features @@ -47,6 +49,12 @@ ad7380-4 ad7380-4 supports only an external reference voltage (2.5V to 3.3V). It mu= st be declared in the device tree as ``refin-supply``. =20 +adaq devices +~~~~~~~~~~~~ + +adaq4370-4 and adaq4380-4 don't have an external reference, but use a 3V +internal reference derived from one of its supplies (``refin-supply``) + All other devices from ad738x family ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =20 @@ -121,6 +129,13 @@ Example for AD7386/7/8 (2 channels parts): =20 When enabling sequencer mode, the effective sampling rate is divided by tw= o. =20 + +Gain (adaq devices only) +~~~~~~~~~~~~~~~~~~~~~~~~ + +adaq devices have a configurable gain in front of each adc. The appropriat= e gain +is selectable from device tree using the ``adi,gain-milli`` property. + Unimplemented features ---------------------- =20 --=20 2.46.0