Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp637555rwd; Wed, 31 May 2023 03:21:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+y97RnMPGaRZkeAdxWhhe1d2OxqGLoigMLXiixMaKGC4HnYL5AEvDCfCGG4yvxnkKRVoT X-Received: by 2002:a05:6e02:5cf:b0:33b:1da8:a7d0 with SMTP id l15-20020a056e0205cf00b0033b1da8a7d0mr1891711ils.29.1685528517670; Wed, 31 May 2023 03:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685528517; cv=none; d=google.com; s=arc-20160816; b=LNsWmGV9my1hYujI/nZ109cEK/BypD+u2+LzSRO9LuZohC0pdGBahx/iJ8eP3NdFC2 AXNecsCPQhSBCxtgoAjlY0+mAZEW0NOWN0GqHIbFR8A8q+iU7MTk0X2oDBORhfIOAn9b VLkj4E3alyJgwKmLDYr7d3WShZ9ezIvB3mxaiKk9FQtip+nDQpJRqMHqPOugXyrhpB1x MD7mkTTtnHhN3Dr2A3uq4X7E+YbET0asE/clcTlK+L541tnCrLAjiyMTJey5bnU2Bgz9 DRoz8juqd37Y9Qux5lKw0/2w4Esx6EMtaIdReYlG7iUX4tSooYvUyRNEFG/Yan9yZbEV G42Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=coRLi+/G9QXU7tHORbRmPyNXE20ZC1wU2n0kAm+p0Xw=; b=ghkzPotbuCbeALnKYZnnNFLtT1C6ueamR9M9182jklzWezQhDuvgFn8M0cSTiGCR3k FICqooujArQdsmsz6/t0kxE4BU3jSDS4IG2+iF1mcVKfs6LJSKHFCywESxSsRmxdsaCe UmB2al7FmvUPmVVQ5S41PdsbPqFBHQfpet4DpEpAqrD/FxFRmAS++/JA7eu/OmTHskRS CeWrtP8jzdaFBstOFRGoZOpFs3Ts+ECJ+hq5ct5/XXkYfIqJ6wSbbeQIjX1eLALHOocA vKGihvCdNAc7mQwEx6Y6E3OLP+mGtEl9H1qyb68V/DetKBbJykVbc2FO3Znu6E3M2bqE FOXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=fwAkPCxk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020a170902b71600b001afcbb10856si628663pls.394.2023.05.31.03.21.45; Wed, 31 May 2023 03:21:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=fwAkPCxk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235589AbjEaJkj (ORCPT + 99 others); Wed, 31 May 2023 05:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235269AbjEaJkZ (ORCPT ); Wed, 31 May 2023 05:40:25 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA04180; Wed, 31 May 2023 02:40:20 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-38c35975545so3890078b6e.1; Wed, 31 May 2023 02:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685526020; x=1688118020; 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=coRLi+/G9QXU7tHORbRmPyNXE20ZC1wU2n0kAm+p0Xw=; b=fwAkPCxk6TUTIfTN/rW/VQD4jk+gsrwkPxDqK75unzLWd7TRfSVDbyO0kH/BeYyBMg ejbJViWddFZQ+GqkjBLvqw66Je0wYyF/8kj5uX4Cp4EigPcdBS49DLQPxxsatonqyi4w KnSgR6olMfJTC+TgLUoy5WoSqWuekFM+XJ/lH3Sio8Wp5L8jBHnXtyXecFFce3a0bK9/ TQCKuC59pEvfd6Swi/5DxDBG+UnVTEZZsN7sHVLrp80VTuEzP6oer4iq5Npsqsa+QRmE oTdPc05sOWzTlkHIXhaUDnAQw5iZyioYJRAZDT5qVU/ITQMVc9pe5XwY5+TLasuNsuNr w0WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685526020; x=1688118020; 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=coRLi+/G9QXU7tHORbRmPyNXE20ZC1wU2n0kAm+p0Xw=; b=ReEuP8cU+uxNUpN0ZxnptJTcKRQwsl2drJZSdnhnGL20qzHaHIDvH1082lrC2mRMoX 1F7OTYtCZwBuC8EjuKeiOiPSI3QJZfA02rOWq1M2VkAfHosozZYUt8STvt+2dYbJDfMV J73jMLwWyBeZ162+xt8GDtzAh31lLxkOpjs/eCzVbEcrFVgyQ8+5Bjg4bfbBZm2XZFhN qyY621uzxbcnGYrx4w73udacP2ZmHH0xhwKkAMO0zE53Furbu+MjxrOCPQ4dRFEv+eri gqiLLlcTG6DWKkhg5dKltRTuLl6HgRu83HTJsev/MCDpH+77PjREIdQGzFgMWTRUOEBZ rNnA== X-Gm-Message-State: AC+VfDxfZ8TlBmx6VDtjObaUgO9uzSyXtWbVE76a8HOIvsP6lr5VXQ2s R1kS4lEFOBD1cvq11pGNqb8yg2164+fafWxvd1E= X-Received: by 2002:a05:6808:1142:b0:399:b92:1180 with SMTP id u2-20020a056808114200b003990b921180mr3913395oiu.23.1685526020084; Wed, 31 May 2023 02:40:20 -0700 (PDT) MIME-Version: 1.0 References: <20230530075311.400686-1-fl.scratchpad@gmail.com> <20230530075311.400686-6-fl.scratchpad@gmail.com> <20230530-cannabis-headstone-883c5b891dd3@spud> <5d65b644-9b79-d232-d0d0-d2772325eef5@linaro.org> In-Reply-To: <5d65b644-9b79-d232-d0d0-d2772325eef5@linaro.org> From: Fabrizio Lamarque Date: Wed, 31 May 2023 11:40:08 +0200 Message-ID: Subject: Re: [PATCH v3 5/5] dt-bindings: iio: ad7192: Allow selection of clock modes To: Krzysztof Kozlowski Cc: Conor Dooley , jic23@kernel.org, Lars-Peter Clausen , Michael Hennerich , Alexandru Tachici , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 31, 2023 at 9:14=E2=80=AFAM Krzysztof Kozlowski wrote: > > On 31/05/2023 08:59, Fabrizio Lamarque wrote: > > On Tue, May 30, 2023 at 7:22=E2=80=AFPM Conor Dooley = wrote: > >> > >> On Tue, May 30, 2023 at 09:53:11AM +0200, fl.scratchpad@gmail.com wrot= e: > >>> From: Fabrizio Lamarque > >>> > >>> AD7192 supports external clock sources, generated by a digital clock > >>> source or a crystal oscillator, or internally generated clock option > >>> without external components. > >>> > >>> Describe choice between internal and external clock, crystal or exter= nal > >>> oscillator, and internal clock output enable. > >>> > >>> Signed-off-by: Fabrizio Lamarque > >>> --- > >>> .../bindings/iio/adc/adi,ad7192.yaml | 27 ++++++++++++++++-= -- > >>> 1 file changed, 24 insertions(+), 3 deletions(-) > >>> > >>> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yam= l b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml > >>> index 16def2985ab4..f7ecfd65ad80 100644 > >>> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml > >>> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml > >>> @@ -32,7 +32,8 @@ properties: > >>> > >>> clocks: > >>> maxItems: 1 > >>> - description: phandle to the master clock (mclk) > >>> + description: | > >>> + Master clock (mclk). If not set, internal clock is used. > >>> > >>> clock-names: > >>> items: > >>> @@ -50,6 +51,17 @@ properties: > >>> vref-supply: > >>> description: VRef voltage supply > >>> > >>> + adi,clock-xtal: > >>> + description: | > >>> + Select whether an external crystal oscillator or an external > >>> + clock is applied as master (mclk) clock. > >>> + type: boolean > >> > >> Am I being daft, or are these the same thing? If they are not, and use > >> different input pins, I think it should be explained as it not clear. > >> Could you explain why we actually care that the source is a xtal versu= s > >> it being mclk, and why just having master clock is not sufficient? > > > > I may revise the description as follows. Feel free to add your suggesti= ons > > in case it is still not clear enough. > > > > "Select whether an external crystal oscillator between MCLK1 and MCLK2 = or > > an external CMOS-compatible clock on MCLK2 is used as master clock". > > > > This is used to properly set CLK0 and CLK1 bits in the MODE register. > > I guess most applications would use an external crystal or internal clo= ck. > > The external digital clock would allow synchronization of multiple ADCs= , > > Description confuses me. Why would it matter what type of clock you have > as input - external crystal oscillator or external CMOS-compatible > clock? Later you refer to "internal", so maybe you meant here also > internal for one of the options? The AD7192 needs to be configured according to the type of external clock that is applied on MCLK1/MCLK2 pins in order to activate the correct circuitry. Here are some citations from the datasheet: MCLK2 pin description: "The AD7192 has an internal 4.92 MHz clock. This internal clock can be made available on the MCLK2 pin. The clock for the AD7192 can be provided externally also in the form of a crystal or external clock. A crystal can be tied across the MCLK1 and MCLK2 pins. Alternatively, the MCLK2 pin can be driven with a CMOS-compatible clock and= the MCLK1 pin left unconnected." Each of these clock modes have to be configured via AD7192 mode register. (Clock source configuration bits, mode register, CLK0 and CLK1). Here is their description from datasheet: "Either the on-chip 4.92 MHz clock or an external clock can be used. The ability to use an external clock allows several AD7192 devices to be synchronized. Als= o, 50 Hz/60 Hz rejection is improved when an accurate external clock drives the AD7192." The choice between internal clock, external crystal oscillator or external CMOS digital clock is a decision of the HW designer driven by noise rejection, synchronization, and cost requirements. If possible, I kindly ask you suggestions on how to adjust the description so that it would be cleaner. > > > > >> > >>> + adi,int-clock-output-enable: > >>> + description: | > >>> + When internal clock is selected, this bit enables clock out pi= n. > >>> + type: boolean > >> > >> And this one makes you a clock provider, so the devices advocate > >> position would be that you know that this bit should be set if > >> "clocks" is not present and a consumer requests a clock. > >> I don't seem to have got the driver patches (at least not in this > >> mailbox), so I have got no information on how you've actually implemen= ted > >> this. > > > > I see... When this bit is set, the AD7192 node should also be a clock p= rovider. > > The clock is output on MCLK2 pin, hence it can be used with internally > > generated clock only. > > I tend to dislike the idea of a "conditional clock provider". Also, I'd= guess > > Either this is a clock provider via common clock framework or is not. > Don't re-implement clock provider via other properties but just skip > such feature. Ok, I understand. I will remove the bit from the patch in V4. Thank you. The bit was already existing upstream in the driver, but I would just drop the change in documentation without any additional patch that removes it from the driver. Best regards, Fabrizio Lamarque