Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp213468pxv; Wed, 14 Jul 2021 02:13:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWVR6wxGSFXFIZt8PdY60Jc3VftUxtdjWP0Kyr65XNBcfWszWSgVSjUcll0/X5mEtzApOs X-Received: by 2002:a05:6638:1915:: with SMTP id p21mr2436170jal.104.1626253991597; Wed, 14 Jul 2021 02:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626253991; cv=none; d=google.com; s=arc-20160816; b=YF8F8F35toA6WH4H6To7KOKzFKsrLnKwAfvs9LKo4/rMqbpRYE/YiLZ6GRSvvTR8EX Ov2JXjWTAndxMa1e+ynnEFp1LR0ufKhcezRrhKW57KIZRr+KXVAau9xv2BYMTi6rKudK nLt5g89UvIZs70n/+y0VmpAnVz6iz/JKyQ1qKcM8z9n1qwXJDPaR17O9k96tYDTHO2rS nFaiHsKMjNMrYX5ycq4v3KqX2vu5AUTT/Kerzz6Dol96I8V7IcvTEG+2MGlyCMWrOxsZ bF6yCVH7qa5FOzC5/CGOCYQfdvxKS0OOQ16mNKEX4sMkxjTiYcnWPdRXTlLoThAGsdq5 6skQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6bVeuBZ+uHS+T9NWs1tv6fdQJ/mndrZqGXpNYSa9tmk=; b=0+tZitAq3QIQS87W6KD/FRoauPQx2xRv2Ocq0pWooa3IsAroUravZQMB5H+n6oR6AW 1/Oi8umPFCY7TwvyGFNPWW8+XkZvDAzu2A60cZNn5N6fbvgk0O5ZpzTS9FRDVRyG3szS 6Mwfv+Nrtoh7bzhtr+aCyPWYUnADWBMdxg1LFC9LhOUtH7YdA3AF0SrnYq6hlbcl9CQ2 +zvByN30o3msEsw6xxf5Tsf0nFbwBXBCWVPHE16kx3LLBfhkHP4eoLetnXYC7HneehhT 8SSsGhvPiM60KPE4VAmGhO6ocGPitWTs3DZGkcD0y+Hf/vj4vImmdPSKf619NNVixxcL pg0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uVcvspPX; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si1869581jak.34.2021.07.14.02.12.56; Wed, 14 Jul 2021 02:13:11 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uVcvspPX; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238167AbhGNJPK (ORCPT + 99 others); Wed, 14 Jul 2021 05:15:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238123AbhGNJPI (ORCPT ); Wed, 14 Jul 2021 05:15:08 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F7C3C06175F; Wed, 14 Jul 2021 02:12:16 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id t186so2083596ybf.2; Wed, 14 Jul 2021 02:12:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6bVeuBZ+uHS+T9NWs1tv6fdQJ/mndrZqGXpNYSa9tmk=; b=uVcvspPXg73FKHPV9TYzvChNQGmZdqkTUJgyeDrzILGhINZ2zyxU65hRwI9qO76s4G j75r9wJZ+qaH1qMcFCqxnFD8lRU3BAFjkhbvydLx9rpwQ5sgVWd6QD3z17LeCYhsGVI5 sDfW0eK0STu5/UN4UouEIXKTAWWdHvm4+2KVHnQ6akyDBvwyaReYJLKZAxPqWhDGhJ2n GbXaQgqwHUFpwKhhw6Y5aFmMp8o8x1xORN/ZmT7TcxnUm5FX0ijS5uQlIaNkP0446w/l rJCLwCwK+wbdnF7zli5Maj6sVvDQNWoI2NhnYQab76bZjBmHI5qwCpXRI4YTNgYvV5Hm uuxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6bVeuBZ+uHS+T9NWs1tv6fdQJ/mndrZqGXpNYSa9tmk=; b=KAWtKueBWvX6pQQmt0Oz0x+4FUlizotAt1/boisvs4x1MVBR/GQsyQ4ymmDY7fPxHR dLE5qTvjrM+ioA2gGiKRD77MQgHN8VioXJXuMHFI1m5gLhNln3XbOhtoNq2kAacf2LZP hGY1v0iIqO6N2MRHvxOtpJymX9EOIYQubksuak8Ln8gi6i80egPKHICcO9x7oWKTbxeU 6HnKHz0vs9fb7Cd2O1Y0MNWtGMt8hbJxc7GCyk4XjocjA3MuxJAJbb0rv70CW3kd2G8+ dobqCQa1ZZIySLPhMmKjPllWYclmjhWsOLpRDqTP0WwbdFMfU3f1GykFbKiU9vrPm/u2 cOqw== X-Gm-Message-State: AOAM532rxsutpkjxy3YUuPzRjhP67X+FOtUlOIYQCzcXDi1ryNVd2+Ir 0dyv8YtSWkv9+9S2n4CPEI5vJrzfbC4asuJZbT8= X-Received: by 2002:a25:7e86:: with SMTP id z128mr11955572ybc.222.1626253935652; Wed, 14 Jul 2021 02:12:15 -0700 (PDT) MIME-Version: 1.0 References: <20210629220328.13366-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20210629220328.13366-2-prabhakar.mahadev-lad.rj@bp.renesas.com> <20210703181937.510ec0fa@jic23-huawei> In-Reply-To: <20210703181937.510ec0fa@jic23-huawei> From: "Lad, Prabhakar" Date: Wed, 14 Jul 2021 10:11:49 +0100 Message-ID: Subject: Re: [PATCH 1/2] dt-bindings: iio: adc: Add binding documentation for Renesas RZ/G2L A/D converter To: Jonathan Cameron Cc: Lad Prabhakar , Geert Uytterhoeven , Rob Herring , Lars-Peter Clausen , Philipp Zabel , linux-iio@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , Linux-Renesas , Biju Das Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jonathan, Thank you for the review. On Sat, Jul 3, 2021 at 6:17 PM Jonathan Cameron wrote: > > On Tue, 29 Jun 2021 23:03:27 +0100 > Lad Prabhakar wrote: > > > Add binding documentation for Renesas RZ/G2L A/D converter block. > > > > Signed-off-by: Lad Prabhakar > > Reviewed-by: Biju Das > Hi, > > See inline > > Jonathan > > > --- > > .../bindings/iio/adc/renesas,rzg2l-adc.yaml | 121 ++++++++++++++++++ > > 1 file changed, 121 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml > > new file mode 100644 > > index 000000000000..db935d6d59eb > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml > > @@ -0,0 +1,121 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/iio/adc/renesas,rzg2l-adc.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Renesas RZ/G2L ADC > > + > > +maintainers: > > + - Lad Prabhakar > > + > > +description: | > > + A/D Converter block is a successive approximation analog-to-digital converter > > + with a 12-bit accuracy. Up to eight analog input channels can be selected. > > + Conversions can be performed in single or repeat mode. Result of the ADC is > > + stored in a 32-bit data register corresponding to each channel. > > + > > +properties: > > + compatible: > > + oneOf: > > + - items: > > + - enum: > > + - renesas,r9a07g044-adc # RZ/G2{L,LC} > > + - const: renesas,rzg2l-adc > > + > > + reg: > > + maxItems: 1 > > + > > + interrupts: > > + maxItems: 1 > > + > > + clocks: > > + items: > > + - description: converter clock > > + - description: peripheral clock > > + > > + clock-names: > > + items: > > + - const: adclk > > + - const: pclk > > + > > + power-domains: > > + maxItems: 1 > > + > > + resets: > > + maxItems: 2 > > + > > + reset-names: > > + items: > > + - const: presetn > > + - const: adrst-n > > + > > + renesas-rzg2l,adc-trigger-mode: > > + $ref: /schemas/types.yaml#/definitions/uint8 > > + description: Trigger mode for A/D converter > > + enum: > > + - 0 # Software trigger mode (Defaults) > > + - 1 # Asynchronous trigger using ADC_TRG trigger input pin > > + - 2 # Synchronous trigger (Trigger from MTU3a/GPT) > > Is this a function of the board in some fashion? If not it sounds like > something that should be in control of userspace. Normally we'd > do that by having the driver register some iio_triggers and depending > on which one is selected do the equivalent of what you have here. > Agreed for Asynchronous and Synchronous triggers. WRT Software trigger should this be registered as a iio_triggers too or read_raw() callback (with IIO_CHAN_INFO_RAW case) should be treated as Software trigger? > > + default: 0 > > + > > + gpios: > > + description: > > + ADC_TRG trigger input pin > > + maxItems: 1 > Why is this mode useful? I'm assuming the gpio write would take a register > write and the software trigger mode also requires a register write. > Yes gpio write would take a register write. > Normally the reason for a pin like this is to support synchronising with > external hardware. If that's the case, we should call that out here. > often the pin isn't even connected to a gpio in our control. > (i.e. it's a trigger signal from some other device.) > So just setting the GPIO pin as input should do the trick. > > + > > + renesas-rzg2l,adc-channels: > > + $ref: /schemas/types.yaml#/definitions/uint8-array > > + description: Input channels available on platform > > + uniqueItems: true > > + minItems: 1 > > + maxItems: 8 > > + items: > > + enum: [0, 1, 2, 3, 4, 5, 6, 7] > > Is this a function of different devices (should have different compatibles) > or of what is wired up. If it's what is wired up, then how do you know which Its channels which are wired, for example if channels 0-5 are wired up the board dts would include the property "renesas-rzg2l,adc-channels = /bits/ 8 <0 1 2 3 4 5>;" > subset of channels are connected? We have the generic adc channel binding > in iio/adc/adc.yaml for the case where we only want to expose those channels > that are wired up. It uses a node per channel. > Agreed will do that and drop the custom "renesas-rzg2l,adc-channels" Cheers, Prabhakar > > + > > + "#io-channel-cells": > > + const: 1 > > + > > +required: > > + - compatible > > + - reg > > + - interrupts > > + - clocks > > + - clock-names > > + - power-domains > > + - resets > > + - reset-names > > + - renesas-rzg2l,adc-channels > > + - "#io-channel-cells" > > + > > +allOf: > > + - if: > > + properties: > > + renesas-rzg2l,adc-trigger-mode: > > + const: 1 > > + then: > > + required: > > + - gpios > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + #include > > + #include > > + > > + adc: adc@10059000 { > > + compatible = "renesas,r9a07g044-adc", "renesas,rzg2l-adc"; > > + reg = <0x10059000 0x400>; > > + interrupts = ; > > + clocks = <&cpg CPG_MOD R9A07G044_ADC_ADCLK>, > > + <&cpg CPG_MOD R9A07G044_ADC_PCLK>; > > + clock-names = "adclk", "pclk"; > > + power-domains = <&cpg>; > > + resets = <&cpg R9A07G044_ADC_PRESETN>, > > + <&cpg R9A07G044_ADC_ADRST_N>; > > + reset-names = "presetn", "adrst-n"; > > + #io-channel-cells = <1>; > > + renesas-rzg2l,adc-trigger-mode = /bits/ 8 <0>; > > + renesas-rzg2l,adc-channels = /bits/ 8 <0 1 2 3 4 5 6>; > > + }; >