From patchwork Sat Oct 31 18:12:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 320102 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp2434092ilc; Sat, 31 Oct 2020 11:15:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPXRZsYt+mZROkfBvuIutJeNE7ABSdDWzw8AyHOU3Zo6B7wtSx2pMD0jW1WYFp7kUyiofl X-Received: by 2002:a05:6402:b45:: with SMTP id bx5mr8419667edb.193.1604168110377; Sat, 31 Oct 2020 11:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604168110; cv=none; d=google.com; s=arc-20160816; b=WRerQWkkE1YJoqzXlwSgp08UgQRZdRt9L4wOVrh/AUfShb3Av49ibnHFwYvWu+qf3i M8rRsQzukNmwMajXGYZ1eygKm9+ZZPkmzk3HVKqQYP82SX7YqeAzeTT6aENxR/Dg/s02 isKOpKSi6SnulKkc8S1UVb2i/clOy3YVVprkvZacdh/9V8aqq4PDGxIFEysFNz3Dr+RU XM6D7gLeeNzkyXAkdwtziPWLbSscortPtCWtKFlQ2jY2ZrZEPl4JTJWVx3BlZ6pKcKyI VYQ1Np6ZYcn7805c9nWXUptTaW5aaLzVOzMblU3pUlN4nPWolEnzmG9VYNjrRVnhspWj tr3w== 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=5AQ+8UW2Bn78FgB0bK7w2p0J2OwlMUN83ZjBmgPDZ+M=; b=g7EtswzktDfr6iwAA/NuxyYNiyWc/pSXkMQKV66GoLQvNVTylwFzRVNUFhnB6OqQHI JjubWSYOCB6Af8AEQ8jCOiwhq1vPM18Z9UVmKYGBADDGQCKKFYy2aZkOfzMYq026clwN MpfXxBy0LivSVCFvgbdqUvm+35po8L5q9/j5N9ZeZxOQzxCsoCKpZpkRhNvFCiWjisT0 g+4O9K8eoLMWw6MBkbRsrCbmzw1oGRBxSjDlF40NJwEFjP9IF8M8UGA1goDpuntQ1jVI cRtW6Oxdin2K+CxyYwfN4e54pBt3Bc+rvbOw7x+3NuTuwjIBxFL4bHwtb43dvFUBmkMx bGoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ePGlAk5V; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si8093688ejk.22.2020.10.31.11.15.10; Sat, 31 Oct 2020 11:15:10 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=@kernel.org header.s=default header.b=ePGlAk5V; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728322AbgJaSPH (ORCPT + 6 others); Sat, 31 Oct 2020 14:15:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:46274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728344AbgJaSPE (ORCPT ); Sat, 31 Oct 2020 14:15:04 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DE5AF206E3; Sat, 31 Oct 2020 18:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604168104; bh=Za5exTD0a3RmhL7Ob2UhOE7IOWXzYlzSvz5GMsTToo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ePGlAk5Va5+w4pv82PhGHDy2perbG3HYCP1mzkSpZbHcSdP2cjA8LvcuhE54JxOVE kogoU58gdzdLy8Sb6aH0Xt05PNBAqdgCv7S0rnCuFqOWwmHXbifw1JJPbtzKz4wfhS 7XPnL7skU3t152cbcnfHDzDp2XUgYeAKX+ouGd6s= From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org Cc: Jonathan Cameron , Peter Rosin Subject: [PATCH 08/10] dt-bindings:iio:afe:voltage-divider: txt to yaml conversion Date: Sat, 31 Oct 2020 18:12:40 +0000 Message-Id: <20201031181242.742301-9-jic23@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201031181242.742301-1-jic23@kernel.org> References: <20201031181242.742301-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Jonathan Cameron Simple binding so straight forward conversion, though did require adding a separate binding document for the max1027 to reflect its abilities to provide channels to consumers. Signed-off-by: Jonathan Cameron Cc: Peter Rosin --- .../bindings/iio/afe/voltage-divider.txt | 53 ----------- .../bindings/iio/afe/voltage-divider.yaml | 88 +++++++++++++++++++ 2 files changed, 88 insertions(+), 53 deletions(-) -- 2.28.0 diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt b/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt deleted file mode 100644 index b452a8406107..000000000000 --- a/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt +++ /dev/null @@ -1,53 +0,0 @@ -Voltage divider -=============== - -When an io-channel measures the midpoint of a voltage divider, the -interesting voltage is often the voltage over the full resistance -of the divider. This binding describes the voltage divider in such -a curcuit. - - Vin ----. - | - .-----. - | R | - '-----' - | - +---- Vout - | - .-----. - | Rout| - '-----' - | - GND - -Required properties: -- compatible : "voltage-divider" -- io-channels : Channel node of a voltage io-channel measuring Vout. -- output-ohms : Resistance Rout over which the output voltage is measured. - See full-ohms. -- full-ohms : Resistance R + Rout for the full divider. The io-channel - is scaled by the Rout / (R + Rout) quotient. - -Example: -The system voltage is circa 12V, but divided down with a 22/222 -voltage divider (R = 200 Ohms, Rout = 22 Ohms) and fed to an ADC. - -sysv { - compatible = "voltage-divider"; - io-channels = <&maxadc 1>; - - /* Scale the system voltage by 22/222 to fit the ADC range. */ - output-ohms = <22>; - full-ohms = <222>; /* 200 + 22 */ -}; - -&spi { - maxadc: adc@0 { - compatible = "maxim,max1027"; - reg = <0>; - #io-channel-cells = <1>; - interrupt-parent = <&gpio5>; - interrupts = <15 IRQ_TYPE_EDGE_RISING>; - spi-max-frequency = <1000000>; - }; -}; diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml new file mode 100644 index 000000000000..fefce8c9f6dc --- /dev/null +++ b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/afe/voltage-divider.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Voltage divider + +maintainers: + - Peter Rosin + +description: | + When an io-channel measures the midpoint of a voltage divider, the + interesting voltage is often the voltage over the full resistance + of the divider. This binding describes the voltage divider in such + a curcuit. + + Vin ----. + | + .-----. + | R | + '-----' + | + +---- Vout + | + .-----. + | Rout| + '-----' + | + GND + + +properties: + compatible: + const: voltage-divider + + io-channels: + maxItems: 1 + description: | + Channel node of a voltage io-channel. + + output-ohms: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Resistance Rout over which the output voltage is measured. See full-ohms. + + full-ohms: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Resistance R + Rout for the full divider. The io-channel is scaled by + the Rout / (R + Rout) quotient. + +required: + - compatible + - io-channels + - output-ohms + - full-ohms + +additionalProperties: false + +examples: + - | + #include + /* + * The system voltage is circa 12V, but divided down with a 22/222 + * voltage divider (R = 200 Ohms, Rout = 22 Ohms) and fed to an ADC. + */ + spi { + #address-cells = <1>; + #size-cells = <0>; + maxadc: adc@0 { + compatible = "maxim,max1027"; + reg = <0>; + #io-channel-cells = <1>; + interrupt-parent = <&gpio5>; + interrupts = <15 IRQ_TYPE_EDGE_RISING>; + spi-max-frequency = <1000000>; + }; + }; + sysv { + compatible = "voltage-divider"; + io-channels = <&maxadc 1>; + + /* Scale the system voltage by 22/222 to fit the ADC range. */ + output-ohms = <22>; + full-ohms = <222>; /* 200 + 22 */ + }; +...