Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1627274pxv; Sat, 10 Jul 2021 09:59:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9bxV+WPYqKIID90ZXXPELqZ7ZLyMGJ9v/Zg/j3t6On1DfNptFXwFIC91UM1zohXNB4SKA X-Received: by 2002:a17:906:4c8c:: with SMTP id q12mr44324560eju.254.1625936347066; Sat, 10 Jul 2021 09:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625936347; cv=none; d=google.com; s=arc-20160816; b=Nu4f5LImylQi2pKplRhgKI6gp0cGvPdzJXGVWq/mRKFkECb3ReSbV1hABwwgFQGV/Y 8oyLBGwENVWM0kAez6t2Ua9QWyl6jfHrDoIsz0SUc3KAnxtUxpjiDV937HQrRUdEgaX6 oiJZD5fSkAuVITkvTBlYEDlEamUkqze8kiIgoHmpFyWKUCbpc9P3JffuiIWrXcvtYz9+ WjE50f4aOAr4C4jCInD0g1PLlCW1CR0cumcI2ZacVm7dyr2maJVBj1uL79U0k2lAKdKJ sRI+h7Z5kl/uXbDpS8B2lV8J5WUT2d3wlHsoksrOFiukgP/pP4LE6H+3hkTIJzF4gUNN KA4Q== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=OxOvdIZalG4gSGRI6czOi9Td8EmAmnxyaKyO+qiENrE=; b=h7nr+fSwYVXNQzglOGzdiStjaU0BpmT/LUrg+TTU0D7NAB+JYQoHGhk/K0EL+OU+YJ kiuCfTflJ1We5re84R8alLDKwQkufTA8DEc0pBDBEgV56vMAss/ezeb42661yAU1IIuu EXcwTpEi7coXSl+q9o0v3SvtQjGWKY4I7Nj6uOFimEJmVnSxLbQ7ZlZ3zAEp4Yg4D+4g uJTLc10jx+CE9HpgA9HI2Gj26qxBJhzLEdb48KIznZkbGNwjbZJp8IOJYy5ugD6bm8E9 d5c7OYHJzcZeA7ycDJr8mPt0fjgyCH51DrJVdQGk66qJ3Hi0AHa3BKMuLPik54xzQKaz s1lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si11518428ejj.154.2021.07.10.09.58.44; Sat, 10 Jul 2021 09:59:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230317AbhGJRAU (ORCPT + 99 others); Sat, 10 Jul 2021 13:00:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:44514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbhGJRAS (ORCPT ); Sat, 10 Jul 2021 13:00:18 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 63FE561208; Sat, 10 Jul 2021 16:57:30 +0000 (UTC) Date: Sat, 10 Jul 2021 18:00:01 +0100 From: Jonathan Cameron To: Liam Beguin Cc: lars@metafoo.de, Michael.Hennerich@analog.com, charles-antoine.couret@essensium.com, Nuno.Sa@analog.com, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org Subject: Re: [PATCH v2 4/4] dt-bindings: iio: adc: ad7949: add adi,reference-source Message-ID: <20210710180001.051f7367@jic23-huawei> In-Reply-To: <20210709155856.1732245-5-liambeguin@gmail.com> References: <20210709155856.1732245-1-liambeguin@gmail.com> <20210709155856.1732245-5-liambeguin@gmail.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 9 Jul 2021 11:58:56 -0400 Liam Beguin wrote: > From: Liam Beguin > > Add bindings documentation for the adi,reference-source property. > This property is required to properly configure the ADC sample request > based on which reference source should be used for the calculation. Should this be per channel? That will effect some of what I say below... > > Signed-off-by: Liam Beguin > --- > .../bindings/iio/adc/adi,ad7949.yaml | 21 +++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7949.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7949.yaml > index 9b56bd4d5510..eae3121cad01 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7949.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7949.yaml > @@ -35,6 +35,27 @@ properties: > "#io-channel-cells": > const: 1 > > + adi,reference-select: This is one field in the register, but it's not one thing, so lets break it up in DT. We should do this both to make for more readable dts files and to enforce the requirements on regulators... > + description: | > + Select the reference voltage source to use when converting samples. > + Acceptable values are: > + - 0: Internal reference and temperature sensor enabled. > + Vref=2.5V, buffered output > + - 1: Internal reference and temperature sensor enabled. > + Vref=4.096V, buffered output > + - 2: Use external reference, temperature sensor enabled. > + Internal buffer disabled > + - 3: Use external reference, internal buffer and temperature sensor > + enabled. > + - 6: Use external reference, internal buffer and temperature sensor > + disabled. > + - 7: Use external reference, internal buffer enabled. > + Internal reference and temperature sensor disabled. So question 1 is whether to use an external or internal reference. Normally we'd make the coarse decision of whether to use an external reference by whether there is a regulator provided. That won't work so well if we make this per channel. Question 2, assuming internal reference, what voltage? Those should take an actual voltage (probably in mV and match against an enum of the two possible values). Binding should check to make sure this isn't specified as well as saying we are using an external refernce. Question 3, assuming external reference, is temperature sensor enabled? - actually dumb question, but why would anyone not want this enabled? Maybe turn it off in runtime pm, but in general if you've fitted a chip with a temperature sensor you at least sometimes want to measure temperature! So my gut feeling is don't allow this to be controlled (effectively drop cases 6 and 7 above as being unlikely to be of interest to anyone) Question 4, Is the internal buffer enabled when using and external reference. This one is interesting. We could just expose it in general, but I wonder if we can do something that reflects how it is used. From the various figures in the datasheet this seems to be coupled to whether the external reference is on pin REF_IN or pin REF. If that's the case can we have two optional regs only one of which should be supplied? However, this gets more fiddly because the default right now is vref-supply actually being connected to the vrefin connection. That's annoying as it stops us using the obvious naming... Hence I think we can have vref-supply (actually connected to vrefin) and vref-unbuffered-supply > + > + $ref: /schemas/types.yaml#/definitions/uint32 > + enum: [0, 1, 2, 3, 6, 7] > + default: 7 > + > required: > - compatible > - reg