Received: by 2002:a05:7412:361b:b0:f9:2edb:3e4d with SMTP id ie27csp104098rdb; Sun, 17 Dec 2023 17:00:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZWR8Q9ZwL1v0IRdMBrARS8uN3cSab/JF8qP0z6q0D9NfZROKhUsFBSc+yKifQtodhKYnA X-Received: by 2002:a50:858d:0:b0:551:1861:1c47 with SMTP id a13-20020a50858d000000b0055118611c47mr3451594edh.67.1702861259046; Sun, 17 Dec 2023 17:00:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702861259; cv=none; d=google.com; s=arc-20160816; b=KLhNp77A66OuNrgCRIIh1m5LGevD4Xz+nHu4tMX0fI4/zDPpN1BS57gMfp1qEKlgTr 3EpefEoTATtCfFoIKLVJGhE9hD9ol6QcSIx9dMv2sjUCJG5e715KA7vykF1i2hm6YUNr s0NA3fJdW28OJ1KCT81HHkZJ5LjPO0XCRv+oNZpTr0+0lHq5WM1HdgsgZY7zS99QtSpr /QtKFqk5np9Qb5jm5TYDlEyv9RWM+neigypJZhMgRzuM5aWrBCiOuSfN93ILHsLIip+3 8Hfym1RSsCyXXERBISL0zWNbF7TiwvE5wD3Wm68McXzFKOuX4SDMJm6oLZXkyz/+cALv waVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=EYhM54+sMY2tBRKqpDaD5Gx2Jei7oYxE5mh0exAmkgk=; fh=YzbjRSZqB1AlExKEOPDolVI1ikT2jIRENXJZ+hZHDGA=; b=vdsJ9xIh3Z5DMeRBacGZM5flq6QTcK0S1nWPtJlDgOqMx8VtJH5gmwbi/jyNYKba/n bkdgbdtRfueT4vt4BAYGVJkjl4j8tuqYGnph7Brd3HN0GfGWjb6klG8pHGHU3qp0hTYT tSbOPRootXdMSC6RsO98eTYzoZcfIGZ+zmqnr/qZFaNuBKT6aCu/9SiVYt1jupsC3GNC Plpw1uIcHx8Hwy+L8ET15L8/h3R11B/5EWYbAqHJD+6XBp95ZO1dmmUm8P7dFndulOQz wJ4FFAVkO9nSOnCD0nPJk0ibHe9ztEi9BFvq5FXtlIruCB1vgRH4XR0DhGvA3kvrzD6W gNsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=IQO386vW; spf=pass (google.com: domain of linux-kernel+bounces-2895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2895-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v20-20020a50d594000000b0055363af729csi80620edi.230.2023.12.17.17.00.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 17:00:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=IQO386vW; spf=pass (google.com: domain of linux-kernel+bounces-2895-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2895-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5028E1F21B91 for ; Mon, 18 Dec 2023 01:00:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 630C71FDF; Mon, 18 Dec 2023 01:00:48 +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="IQO386vW" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 8061F1FB5 for ; Mon, 18 Dec 2023 01:00:45 +0000 (UTC) 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-lj1-f177.google.com with SMTP id 38308e7fff4ca-2cc5e48779aso12971881fa.2 for ; Sun, 17 Dec 2023 17:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1702861243; x=1703466043; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EYhM54+sMY2tBRKqpDaD5Gx2Jei7oYxE5mh0exAmkgk=; b=IQO386vW6DGGmQQjD2LzYmJJorHBqdMYptvsqfBlulPsSD4whf+Ehh6k4Lz7KR9Ikj MPik2LKqs2gJS1XZi78AjYOoCTUvlqGBEgC0PQhJ6u08OZ3yenbyTOySET7//857oytM uwmSlKRi8wM1pUTEQlaJ0Kl6gCqzXG1YXCE1lf52muJ8kL+Q5prwwLovOQKLQNVOlgbF 0tZ/6w5X1fQFaSUXiSB1XAKK/Y9wiV5UqSH4+VN48PbzO74J3INS8DANQb77oaBSrpui +u+534eXrPUwqJ3QJtiodPWK0732pXF1Qbw37b8nozGWHhPJ0cGEvdxzDMJCu0l5tQju 804A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702861243; x=1703466043; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EYhM54+sMY2tBRKqpDaD5Gx2Jei7oYxE5mh0exAmkgk=; b=wiamdKphqzvG8HfRe1CApY2ppXJDB+2wwTR4f379oVBw0BsrPz8kkvbslndGtsqn0b XqeprvMahEORx89UzJ3MFGYBal9WQocqVS7Oq9ybvbFDQ5yANaPn8N8CkEIJrAB3bkD3 BaWfAGfXdUzfStATLvRn4Wdf3ARtd1qAChCihzXqzNmMZyjhRP6G0hF+aNPOLBpD5PTC t/u6Gtjlo9RaYQG6arpcGo8K/ftn+FwJpH/1fTZXh/PgpuOSMso3UI064N8yJuY5QRTE TS5I7yl/dR2B/hjmQ/Os1oE/CprJI/HgnicUll+zP9R1ojNAMq/hiJMnh9ie6s4Kgetb QEEA== X-Gm-Message-State: AOJu0YyxrQd2SyDRWZbVWHrnXoqESevTZ+BuoI3pR4PnHIycyxSGC+wd GJMyES0RbnO7dASEgjlKkn4GBcmpOiWkndJBl2ioPQ== X-Received: by 2002:a05:651c:2106:b0:2cc:1f36:2abe with SMTP id a6-20020a05651c210600b002cc1f362abemr3032047ljq.92.1702861243536; Sun, 17 Dec 2023 17:00:43 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231212104451.22522-1-mitrutzceclan@gmail.com> <20231217135007.3e5d959a@jic23-huawei> In-Reply-To: <20231217135007.3e5d959a@jic23-huawei> From: David Lechner Date: Sun, 17 Dec 2023 19:00:32 -0600 Message-ID: Subject: Re: [PATCH v8 1/2] dt-bindings: adc: add AD7173 To: Jonathan Cameron Cc: Ceclan Dumitru , linus.walleij@linaro.org, brgl@bgdev.pl, andy@kernel.org, linux-gpio@vger.kernel.org, Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Walle , Andy Shevchenko , Arnd Bergmann , ChiaEn Wu , Niklas Schnelle , =?UTF-8?Q?Leonard_G=C3=B6hrs?= , Mike Looijmans , Haibo Chen , Hugo Villeneuve , Ceclan Dumitru , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Dec 17, 2023 at 7:50=E2=80=AFAM Jonathan Cameron = wrote: > > On Thu, 14 Dec 2023 19:03:28 +0200 > Ceclan Dumitru wrote: > > > On 12/14/23 18:12, David Lechner wrote: > > > On Thu, Dec 14, 2023 at 1:43=E2=80=AFPM Ceclan Dumitru wrote: > > >> On 12/12/23 17:09, David Lechner wrote: > > >>> On Tue, Dec 12, 2023 at 11:45=E2=80=AFAM Dumitru Ceclan wrote: > > > > >> ... > > >> > > >>>> + interrupts: > > >>>> + maxItems: 1 > > >>> > > >>> Shouldn't this be 2? The datasheet says there is a "Data Output Rea= dy" > > >>> signal on the DOUT/RDY pin and an "Error Output" on the SYNC/ERROR > > >>> pin. Although I could see how RDY could be considered part of the S= PI > > >>> bus. In any case, a description explaining what the interrupt is wo= uld > > >>> be useful. > > >>> > > >> > > >> I do not see how there could be 2 interrupts. DOUT/RDY is used as an > > >> interrupt when waiting for a conversion to finalize. > > >> > > >> Sync and Error are sepparate pins, Sync(if enabled) works only as an > > >> input that resets the modulator and the digital filter. > > > > > > I only looked at the AD7172-2 datasheet and pin 15 is labeled > > > SYNC/ERROR. Maybe they are separate pins on other chips? > > > > Yep, sorry, missed that. All other supported models have them separate. > > > > > > > >> > > >> Error can be configured as input, output or ERROR output (OR between= all > > >> internal error sources). > > >> > > >> Would this be alright > > >> interrupts: > > >> > > >> description: Conversion completion interrupt. > > >> Pin is shared with SPI DOUT. > > >> maxItems: 1 > > > > > > Since ERROR is an output, I would expect it to be an interrupt. The > > > RDY output, on the other hand, would be wired to a SPI controller wit= h > > > the SPI_READY feature (I use the Linux flag name here because I'm not > > > aware of a corresponding devicetree flag). So I don't think the RDY > > > signal would be an interrupt. > > > > > > > Error does not have the purpose to be an interrupt. The only interrupt > > used from this chip is the one from the DOUT/~RDY pin. Sure, it is wire= d > > to the SPI controller, but when you can't also receive interrupts on > > that very same CPU pin an issue arises. So that pin is also wired to > > another GPIO with interrupt support. > > You've lost me. It's a pin that has a state change when an error conditi= on > occurs. Why not an interrupt? Doesn't matter that the driver doesn't > use this functionality. dt-bindings should be as comprehensive as possibl= e. > Given it's a multipurpose pin you'd also want to support it as a gpio to = be > complete alongside the other GPIOs. > > > > > This is the same way that ad4130.yaml is written for example (with the > > exception that ad4130 supports configuring where the interrupt is route= d). > > > > In regards to SPI_READY _BITUL(7) /* slave pulls low to pause */: the > > ad_sigma_delta framework (if it can be called that) is written to expec= t > > a pin interrupt, not to use SPI_READY controller feature. > > SPI_READY is supported by only a couple of controllers. I'm not even that > sure exactly how it is defined and whether that lines up with this usecas= e. > From some old asci art. https://lore.kernel.org/all/1456747459-8559-1-git= -send-email-linux@rempel-privat.de/ > > Flow control: Ready Sequence > Master CS |-----1\_______________________| > Slave FC |--------2\____________________| > DATA |-----------3\_________________| > > So you set master and then wait for a flow control pin (the ready signal)= before > you can actually talk to the device. > > Here we are indicating data is ready to be be read out. > > So I don't 'think' SPI_READY applies. > > Jonathan > I'm not arguing that SPI_READY applies in this particular case, but FWIW it does seem to me like... 1) SPI_READY could be implemented in any SPI driver using a GPIO interrupt (similar to how we already have GPIO CS) 2) In cases where the SPI controller does have actual hardware support for SPI_READY and the ADC chip A) uses CS to trigger a conversion and B) has a "busy" signal that goes low when the conversion is complete, then the SPI_READY feature could be used to make reading sample data more efficient by avoiding any CPU intervention between CS assertion and starting the data xfer due to waiting for the conversion to complete either by waiting for an interrupt or sleeping for a fixed amount of time.