Message ID | 20230220123232.413029-2-marius.cristea@microchip.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1284982wrn; Mon, 20 Feb 2023 04:43:42 -0800 (PST) X-Google-Smtp-Source: AK7set9u84t0LS09M+48UxrxAYWefbsPptMY/XxLa2XwiCUNopL2mzWnX4l5y4Pjr9Zuz8ht/MI6 X-Received: by 2002:a05:6a21:78a8:b0:bb:9ad9:4967 with SMTP id bf40-20020a056a2178a800b000bb9ad94967mr11049663pzc.44.1676897022637; Mon, 20 Feb 2023 04:43:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676897022; cv=none; d=google.com; s=arc-20160816; b=DJeWn1Gg4jMt+/+Wf3vOsqiw9WxKehHEK4rrHCSTlamvn/Uh9ZWSf5jrP+gn/WR8RH 9zCeOKS8S3RXRBS/Oj5qcipPYnkW0emm988dY6OFMi7OAK3L1shCGtQ2g9GSyboal626 V4BUyceOLRtgoc0wpirvRGNr7uM24nNhia7wBTIylE39OMCiidgl9ajvhH1QftqhwiaD /RE/bL4S40g5O5mm7DsHN5X4k6IpAYFaZrELRbAXR5pDoROaezAgIsfsvkOKwsOrdJQ/ k3WquQS7S19tPjxlPPl5LwaQ9aN9yZNssMcysgBmxkegnux0wK6iM6UetCUupFIrpYEK hUUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZiMzVmmgf3LxJVbAvE/STBawMGmTYcACOQ6QyrkFIJM=; b=0WuFdsEGy6tI5KU3Qjecnm/kC3jXoey7+3V7JkeTGJr+GVOH+UUrzVQCIRVUMzUwvo e/OHm/GYBkWgw74OD0qie9irh2cOaQuN9VpaR5Hi3m+lCWxh97UkjS9u4M2wxS2bvlVC N3mGVgV5OcDZgWeGYJeh0tqIc7su1zshPyTNGZXXyvlZ/nL9PkRPO/mRDTjwlOYmGB1s Ouxjhwc2bDnhS0y/wKJuJYzfp3XGblcEWb3NP10F8Np0HIFWO5yfMGIcH3rKZXfc0mFf tTIfxjlwi/ITN703wevTuykiZDjyyrghSOUYd0vl9AMVdWNoMlAbnmotnfFqBV6tmY65 Qygw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=heUUJgec; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o13-20020a635a0d000000b004fbbd461e29si14549806pgb.702.2023.02.20.04.43.29; Mon, 20 Feb 2023 04:43:42 -0800 (PST) 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=@microchip.com header.s=mchp header.b=heUUJgec; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232006AbjBTMd2 (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Mon, 20 Feb 2023 07:33:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231810AbjBTMdX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Feb 2023 07:33:23 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC20F18AA0; Mon, 20 Feb 2023 04:33:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1676896395; x=1708432395; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2BIAQ53336CCXN9OBVQo/sD5j8P7KTcQ7EfjU99FKxU=; b=heUUJgecAsXGPrGGZIvoc4Uv2Zc0VDuABCPK0VDj9x3ORO1iQwcYY++q H/5hgMok6CNX+2v0bYMwi4LGS9IJSqyoZP6ZpycVeDbuhHoPeBrlbwY/E Z+Z+hOH0JNle01ax+dNxXTCe4naZFPzaIEZlrxQRrpITlqmjcPsl2hOVA RD//YvkfT3jZ6R6SsPWq4nWy+sJtuAZ7IQw5iKY9tKyQKynKr9brjwVq+ boyj6N0Gjxff9R8aM3JQbtRx6z3z35Rb7NhcmU+1V87LlOvA8/W6yCtqs zUEDFhG2hMKZ1tyJNqFfWtSeNj3q8fD3NGzOV/VrAbcJPOAScca9F6lnO g==; X-IronPort-AV: E=Sophos;i="5.97,312,1669100400"; d="scan'208";a="201722511" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Feb 2023 05:33:14 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 20 Feb 2023 05:32:56 -0700 Received: from marius-VM.mshome.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 20 Feb 2023 05:32:54 -0700 From: <marius.cristea@microchip.com> To: <jic23@kernel.org>, <lars@metafoo.de>, <robh+dt@kernel.org> CC: <linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <marius.cristea@microchip.com> Subject: [PATCH v1 1/2] dt-bindings: iio: adc: adding dt-bindings for PAC193X Date: Mon, 20 Feb 2023 14:32:31 +0200 Message-ID: <20230220123232.413029-2-marius.cristea@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230220123232.413029-1-marius.cristea@microchip.com> References: <20230220123232.413029-1-marius.cristea@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758353972592449730?= X-GMAIL-MSGID: =?utf-8?q?1758353972592449730?= |
Series |
adding support for Microchip PAC193X Power Monitor
|
|
Commit Message
marius.cristea@microchip.com
Feb. 20, 2023, 12:32 p.m. UTC
From: Marius Cristea <marius.cristea@microchip.com> This is the device tree schema for iio driver for Microchip PAC193X series of Power Monitors with Accumulator. Signed-off-by: Marius Cristea <marius.cristea@microchip.com> --- .../bindings/iio/adc/microchip,pac193x.yaml | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml
Comments
On 20/02/2023 13:32, marius.cristea@microchip.com wrote: > From: Marius Cristea <marius.cristea@microchip.com> Subject: drop second/last, redundant "dt-bindings for". The "dt-bindings" prefix is already stating that these are bindings. > > This is the device tree schema for iio driver for > Microchip PAC193X series of Power Monitors with Accumulator. Do not use "This commit/patch". https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95 Use imperative - also for subject. Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel. > > Signed-off-by: Marius Cristea <marius.cristea@microchip.com> > --- > .../bindings/iio/adc/microchip,pac193x.yaml | 122 ++++++++++++++++++ > 1 file changed, 122 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml > > diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml > new file mode 100644 > index 000000000000..e4ea560991e9 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml > @@ -0,0 +1,122 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/adc/microchip,pac193x.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Microchip PAC193X Power Monitors with Accumulator > + > +maintainers: > + - Marius Cristea <marius.cristea@microchip.com> > + > +properties: > + compatible: > + enum: > + - microchip,pac1934 > + - microchip,pac1933 > + - microchip,pac1932 > + - microchip,pac1931 Maybe order these numerically (ascending)? > + > + reg: > + maxItems: 1 > + > + "#address-cells": > + const: 1 > + > + "#size-cells": > + const: 0 > + > + microchip,samp-rate: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: Sampling rate for all device's channels. What are the units? rate is usually in hz, which should be expressed in unit suffix (property name) > + enum: [8, 64, 256, 1024] > + default: 1024 > + > +required: required goes after all properties, so after patternProperties > + - compatible > + - reg > + - microchip,samp-rate > + - "#address-cells" > + - "#size-cells" > + > +patternProperties: > + "^channel([1-4])@[1-4]+$": Why first reg-pattern ([1-4])? For what do you need it? > + $ref: "adc.yaml" Drop quotes > + type: object > + description: Represents the external channels which are connected to the ADC. > + > + properties: > + reg: > + description: The channel number. > + It can have up to 4 channels, numbered from 1 to 4. > + items: > + - minimum: 1 > + maximum: 4 > + > + microchip,uohms-shunt-res: Not a correct unit suffix. Use standard properties: git grep shunt -- Documentation/devicetree/ > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: | > + Value in micro Ohms of the shunt resistor connected between > + the SENSE+ and SENSE- inputs, across which the current is measured. Value > + is needed to compute the scaling of the measured current. > + > + microchip,rail-name: > + $ref: /schemas/types.yaml#/definitions/string > + description: Name of the monitored power rail. Why do you need it? Why this is a property of DT? Aren't you now duplicating label? > + > + microchip,bi-directional: > + description: Whether the channel is bi-directional. Describe here what is a "bi-directional" channel for ADC... Maybe it is obvious, maybe not. For me it is not and none of other devices have it. > + type: boolean > + > + required: > + - reg > + - microchip,uohms-shunt-res > + - microchip,rail-name > + > + additionalProperties: false > + > +additionalProperties: false > + > +examples: > + - | > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + pac193x: pac193x@10 { Node names should be generic. https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation > + compatible = "microchip,pac1934"; > + reg = <0x10>; > + > + #address-cells = <1>; > + #size-cells = <0>; > + microchip,samp-rate = <64>; > + > + channel1@1 { 1@1 is for sure not generic... Best regards, Krzysztof
Hi Marius Welcome to IIO. I'll comment on top of Krzystof's review to avoid duplication. > > > > Signed-off-by: Marius Cristea <marius.cristea@microchip.com> > > --- > > .../bindings/iio/adc/microchip,pac193x.yaml | 122 ++++++++++++++++++ Wild cards in names bite us far too often. Name this and the driver after one of the supported parts. > > 1 file changed, 122 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml > > new file mode 100644 > > index 000000000000..e4ea560991e9 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml > > @@ -0,0 +1,122 @@ > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/iio/adc/microchip,pac193x.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Microchip PAC193X Power Monitors with Accumulator > > + > > +maintainers: > > + - Marius Cristea <marius.cristea@microchip.com> > > + > > +properties: > > + compatible: > > + enum: > > + - microchip,pac1934 > > + - microchip,pac1933 > > + - microchip,pac1932 > > + - microchip,pac1931 > > Maybe order these numerically (ascending)? > > > + > > + reg: > > + maxItems: 1 > > + > > + "#address-cells": > > + const: 1 > > + > > + "#size-cells": > > + const: 0 > > + > > + microchip,samp-rate: > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + description: Sampling rate for all device's channels. > > What are the units? rate is usually in hz, which should be expressed in > unit suffix (property name)] It's unusual for sampling rate to be a property of the hardware and hence suitable for DT binding. Normally we make this a userspace control instead. If there is a reason for doing it from DT, that wants to be mentioned here. > > > + enum: [8, 64, 256, 1024] > > + default: 1024 > > + > > +required: > > required goes after all properties, so after patternProperties > > > + - compatible > > + - reg > > + - microchip,samp-rate > > + - "#address-cells" > > + - "#size-cells" > > + > > +patternProperties: > > + "^channel([1-4])@[1-4]+$": > > Why first reg-pattern ([1-4])? For what do you need it? > > > + $ref: "adc.yaml" > > Drop quotes > > > + type: object > > + description: Represents the external channels which are connected to the ADC. > > + > > + properties: > > + reg: > > + description: The channel number. > > + It can have up to 4 channels, numbered from 1 to 4. > > + items: > > + - minimum: 1 > > + maximum: 4 > > + > > + microchip,uohms-shunt-res: > > Not a correct unit suffix. Use standard properties: > git grep shunt -- Documentation/devicetree/ Check for existing relevant properties. Here we have shunt-resistor-micro-ohms in common use in both IIO and hwmon. > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + description: | > > + Value in micro Ohms of the shunt resistor connected between > > + the SENSE+ and SENSE- inputs, across which the current is measured. Value > > + is needed to compute the scaling of the measured current. > > + > > + microchip,rail-name: > > + $ref: /schemas/types.yaml#/definitions/string > > + description: Name of the monitored power rail. > > Why do you need it? Why this is a property of DT? Aren't you now > duplicating label? Agreed. Sounds like label to me as well. > > > + > > + microchip,bi-directional: > > + description: Whether the channel is bi-directional. > > Describe here what is a "bi-directional" channel for ADC... Maybe it is > obvious, maybe not. For me it is not and none of other devices have it. > From datasheet this seems to be a novel description of whether the ADC is measuring just positive or allows for negative voltage as well (i.e. the current through the shut resistor is going on the other direction). Can we relate this to a biopolar / unipolar decision on a simple voltage ADC? For that we have standard DT bindings in iio/adc/adc.yaml > > + type: boolean > > + > > + required: > > + - reg > > + - microchip,uohms-shunt-res > > + - microchip,rail-name > > + > > + additionalProperties: false > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + i2c { > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + pac193x: pac193x@10 { > > Node names should be generic. > https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation > > > + compatible = "microchip,pac1934"; > > + reg = <0x10>; > > + > > + #address-cells = <1>; > > + #size-cells = <0>; > > + microchip,samp-rate = <64>; > > + > > + channel1@1 { > > 1@1 is for sure not generic... Standard naming for channel nodes in adc.yaml Some bindings predate that, but for new ones please match it. Thanks, Jonathan > > > > Best regards, > Krzysztof >
Hi Jonathan, Thank you so much! I'm happy to contribute to IIO. I will remove some section because I agree with the propose solution. For the rest I will comment below.. On Sat, 2023-02-25 at 17:17 +0000, Jonathan Cameron wrote: > > > + > > > + microchip,samp-rate: > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > + description: Sampling rate for all device's channels. > > > > What are the units? rate is usually in hz, which should be > > expressed in > > unit suffix (property name)] > > It's unusual for sampling rate to be a property of the hardware and > hence > suitable for DT binding. Normally we make this a userspace control > instead. > If there is a reason for doing it from DT, that wants to be mentioned > here. > Here I could change it into the datarate (as in iio/adc/ti,ads1015.yaml). The units are samples per second. My intention was to be alingned with the datasheet. My intention was to let the user configure the sample rate as soon as posile during the startup (the PAC device's own power consumtion will increase with the sampling rate - default the chip will start with the maximum samples per second). > > > > > > > + > > > + microchip,bi-directional: > > > + description: Whether the channel is bi-directional. > > > > Describe here what is a "bi-directional" channel for ADC... Maybe > > it is > > obvious, maybe not. For me it is not and none of other devices have > > it. > > > From datasheet this seems to be a novel description of whether the > ADC > is measuring just positive or allows for negative voltage as well > (i.e. > the current through the shut resistor is going on the other > direction). > Can we relate this to a biopolar / unipolar decision on a simple > voltage ADC? > For that we have standard DT bindings in iio/adc/adc.yaml > Yes, the PAC device can measure voltages as unipolar or bipolar but also current as unidirectional or bidirectional (we are measuring the voltage across a shunt resistor). We are also reporting power and is not a "usual" thing to report power as unipolar or bipolar. Bi- directional power makes more sens if you are thinking to monitor a charge discharge cycle for a battery pack. Thanks, Marius
On 06/03/2023 14:53, Marius.Cristea@microchip.com wrote: > > Hi Jonathan, > > Thank you so much! I'm happy to contribute to IIO. > > I will remove some section because I agree with the propose solution. > For the rest I will comment below.. > > > > On Sat, 2023-02-25 at 17:17 +0000, Jonathan Cameron wrote: >>>> + >>>> + microchip,samp-rate: >>>> + $ref: /schemas/types.yaml#/definitions/uint32 >>>> + description: Sampling rate for all device's channels. >>> >>> What are the units? rate is usually in hz, which should be >>> expressed in >>> unit suffix (property name)] >> >> It's unusual for sampling rate to be a property of the hardware and >> hence >> suitable for DT binding. Normally we make this a userspace control >> instead. >> If there is a reason for doing it from DT, that wants to be mentioned >> here. >> > > Here I could change it into the datarate (as in > iio/adc/ti,ads1015.yaml). The units are samples per second. My > intention was to be alingned with the datasheet. > > My intention was to let the user configure the sample rate as soon as > posile during the startup (the PAC device's own power consumtion will > increase with the sampling rate - default the chip will start with the > maximum samples per second). Then maybe the default should be just lowest rate and user will adjust it further? Since this is user-space knob, why this should be even configurable per board? Best regards, Krzysztof
On Mon, 6 Mar 2023 13:53:27 +0000 <Marius.Cristea@microchip.com> wrote: > Hi Jonathan, > > Thank you so much! I'm happy to contribute to IIO. > > I will remove some section because I agree with the propose solution. > For the rest I will comment below.. > > > > On Sat, 2023-02-25 at 17:17 +0000, Jonathan Cameron wrote: > > > > + > > > > + microchip,samp-rate: > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > > + description: Sampling rate for all device's channels. > > > > > > What are the units? rate is usually in hz, which should be > > > expressed in > > > unit suffix (property name)] > > > > It's unusual for sampling rate to be a property of the hardware and > > hence > > suitable for DT binding. Normally we make this a userspace control > > instead. > > If there is a reason for doing it from DT, that wants to be mentioned > > here. > > > > Here I could change it into the datarate (as in > iio/adc/ti,ads1015.yaml). The units are samples per second. My > intention was to be alingned with the datasheet. > > My intention was to let the user configure the sample rate as soon as > posile during the startup (the PAC device's own power consumtion will > increase with the sampling rate - default the chip will start with the > maximum samples per second). Feel free to have the driver set it to the minimum frequency unconditionally in probe. > > > > > > > > > > > > > > + > > > > + microchip,bi-directional: > > > > + description: Whether the channel is bi-directional. > > > > > > Describe here what is a "bi-directional" channel for ADC... Maybe > > > it is > > > obvious, maybe not. For me it is not and none of other devices have > > > it. > > > > > From datasheet this seems to be a novel description of whether the > > ADC > > is measuring just positive or allows for negative voltage as well > > (i.e. > > the current through the shut resistor is going on the other > > direction). > > Can we relate this to a biopolar / unipolar decision on a simple > > voltage ADC? > > For that we have standard DT bindings in iio/adc/adc.yaml > > > > Yes, the PAC device can measure voltages as unipolar or bipolar but > also current as unidirectional or bidirectional (we are measuring the > voltage across a shunt resistor). We are also reporting power and is > not a "usual" thing to report power as unipolar or bipolar. Bi- > directional power makes more sens if you are thinking to monitor a > charge discharge cycle for a battery pack. I'm still a little confused. If you are bipolar and hence can measure postive and negative voltage between two pins, how is that different to bidirectional? Other than for bidirection we are talking current rather than voltage. > > > > Thanks, > Marius
diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml new file mode 100644 index 000000000000..e4ea560991e9 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/microchip,pac193x.yaml @@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/microchip,pac193x.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip PAC193X Power Monitors with Accumulator + +maintainers: + - Marius Cristea <marius.cristea@microchip.com> + +properties: + compatible: + enum: + - microchip,pac1934 + - microchip,pac1933 + - microchip,pac1932 + - microchip,pac1931 + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + microchip,samp-rate: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Sampling rate for all device's channels. + enum: [8, 64, 256, 1024] + default: 1024 + +required: + - compatible + - reg + - microchip,samp-rate + - "#address-cells" + - "#size-cells" + +patternProperties: + "^channel([1-4])@[1-4]+$": + $ref: "adc.yaml" + type: object + description: Represents the external channels which are connected to the ADC. + + properties: + reg: + description: The channel number. + It can have up to 4 channels, numbered from 1 to 4. + items: + - minimum: 1 + maximum: 4 + + microchip,uohms-shunt-res: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Value in micro Ohms of the shunt resistor connected between + the SENSE+ and SENSE- inputs, across which the current is measured. Value + is needed to compute the scaling of the measured current. + + microchip,rail-name: + $ref: /schemas/types.yaml#/definitions/string + description: Name of the monitored power rail. + + microchip,bi-directional: + description: Whether the channel is bi-directional. + type: boolean + + required: + - reg + - microchip,uohms-shunt-res + - microchip,rail-name + + additionalProperties: false + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pac193x: pac193x@10 { + compatible = "microchip,pac1934"; + reg = <0x10>; + + #address-cells = <1>; + #size-cells = <0>; + microchip,samp-rate = <64>; + + channel1@1 { + reg = <0x1>; + microchip,uohms-shunt-res = <24900000>; + microchip,rail-name = "CPU"; + }; + + channel2@2 { + reg = <0x2>; + microchip,uohms-shunt-res = <49900000>; + microchip,rail-name = "GPU"; + }; + + channel3@3 { + reg = <0x3>; + microchip,uohms-shunt-res = <75000000>; + microchip,rail-name = "MEM"; + microchip,bi-directional; + }; + + channel4@4 { + reg = <0x4>; + microchip,uohms-shunt-res = <100000000>; + microchip,rail-name = "NET"; + microchip,bi-directional; + }; + }; + }; + +...