Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp926421lqb; Wed, 29 May 2024 15:11:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlAHL04NtZN4MEul3IFRXG9w41SP/+extrfX2zLphJ9rxAZHbKzvlO+46dtc6Sn+dAIqJ8ntZK2HKczjrHj3AAtI+2xG2VyZYjqPrinA== X-Google-Smtp-Source: AGHT+IGuIgD6cuOLcwgaSYwcciIYwrm89CEwI546wyWth+Cklb4c3ZBCA62JkXqwAEgI8j5qn5+d X-Received: by 2002:a17:903:2d1:b0:1f4:808e:9f6e with SMTP id d9443c01a7336-1f61be83aaamr1656565ad.21.1717020707801; Wed, 29 May 2024 15:11:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717020707; cv=pass; d=google.com; s=arc-20160816; b=A44NnA+Tqxv5hvtAqdDauDNwjmswLO5Tc5kPx26eikf7+ra16aA2x8kBgYGKZWDsjr fYEhg+uVnF6JPH/CvsNc0VY4qQQqqK1H6wT5QjTXyMQ8spkwtlivIOTCvgH0LAgFMRe0 ZBByiYv7CVHYW7v3qj9CAjjsg22HKrk/6SUhbVYHDvsu1ItWCAyH5ScdojiSyH2LstRI rv/n8j4b70NYh93Fr6np+EtR4WtKsQVhTjfLB5pMCkVZXol9QeybIzFkwv/qs5B9e2jT DEChatwoWPKlrjRKSUBwyU7bEOKI+OZxTHhNY0PGCnkxWLIvXNtHVp1wshDTgBeIGMCF WfKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=svQ2kP8rlyYfBUzeKnxKowNmF0xNHylxbIzTzO1lnZg=; fh=BZ5OW3exu0FgUS1n5bYbjXpsVCluPSX1VTGcODvmDzo=; b=XDhuF4MeQ4l/eSwu5njF44zAUNAI5cZXzqyfCHedjr/iIVJ7aN0S5y9Fxvs/8bqMP2 nzmjciXBbQFVDtkTK24+ZGXHyFKjB8Jwj/ZszPozgfBhMwoxvphqMYzA3s1eu/BAvS6p 0E59VNNEwKinTtQXNBkr3/+ECy7v+SvjkqRk1rOudCVteE/26lW7WbnkqZHh5qCN57EJ HKpoazgH6GdbZUMXZaH5sapPQhf5+8dOx4e4gwnLR6d0Ld/NRXeU9L6fJDJAvm7unGc7 3eGzy0E7kMrOXkX+0S3lS3ZMyJCs3+iYMONhP5LPsBdCp4UYRO/LhjVxmmGa/XGX7vkm oiDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=UkFqZWLJ; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-194726-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194726-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c998bcfsi108291295ad.392.2024.05.29.15.11.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 15:11:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194726-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=UkFqZWLJ; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-194726-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194726-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C3603288D87 for ; Wed, 29 May 2024 22:04:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6F3A1C9EC4; Wed, 29 May 2024 22:04:27 +0000 (UTC) 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="UkFqZWLJ" Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.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 E82A51A0B06 for ; Wed, 29 May 2024 22:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717020266; cv=none; b=Ry0OnxCMR5AkgFD5PoZPrw7jkmZl5HbWtIlJ0y7hiXLCusqSvEM8NET4GBGImoP8ffU03Sr+cIyoaLDCEODXX7b3ChTyLn12zBxqnhNqWf7SPBPeetspOz34nbGAX2NfE9uxbCphu9aqw482PASQ+bqhvUHqqbl9rZ7UHSZZf30= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717020266; c=relaxed/simple; bh=VInmetRHk0eKKc12xNtVfGvs6AOei6C88yzbAhsbMvY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XNqrYp7Kt1733vOjkTNwD7ebwrnWiVGM1uhtlZbA5OvTlL3pIx6LQKLZKBK0ZL69OazC/WJto3m5KKg92yUlkP75ubiXc5P0JGbAxE1vkz2VthGKNeFYhTKz2gM/pshufe0s9n8/97yMpRkdrBtqS9OmRaGT/W/nYTwwQTz4sW8= 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=UkFqZWLJ; arc=none smtp.client-ip=209.85.210.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 Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-6f8ffe1b65dso103419a34.0 for ; Wed, 29 May 2024 15:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717020262; x=1717625062; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=svQ2kP8rlyYfBUzeKnxKowNmF0xNHylxbIzTzO1lnZg=; b=UkFqZWLJSp5Dye4oE8DEZ1WCfHrhWw1tveFbehuiAl5ZsqQw4tdZT1Zpnht40d0O4Y FcZzO0TCwzDJ+Ympw7SyghQ958Bf1INH+j8KdzQFozv/9vR3ZoA9pgZp7ges8oQmbvJ1 gr6r/ZIreTj1EqGiFsr1qB0GfHsO5VJmanonC7muMJ0IYwuQvxHhWd6y0J1n9LCHDV4R NL+VnYmNaZ7ojtbBGf87TZJf52nOyLsMSzZ3QENjXVZz+Kt5Ez6JZ2/Og228S2pUUwEV L6hSKzV2wy7PpiVbr3EREbxiLe0M66brmvZzDdM/ChZAeCLUfOzLK36LxXR9b9bBi6fz 44CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717020262; x=1717625062; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=svQ2kP8rlyYfBUzeKnxKowNmF0xNHylxbIzTzO1lnZg=; b=wGo5uY/DyrLZ+ua6JRRjL7cUc+eWXcj2H9ofGMdb/1Wtq0ZfHvPZruU1JIaSjxN0mF tJxLamLdrdVJ00D9+1Wr1zWgHcqgdpD32TyvayqRhG6FUnKZYeKEqfjVOs1p/Hw8P5VG qlksA6qB/kn/4GdwnoEK6nz4BBvDRHFcnCFhYtNtCKCnv3+Vtbcs764Lr6geYe93ArtH K4CtEoWYPY/beJp1aRXuhkEsoAex/m6DJkN3hEWnL6B0eGSu2+vYSR/1hgdX5CEhXqXu MB+5tAA1WeH1x3xMzBF4YogB5Q1NMSLW4BIDSbumkn7C6zccmETJre0h2fvME+qy6ip2 0KZA== X-Forwarded-Encrypted: i=1; AJvYcCXkyli/ld45LgUi54X/JWTAZMBhqKQpqxKoD1/c6ct3EO6eB/pfaKw7CRLogj+NYopmzBmmEFjSuNYBlVy9/KUu56bWgthppxXCfMWv X-Gm-Message-State: AOJu0Ywqtdv9L8ktuH+ySxhOxBiDl6r2jocdu5xdoxeKOn2muYEhSmnd ZCj5NyoPW1FRyRT9cQhBMOo9lAvNWQV3BHDPAZFjq38eGlcQE9dQ3+kB/SxmTZQ= X-Received: by 2002:a9d:6c49:0:b0:6f1:222c:2302 with SMTP id 46e09a7af769-6f90b8fcf71mr54831a34.2.1717020261883; Wed, 29 May 2024 15:04:21 -0700 (PDT) Received: from [192.168.0.142] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6f8d0e6143asm2467044a34.57.2024.05.29.15.04.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 May 2024 15:04:21 -0700 (PDT) Message-ID: <362e006f-7856-46e3-90fa-b1610784ee9d@baylibre.com> Date: Wed, 29 May 2024 17:04:20 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/6] dt-bindings: adc: ad7173: add support for ad411x To: "Ceclan, Dumitru" , Conor Dooley Cc: dumitru.ceclan@analog.com, Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240527-ad4111-v3-0-7e9eddbbd3eb@analog.com> <20240527-ad4111-v3-1-7e9eddbbd3eb@analog.com> <20240527-arguably-said-361184ad848e@spud> <20240528-filtrate-cloning-b9152322a3da@spud> Content-Language: en-US From: David Lechner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 5/29/24 8:38 AM, Ceclan, Dumitru wrote: > On 28/05/2024 20:52, Conor Dooley wrote: >> On Tue, May 28, 2024 at 03:16:07PM +0300, Ceclan, Dumitru wrote: >>> On 27/05/2024 20:48, Conor Dooley wrote: >>>> On Mon, May 27, 2024 at 08:02:34PM +0300, Dumitru Ceclan via B4 Relay wrote: >>>>> From: Dumitru Ceclan >>>>> >>>>> Add support for: AD4111, AD4112, AD4114, AD4115, AD4116. >>>>> >>>>> AD411x family ADCs support a VCOM pin, dedicated for single-ended usage. >>>>> AD4111/AD4112 support current channels, usage is implemented by >>>>> specifying channel reg values bigger than 15. >>>>> >>>>> Signed-off-by: Dumitru Ceclan >>>>> --- >>>>> .../devicetree/bindings/iio/adc/adi,ad7173.yaml | 122 ++++++++++++++++++++- >>>>> 1 file changed, 120 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml >>>>> index ea6cfcd0aff4..5b1af382dad3 100644 >>>>> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml >>>>> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml >>>>> @@ -19,7 +19,18 @@ description: | >>>>> primarily for measurement of signals close to DC but also delivers >>>>> outstanding performance with input bandwidths out to ~10kHz. >>>>> >>>>> + Analog Devices AD411x ADC's: >>>>> + The AD411X family encompasses a series of low power, low noise, 24-bit, >>>>> + sigma-delta analog-to-digital converters that offer a versatile range of >>>>> + specifications. They integrate an analog front end suitable for processing >>>>> + fully differential/single-ended and bipolar voltage inputs. >>>>> + >>>>> Datasheets for supported chips: >>>>> + https://www.analog.com/media/en/technical-documentation/data-sheets/AD4111.pdf >>>>> + https://www.analog.com/media/en/technical-documentation/data-sheets/AD4112.pdf >>>>> + https://www.analog.com/media/en/technical-documentation/data-sheets/AD4114.pdf >>>>> + https://www.analog.com/media/en/technical-documentation/data-sheets/AD4115.pdf >>>>> + https://www.analog.com/media/en/technical-documentation/data-sheets/AD4116.pdf >>>>> https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-2.pdf >>>>> https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-4.pdf >>>>> https://www.analog.com/media/en/technical-documentation/data-sheets/AD7173-8.pdf >>>>> @@ -31,6 +42,11 @@ description: | >>>>> properties: >>>>> compatible: >>>>> enum: >>>>> + - adi,ad4111 >>>>> + - adi,ad4112 >>>>> + - adi,ad4114 >>>>> + - adi,ad4115 >>>>> + - adi,ad4116 >>>>> - adi,ad7172-2 >>>>> - adi,ad7172-4 >>>>> - adi,ad7173-8 >>>>> @@ -129,10 +145,36 @@ patternProperties: >>>>> maximum: 15 >>>>> >>>>> diff-channels: >>>>> + description: | >>>>> + For using current channels specify select the current inputs >>>>> + and enable the adi,current-channel property. >>>>> + >>>>> + Family AD411x supports a dedicated VINCOM voltage input. >>>>> + To select it set the second channel to 16. >>>>> + (VIN2, VINCOM) -> diff-channels = <2 16> >>>>> + >>>>> + There are special values that can be selected besides the voltage >>>>> + analog inputs: >>>>> + 21: REF+ >>>>> + 22: REF− >>>>> + Supported only by AD7172-2, AD7172-4, AD7175-2, AD7175-8, AD7177-2: >>>>> + 19: ((AVDD1 − AVSS)/5)+ >>>>> + 20: ((AVDD1 − AVSS)/5)− >>>>> + >>>>> items: >>>>> minimum: 0 >>>>> maximum: 31 >>>>> >>>>> + single-channel: >>>>> + description: | >>>>> + Models AD4111 and AD4112 support single-ended current channels. >>>>> + To select the desired current input, specify the desired input pair: >>>>> + (IIN2+, IIN2−) -> single-channel = <2> >>>>> + >>>>> + items: >>>>> + minimum: 1 >>>>> + maximum: 16 >>>>> + >>>>> adi,reference-select: >>>>> description: | >>>>> Select the reference source to use when converting on >>>>> @@ -154,9 +196,26 @@ patternProperties: >>>>> - avdd >>>>> default: refout-avss >>>>> >>>>> + adi,current-channel: >>>>> + description: | >>>>> + Signal that the selected inputs are current channels. >>>>> + Only available on AD4111 and AD4112. >>>>> + type: boolean >>>>> + >>>>> + adi,channel-type: >>>>> + description: >>>>> + Used to differentiate between different channel types as the device >>>>> + register configurations are the same for all usage types. >>>>> + Both pseudo-differential and single-ended channels will use the >>>>> + single-ended specifier. >>>>> + $ref: /schemas/types.yaml#/definitions/string >>>>> + enum: >>>>> + - single-ended >>>>> + - differential >>>>> + default: differential >>>> >>>> I dunno if my brain just ain't workin' right today, or if this is not >>>> sufficiently explained, but why is this property needed? You've got >>>> diff-channels and single-channels already, why can you not infer the >>>> information you need from them? What should software do with this >>>> information? >>>> Additionally, "pseudo-differential" is not explained in this binding. >>> >>> In previous thread we arrived to the conclusion single-ended and >>> pseudo-differential channels should be marked with the flag >>> "differential=false" in the IIO channel struct. This cannot >>> really be inferred as any input pair could be used in that >>> manner and the only difference would be in external wiring. >>> >>> Single-channels cannot be used to define such a channel as >>> two voltage inputs need to be selected. Also, we are already >>> using single-channel to define the current channels. >> >> If I understand correctly, the property could be simplified to a flag >> then, since it's only the pseudo differential mode that you cannot be >> sure of? >> You know when you're single-ended based on single-channel, so the >> additional info you need is only in the pseudo-differential case. >> > Yes, it could just be a boolean flag. The only thing I have against > that is the awkwardness of having both diff-channels and > differential=false within a channel definition. > > No, there is no uncertainty regarding pseudo-differential, it's > basically single-ended. > > We cannot use single-channel for voltage channels, two voltage > inputs need to be specified. And again, single-channel will be > used here for the current channels. Instead of using diff-channels for single-ended/pseudo-differential plus a property that says "actually not differential" could we just add a second common-mode-channel property to specify the second input pin that is connected to the common mode voltage source? Just to make sure I'm understanding, single-ended means common mode voltage is 0V (or AVSS for this chip, I guess) and pseudo-differential means the common mode voltage is something else other than that. In other words, single-ended is just a special case of pseudo-differential. So effectively, no difference that we need to describe? So something like this could work? /* a fully differential voltage input channel */ channel@0 { reg = <0>; bipolar; diff-channels = <0 1>; /* VIN0 is +, VIN1 is - */ adi,reference-select = "vref"; }; /* a single-ended voltage input channel */ channel@1 { reg = <1>; /* no bipolar since common mode is 0V */ single-channel = <2>; /* VIN2 is input */ common-mode-channel = <3>; /* VIN3 connected to 0V */ }; /* a pseudo-differential voltage input channel */ channel@2 { reg = <2>; bipolar; /* since common mode is not 0V */ single-channel = <4>; /* VIN4 is input */ common-mode-channel = <5>; /* VIN5 connected to Vref / 2 */ adi,reference-select = "vref"; }; /* a current input channel */ channel@3 { reg = <3>; bipolar; /* 0 is not the same pin as channel@0 because of * the adi,current-channel flag */ single-channel = <0>; /* using IIN0+ and IIN0- pins */ adi,current-channel; }; If we really wanted to go all the way, we could also think about adding a common-mode-supply property in each channel node to with a common-mode-channel property to describe the voltage source that the pin is connected to.