Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1490639lqs; Sat, 15 Jun 2024 10:55:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWi3OSxUvGZgjfGiXgznfWy5/VFEg9YTGlA1SP17q8NdiNxf0h0iuXUv7XVSPRIlOciXpu644dq6o3vzvmEFQaUBWRqIVqrntX/OY4c+A== X-Google-Smtp-Source: AGHT+IHJDInMU/nNF8qdauAlPYJicZ4IY7NJQVnKE6hEY5j1g7pmtrU9BvjfJIP6um3s8uTkm4B+ X-Received: by 2002:a05:622a:40d:b0:440:9a86:3181 with SMTP id d75a77b69052e-44216afa394mr65432581cf.37.1718474132369; Sat, 15 Jun 2024 10:55:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718474132; cv=pass; d=google.com; s=arc-20160816; b=CsLeJyf/jfk16AsIMH0uWZlYHYIha1Y/ApdmUHAxYd1dM2oAN332potul52EZymLe5 Sn+NOZyDo4t6fQknH227r1OAXzgz95gUNoKOBWduQr0QGEALfIHlDIMciAK65VtG+1WJ Fewr88akYTBEfG6tlblf4++2C9cMPmbkcw1rlVx/hmiJmbQaXUNkoEhwnxj9/POaigC6 Rc5Y1Ca5mHGpEFmEJk4mtk3sWUO6WPjRbG2TSGF1kYRRRkwnI/nxn5/QBrmHbMfQEIvx vqWm+/5RlYpR0p4dJe4MDnHGaz6FpUkJiGhBLAbkmX+KCvWKPh+eqg+FHl6UX/BnpK4X axKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=nJ4xLs2+TC1rv1Gj1xQ504zyHkKlMDop2k9ZOHA5KkE=; fh=DHqPYj05nXA0yLS3V54ZOX7JoXO2xDJQGp8pXMXICzI=; b=RJ8x/N7w6YkmSum6gNFN+L8HPLzroaJe1JWUc2T6nildCk6i07SpXDudtC8L+qbxm0 Lj0db9qjLnQxn7nD5+Xa6KphIOL3886sTh6EJolI/B9VHjUTZ2Ne8JThCq4xaqFGcD6d h3oFWamPZvLjkuV/4e9L4NrnBvifbPsA+uLAczvUbewDIRRBg+ZlKFxELXb9FuPwS81P h2gF94kN+EZWf2Y8NOwJJ6puBGvQ2c0xUP95HmXCsu5MtwneyYGi8Krw+07cUrVatMz7 YoSuLMwU+CBeVyfIizU+WiWN+wsXFdbt+CzK85biW7MTW0XCgVLzjs10Tp1TGmevExbU p7Og==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GqxzWzhh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215974-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215974-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-4420f3d3099si66821061cf.224.2024.06.15.10.55.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 10:55:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215974-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GqxzWzhh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215974-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215974-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0948E1C20E83 for ; Sat, 15 Jun 2024 17:55:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 204285381E; Sat, 15 Jun 2024 17:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GqxzWzhh" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33DD04AECE; Sat, 15 Jun 2024 17:55:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718474124; cv=none; b=qWEwgd+JwTe4TIzA/K95KW0F5p5FYF7KsX6IZeWC1I2nH05cMi1mA4j7T6Fz/rHRrmcWq/JyYBNcfbJGhXyTgmmbJaLVmd9cgTRIvr1bzZZPEgUnzEvPdJSpf5OKHDshjUZbJL3ys0D207pkDcDk8xfNhe7lLttIxfO2DWjbaiQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718474124; c=relaxed/simple; bh=YZDyQV5KHWh5QtJ2JUl+NV+uqA9/jKP/Y9UoVxDbkxU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fPmNr4iofCf5r9r4xmDaOxChOPJljptMMBxmJKIFk5XEma75JVnfeSsTFLoBr0OE4k+NGY6jtsh9DYtrLHUvn2cK/ebvdHTuC95I8iYg9QL+50eOZmj/vX7yYyBJwa7dj3UDeIl548+K+zsdaP05SoMdJkH652sRhcYnn8A8MLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GqxzWzhh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0242C116B1; Sat, 15 Jun 2024 17:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718474124; bh=YZDyQV5KHWh5QtJ2JUl+NV+uqA9/jKP/Y9UoVxDbkxU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GqxzWzhhunrVgA1lBhPJKkDRUXevtpMtbS0Hu9iBpJPR+NL0bsrVkKUJxNkBaJsMU AgcZ3zk4kqwd6IuqjYdpLg0w8hw+hqWeFwLDJAoVSrZM/SMfsyC6zIqRJjRavgsT8u +3pVzJFFO2CmsSfYEiCIFKVD4ossdvkeP95WiS/XO7R6khWqHoOLO1IVJTxaeWv0IM QAHsn18E6Rizi0eUqC/3xHysrovX8KPTDk1nqeTO0Kw9rJ8VSXd/Fx9vxEIDqBX+S+ aPHDhNPR/YYt2WEacAmRhxnKpCVdhL3aR+swtAATEBiCP8wboAsZnCtGN+41yO9vQl p5LV2fpXTAxAg== Date: Sat, 15 Jun 2024 18:55:16 +0100 From: Jonathan Cameron To: David Lechner Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Hennerich , Nuno =?UTF-8?B?U8Oh?= , Jonathan Corbet , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH 1/3] dt-bindings: iio: adc: add AD4695 and similar ADCs Message-ID: <20240615185516.61346425@jic23-huawei> In-Reply-To: <2d9a1405-4b8d-401b-99c4-434ac4b57f6e@baylibre.com> References: <20240612-iio-adc-ad4695-v1-0-6a4ed251fc86@baylibre.com> <20240612-iio-adc-ad4695-v1-1-6a4ed251fc86@baylibre.com> <20240615134106.40e55e16@jic23-huawei> <2d9a1405-4b8d-401b-99c4-434ac4b57f6e@baylibre.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-pc-linux-gnu) 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=US-ASCII Content-Transfer-Encoding: 7bit > >> + > >> + adi,pin-pairing: > >> + description: | > >> + The input pin pairing for the negative input. This can be: > >> + - REFGND, normally 0V (single-ended) > >> + - COM, normally V_REF/2, see com-supply (pseudo-differential) > >> + - For even numbered pins, the next odd numbered pin (differential) > >> + $ref: /schemas/types.yaml#/definitions/string > >> + enum: [refgnd, com, next] > > > > Next is full on differential, just provide both channels via > > diff-channels. You can constrain the particular combinations in the binding. > > > > Refcnd is normal single ended. Probably want to use the new single-channel > > property for that as we are mixing differential and single ended channels > > so reg is pretty much just an index. > > > > Hmm. For comm we haven't had done a recent binding for a chip with the option > > of pseudo differential that is per channel, they've been whole device only. > > That feels like it will be common enough we need to support it cleanly > > with a 'general' scheme. > > I think we have. :-) > > https://lore.kernel.org/linux-iio/adc6cba9-2e79-475f-9c24-039fe9d3345d@baylibre.com/T/#mcbc1ce3a2541db502bf7870b7ea8574626a46312 > My goldfish like memory strikes again. Had completely forgotten that :) > > > > Problem is I know someone will have a chip with 2 vincom pins and selecting > > between them, so we can't just have pseudo-differential as a boolean and adc.yaml > > > > There are horrible solutions like a magic channel number that changes the > > meaning of diff-channels but that's ugly. > > Maybe pseudo-differential for now and we have to later we add > > pseudo-differential-comm = <0> etc? > > > > I was trying to keep things simple with 1 property instead of 3, but we > can drop adi,pin-pairing and use the standard diff-channels, single-channel > and common-mode-channel properties. Sounds good. > > >> +examples: > >> + - | > >> + #include > >> + > >> + spi { > >> + #address-cells = <1>; > >> + #size-cells = <0>; > >> + > >> + adc@0 { > >> + compatible = "adi,ad4695"; > >> + reg = <0>; > >> + spi-cpol; > >> + spi-cpha; > >> + spi-max-frequency = <80000000>; > >> + avdd-supply = <&supply_2_5V>; > >> + vdd-supply = <&supply_1_8V>; > >> + vio-supply = <&supply_1_2V>; > >> + ref-supply = <&supply_5V>; > >> + reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>; > >> + > >> + #address-cells = <1>; > >> + #size-cells = <0>; > >> + > > Using the standard adc.yaml properties, these would now be: > > >> + /* Differential channel between IN0 and IN1. */ > >> + channel@0 { > >> + reg = <0>; > > diff-channels = <0>, <1>; > > >> + bipolar; > >> + }; > >> + > >> + /* Single-ended channel between IN2 and REFGND. */ > >> + channel@2 { > >> + reg = <2>; > > single-channel = <2>; > common-mode-channel = <0>; I wonder if we count ground ad default and so don't necessarily specify this? I don't really mind either way though. Maybe just default to 0 works. > > >> + }; > >> + > >> + /* Pseudo-differential channel between IN3 and COM. */ > >> + channel@f { > >> + reg = <3>; > > single-channel = <3>; > common-mode-channel = <1>; > > >> + bipolar; > >> + }; > >> + }; > >> + }; > > > > And I will add a header file with macros for the common mode > channel values. Great Jonathan >