Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1131650rdb; Fri, 16 Feb 2024 06:23:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWAMuw4qWVP3LVCu30u/rDQkxjaFWDwIPjnEA0xIwGdBfSPTdKPzPyaEReEQI6u5J3KxSgUqsWbPdtAMJ1U36ohZktMUIhdm4pgritoOQ== X-Google-Smtp-Source: AGHT+IHCJFuqVTWRDpLzBnn7vihWT4fwPIAaB73u06wrEa72hgjq9fZ2ZBJurNPmPAK3O6y56BmD X-Received: by 2002:a17:903:11c9:b0:1db:509a:5a31 with SMTP id q9-20020a17090311c900b001db509a5a31mr5625431plh.26.1708093422105; Fri, 16 Feb 2024 06:23:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708093422; cv=pass; d=google.com; s=arc-20160816; b=dHctJYd7WsCajlqa1VxA5DKzd1do8zho75fVYmGro+BTWafdfM/QGdlDYkPha1N54E y5srLnCAS0hYBq409zEC8jetkA8Mn2V75E4sdagZEfXELo90n6DLpJwz+CAY5gMXL8fj fCoFT33MRTrZmnVigi45TZ0mSxRNaEla+KcGi/juYv+/AvXcPFJWH9h4UDBx4UHKPPLJ Lp8+FdmWWKyfmI94URXHabBgrEBsgbDLW2iD+WYHWO1QX/KLeTADx8Q0No/s/1H8PfK5 HOB+SFlI1gADJ/bR/BNcwr+LlUAlo0ca/VoS0t6RwAYQKUTAnjqZf53zd/JAZ/2i6mQ8 JWMw== 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=cr69y+g1jUQpOEsxq63S75snib37db35LTqXL/G3BDk=; fh=xdImkisiyvzIeY42UOgACwgCesFEHLBwQiJoBqrWgS0=; b=j3f6U0rVqlne7AXSIZ9Q7QG3hjt0jTXu4t3s75M0mGi1b7LMGSxAm4UEoaN+k2upDX VizjsNMNVTAQTYHGSrNIppmXTMWYc81tjOH9KKtxI3G/8MWCW2txI9cpOBJgGJzd7QnQ /KhC902LGR541ki6+nHlcKZw9OzA8R7BITOnebIDFQjz/00GQN0eL3/XHIkGcV0Z8sKQ ZyFCPi0KICq75CEn7r2JWrZvTY01GJuSFKUMLNxLH8fmhINJAIw/SUtOHfpROVuBfE+d /g2MWHE3ZMWujZKIzMFV6Jc+GTXcpLpLAkAeoDmGEEMGDw9kDs3DX0Q9Qm3xJQu1ApBs qNJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TemEtxZv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68706-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a7-20020a170902b58700b001db70a99e90si3057603pls.430.2024.02.16.06.23.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 06:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TemEtxZv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68706-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 583A9B25F7A for ; Fri, 16 Feb 2024 14:08:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11F0E12C7F6; Fri, 16 Feb 2024 14:08:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TemEtxZv" 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 21CE959B5F; Fri, 16 Feb 2024 14:08:38 +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=1708092519; cv=none; b=cdwhpkZuYRatqSRMhFjzxwUKrGUKADNhgxZ5lNjc+OQtAYBZ8FpsH3EuWysCgnxDWV5N+DAAGMMVaSP7ZL16ZNKAgwA1MzGmA0od4N2ng1Lqb6/8+XH5QF23npOTEMWWFmLJILIY6dsVwsZrKm8TMgVWu9bB5gPFbEY1b+QCP3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708092519; c=relaxed/simple; bh=URft1yFNooeHjgEuV5zJYSSsgebVw7/oaikTAzwc7HY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fzDJe8gzJBdWxantCJJFbvqNNAUQnLAxr3F5g0eZUIJQaNW5Ycj7EoRuidv8cL81tnJBU0crkKZ/+bAk1aFTbNofrV9IrqE3LXb0Q+oe4hQ97ztQQMQ/kdy01e1Y2sU44N4gTjFOo8cq2ScDF0yMPMCly8Xten53y6FQhca60z4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TemEtxZv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54A7CC433F1; Fri, 16 Feb 2024 14:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708092518; bh=URft1yFNooeHjgEuV5zJYSSsgebVw7/oaikTAzwc7HY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TemEtxZvXL3MtNaqtsE44bHlpFma7OYlRBd7d9HhpQx5e5uUjFuec2rr/BPGaoA9b qKXRUN1VIJlE6UV6N7Vg1HduKnWyHxBliIiw4js/LhN2C+p9mRd8zVSXOMyzH8uTs7 kpuCoCP4a6qBIq6fvj+6OHq6Tori37riWp2JYLyXxO4CJT/uT0V44SYy6nDRMWNBOE YWrRYVOXsw9lxHEZIImnFdXSlf6XnMDCPguDceCO31PiMwFud7OXqqG80CIv3Rmi2U NndgxRpehHGvOMjozYXlP6JIhVGEpoFlE3Xifi9ix+QXgNAyLzecSNPWvXLWHiYR/i oy1DHzBsMpbhg== Date: Fri, 16 Feb 2024 14:08:26 +0000 From: Jonathan Cameron To: David Lechner Cc: linux-iio@vger.kernel.org, Michael Hennerich , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nuno =?UTF-8?B?U8Oh?= , Liam Girdwood , Mark Brown , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] dt-bindings: iio: adc: add ad7944 ADCs Message-ID: <20240216140826.58b3318d@jic23-huawei> In-Reply-To: References: <20240206-ad7944-mainline-v1-0-bf115fa9474f@baylibre.com> <20240206-ad7944-mainline-v1-1-bf115fa9474f@baylibre.com> <20240210174022.7a0c7cdc@jic23-huawei> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; 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,spi-mode: > > > + $ref: /schemas/types.yaml#/definitions/string > > > + enum: [ 3-wire, 4-wire, chain ] > > > + default: 4-wire > > > + description: > > > + This chip can operate in a 3-wire mode where SDI is tied to VIO, a 4-wire > > > + mode where SDI acts as the CS line, or a chain mode where SDI of one chip > > > + is tied to the SDO of the next chip in the chain and the SDI of the last > > > + chip in the chain is tied to GND. > > > > there is a standard property in spi-controller.yaml for 3-wire. Does that cover > > the selection between 3-wire and 4-wire here? Seems like this might behave > > differently from that (and so perhaps we shouldn't use 3-wire as the description > > to avoid confusion, normally 3-wire is a half duplex link I think). > > I used "3-wire" because that is what the datasheet calls it. But yes, > I see the potential for confusion here since this "3-wire" is > completely unrelated to the standard "spi-3wire" property. Maybe we fall back on a comment that says something like. "This is not the same as spi-3wire." :) Whatever we end up with here, I'd like everyone to agree it's obviously different enough from existing SPI bindings that there won't be any confusion. > > > > > Chain mode is more fun. We've had that before and I'm trying to remember what > > the bindings look like. Devices like ad7280a do a different form of chaining. > > If there isn't a clear precedent for how to write bindings for chained > devices, this may be something better left for when there is an actual > use case to be sure we get it right. Agreed. Let us kick that into the future. > > > > > Anyhow, main thing here is we need to be careful that the terms don't overlap > > with other possible interpretations. > > > > I think what this really means is: > > > > 3-wire - no chip select, exclusive use of the SPI bus (yuk) > > This can actually be done two ways. One where there is no CS and we > use cnv-gpios to control the conversion. The other is where CS of the > SPI controller is connected to the CNV pin on the ADC and cnv-gpios is > omitted. This requires very creative use of spi xfers to get the right > signal but does work. > > In any case to achieve max sample rate these chips need to use this > "3-wire" mode and have exclusive use of the bus whether is is using > proper CS or not. > > So maybe it would be more clear to split this one into two modes? > 3-wire with CS and 3-wire without CS? OK. I'm not sure if the standard SPI bindings have an option for CS tied active? If so we should reuse that bit of [psson;e/ > > > 4-write - conventional SPI with CS > > Yes. > > > chained - the 3 wire mode really but with some timing effects? > > Correct. With the exception that the SPI CS line can't be used in > chain mode (unless maybe if you had an inverted CS signal since the > CNV pin has to be high during the data transfer). > > > > > Can we figure out if chained is going on at runtime? > > No. We would always need the devicetree to at least say how many chips > are in the chain. Also, in theory, each chip could have independent > supplies and therefore different reference voltages. That's one I think we only bother supporting when we actually see it. For previous chained devices I don't think we've ever needed to do it because they tend to be used for 'more of the same' rather than measuring different things. Supplies so far have always been wired to single regulator (or single control anyway). > > > > If we are going to rule you supplying refin and ref supplies. > > Not sure what you mean here, but we can get rid of the adi,reference > property and just add a check to not allow both ref-supply and > refin-supply at the same time. I think that is simplest route. > > > > > > + > > > + cnv-gpios: > > > + description: > > > + The Convert Input (CNV). This input has multiple functions. It initiates > > > + the conversions and selects the SPI mode of the device (chain or CS). In > > > + 3-wire mode, this property is omitted if the CNV pin is connected to the > > > + CS line of the SPI controller. > > > + maxItems: 1 > > > > ah, that's exciting - so in 3-wire mode, we basically put the CS on a different pin... > > I explained this above already, but just to have it in context here as > well... In what the datasheet calls "3-wire" mode, we can either have > CS connected and no cnv-gpios or we can have no CS and have cnv-gpios > connected. > > So the intention here was to make cnv-gpios required all other modes > but in 3-wire mode, make it optional. Seems reasonable. Thanks for the various explanations. This chip is just odd :) > > > > > > Mark, perhaps you can suggest how to handle this complex family of spi variants? > > > > Jonathan > >