Received: by 2002:a05:622a:4ca:b0:41c:c224:f26f with SMTP id q10csp523123qtx; Thu, 16 Nov 2023 10:22:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEX8ZpmIwgogr/l1mHXe/vfdNceNicezkW9w8XtAMpL69xWuSLlPcnUTtl7hk1zthBOXAEv X-Received: by 2002:aa7:84d2:0:b0:6b2:6835:2a7f with SMTP id x18-20020aa784d2000000b006b268352a7fmr17243191pfn.22.1700158932312; Thu, 16 Nov 2023 10:22:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700158932; cv=none; d=google.com; s=arc-20160816; b=TshpwYDky5UCzX2OICfmigvqOR9hMsFvy0KR2l0GKwX7xveBxXIyMNhjz2jP9oKdxe sXVhxmuLnl7k6w5ExT3MXEzvYIE4oVllCseZV1KotKGM/wwJ8K66+iz/Up88Jb1HHgp2 iKQ2xfn0YSNBH2mNTEYzzvYc0jgWu3oQvGhvzE8oYt5XVjMND+Z8oUjiRoN6wdnUUOW+ Bz+cOl9qYnhX+wtETkGIyJXEbVM4nb3sOAcXB+ZqrscKfbwQntjAWohwrHMmioDVjsi2 wSaXt5AHBiP2cysCb6pdGXc0io/eBF7+lsgAzk0c0lY+yUH+ECNW3dyVxX7mrOZDFqJd 06vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MUlzZKpAh131HW5M4GbkhV0ki+iO1gzvY1SM1jR5S8A=; fh=4sx+i3klb2tStYZtkZk7yrywgrGsFO93YtLYmMtXEXc=; b=dYPfMS7yhajWw5ujtMrfpewc6k085hjDL72Jq530W+d5tKcphJ8F0IWbdyYm5Htoi6 6g0UBXEQgYV7LgjzA7DyB2ZWkp5MMAgHQwi4HscYjREQTqnkaDPdH4PMg9WJh9vkH6Oa dUD37gHVDTz//5vIv8isfob7AKWWKnnCrIyxzmJ0HpWP/GOMN4k/CLxYmQxmSHLsNOW/ kmRJ3+0qCuJrigJrdDqIHCKkVPOc/pKtdjUidoi3cgTEtJlK4dWfeLZNHY84oKuKrhyP qh6uyVzIhlLLWNgWbVcZolxXnn/ar6YS4IIhYwFAqjERaUbqHAdPnw0zUBkeb7eMjm8X PlHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vhf0ra+0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h3-20020aa79f43000000b006c31b7deccesi74071pfr.106.2023.11.16.10.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 10:22:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vhf0ra+0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7EA9881AFE51; Thu, 16 Nov 2023 10:21:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345445AbjKPSVn (ORCPT + 99 others); Thu, 16 Nov 2023 13:21:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbjKPSVk (ORCPT ); Thu, 16 Nov 2023 13:21:40 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A17A192 for ; Thu, 16 Nov 2023 10:21:37 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08B91C433C8; Thu, 16 Nov 2023 18:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700158897; bh=afcjSCTVmlV4p68dsI5fTXVa0bQhtpJng5oNuW2v4Os=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vhf0ra+0c6tEw4RTVE8zXQFo821hMFV3IIi4ZHo4MACQm6Xg84Nesnspov8/oyY20 0nwWzipJ13BeDXrXcYEO/BIay6078ghGLkWB32pzXiKLr+g9/+ovKAUBqZHjOvuQN2 fdNdQQTjV7mKZLCHFnyGLW2z+TqGMiitKy5ABkyFfRQG0O2z4E19Mm4u1IuSk6r3/f ffjuJG3uAtHVGH5Z5Luc9JV1IPKZCImNnCKPdaKRs6ruPB7AzJEuNBZ5p+thd4njqP y3s+JAcjB30SNTSxu/bAHyqMe3i78zsRYYFIm/jEMxLbrR/0Hg2s4Y5V6Jg777aFAY sO8sPfvN4vspw== Date: Thu, 16 Nov 2023 18:21:33 +0000 From: Conor Dooley To: Krzysztof Kozlowski Cc: marius.cristea@microchip.com, jic23@kernel.org, lars@metafoo.de, robh+dt@kernel.org, jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: adding support for PAC193X Message-ID: <20231116-channel-variety-cc7c262924ad@squawk> References: <20231115134453.6656-1-marius.cristea@microchip.com> <20231115134453.6656-2-marius.cristea@microchip.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CqQpzGUiaD3Sqhz2" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 10:21:56 -0800 (PST) --CqQpzGUiaD3Sqhz2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 16, 2023 at 04:01:43PM +0100, Krzysztof Kozlowski wrote: > On 15/11/2023 14:44, marius.cristea@microchip.com wrote: > > From: Marius Cristea > >=20 > > This is the device tree schema for iio driver for > > Microchip PAC193X series of Power Monitors with Accumulator. > >=20 > > Signed-off-by: Marius Cristea > > --- > > .../bindings/iio/adc/microchip,pac1934.yaml | 137 ++++++++++++++++++ > > 1 file changed, 137 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip= ,pac1934.yaml > >=20 > > diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,pac193= 4.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,pac1934.yaml > > new file mode 100644 > > index 000000000000..2609cb19c377 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/microchip,pac1934.yaml > > @@ -0,0 +1,137 @@ > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/iio/adc/microchip,pac1934.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Microchip PAC1934 Power Monitors with Accumulator > > + > > +maintainers: > > + - Marius Cristea > > + > > +description: | > > + This device is part of the Microchip family of Power Monitors with A= ccumulator. > > + The datasheet for PAC1931, PAC1932, PAC1933 and PAC1934 can be found= here: > > + https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/Pro= ductDocuments/DataSheets/PAC1931-Family-Data-Sheet-DS20005850E.pdf > > + > > +properties: > > + compatible: > > + enum: > > + - microchip,pac1931 > > + - microchip,pac1932 > > + - microchip,pac1933 > > + - microchip,pac1934 > > + > > + reg: > > + maxItems: 1 > > + > > + "#address-cells": > > + const: 1 > > + > > + "#size-cells": > > + const: 0 > > + > > + interrupts: > > + maxItems: 1 > > + > > + microchip,slow-io: > > + type: boolean > > + description: | > > + A GPIO used to trigger a change is sampling rate (lowering the c= hip power consumption). >=20 > Use Linux coding style wrapping (as described in Linux Coding style). I > am not going to tell you numbers because I want you to read the document > first. >=20 > This is boolean, not GPIO. I don't understand. "A GPIO", so any GPIO or > some specific? How is this property related to GPIO? >=20 >=20 > > + If configured in SLOW mode, if this pin is forced high, sampling= rate is forced to eight >=20 > This pin? This is boolean, not a GPIO. GPIOs are phandles. I said it on the previous version, but this really seems like it should be something like "slow-io-gpios". I know Jonathan expressed some concerns about having to deal with it on the operating system side (as the pin is either an input & used for this slow-io control, or an output and used as an interrupt) but that is, in my opinion, a problem for the operating system & the binding should describe how the hardware works, even if that is not convenient. With this sort of property, a GPIO hog would be required to be set up (and the driver for that gpio controller bound etc before the pac driver loads) for correction functionality if this property was in the non-default state. > > + samples/second. When it is forced low, the sampling rate is 1024= samples/second unless > > + a different sample rate has been programmed. > > + > > +patternProperties: > > + "^channel@[1-4]+$": > > + type: object > > + $ref: adc.yaml > > + description: Represents the external channels which are connected = to the ADC. > > + > > + properties: > > + reg: > > + items: > > + minimum: 1 > > + maximum: 4 > > + > > + shunt-resistor-micro-ohms: > > + description: | > > + Value in micro Ohms of the shunt resistor connected between > > + the SENSE+ and SENSE- inputs, across which the current is me= asured. Value > > + is needed to compute the scaling of the measured current. > > + > > + required: > > + - reg > > + - shunt-resistor-micro-ohms > > + > > + unevaluatedProperties: false > > + > > +required: > > + - compatible > > + - reg > > + - "#address-cells" > > + - "#size-cells" > > + > > +allOf: > > + - if: > > + properties: > > + compatible: > > + contains: > > + const: interrupts >=20 >=20 > I don't understand what do you want to say here. I am also 100% sure you > did not test it on a real case (maybe example passes but nothing more). As far as I understand, the same pin on the device is used for both an output or an input depending on the configuration. As an input, it is the "slow-io" control, and as an output it is an interrupt. I think Marius is trying to convey that either this pin can be in exclusively one state or another. _However_ I am not sure that that is really the right thing to do - they might well be mutually exclusive modes, but I think the decision can be made at runtime, rather than at devicetree creation time. Say for example the GPIO controller this is connected to is capable of acting as an interrupt controller. Unless I am misunderstanding the runtime configurability of this hardware, I think it is possible to actually provide a "slow-io-gpios" and an interrupt property & let the operating system decide at runtime which mode it wants to work in. I'm off travelling at the moment Marius, but I should be back in work on Monday if you want to have a chat about it & explain a bit more to me? Cheers, Conor. >=20 > > + then: > > + properties: > > + microchip,slow-io: false > > + else: > > + if: > > + properties: > > + compatible: > > + contains: > > + const: microchip,slow-io > > + then: > > + properties: > > + interrupts: false >=20 > Best regards, > Krzysztof >=20 --CqQpzGUiaD3Sqhz2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZVZdqwAKCRB4tDGHoIJi 0ujbAQCjXBBuVPgyP4WT9ADe31P1IzbnBiEVymzdiv9hZVxnRAD/d9hSmWkAXypj w1fZogUDEFwlkt04d1QG4OsATZhxNQ8= =3oED -----END PGP SIGNATURE----- --CqQpzGUiaD3Sqhz2--