From patchwork Sun Oct 11 16:30:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11830945 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9D0892C for ; Sun, 11 Oct 2020 16:33:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 936FE22244 for ; Sun, 11 Oct 2020 16:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602433991; bh=APaEzrXD8m2ycuL796wBGjbb9vQKOwbTzbusbKhLeG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Xtu4h8iInBsSxyMB+q9DCz0EMW4RmpHmUoCf00xjUsFk/uTptnI2rPjq8Nlbhc2i3 p0NkRSnTg2pyIOe/ME6jz88H1IqWm6uQsxuzQ0XHz5eKFxqvGsEnPYZiku4KwVP7uM vMOEK7DbA4K1gpOFFNENOFgpOVcjgecOlD5BAY0k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388182AbgJKQdL (ORCPT ); Sun, 11 Oct 2020 12:33:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:38800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388091AbgJKQdK (ORCPT ); Sun, 11 Oct 2020 12:33:10 -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 4FD9D2222F; Sun, 11 Oct 2020 16:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602433990; bh=APaEzrXD8m2ycuL796wBGjbb9vQKOwbTzbusbKhLeG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kAAZ8/5Yz+TlHYxuKFE0aBT/u3r2hC2o6PeTmJdWvyBbKILXxsJe4RJVjkR9Lg0Nn jdBOsReWiW8uRYSTX7vYOZsqKy0pmciRh2h8WLodXSay/0SUeEn3MbaSDoVrSswDNT Tn8UQ2Emvb7SAcBSuk1RMRiSVpqlMnxG676DLE6Q= From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring Cc: Jonathan Cameron Subject: [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers Date: Sun, 11 Oct 2020 17:30:30 +0100 Message-Id: <20201011163031.240708-2-jic23@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201011163031.240708-1-jic23@kernel.org> References: <20201011163031.240708-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron This can be used via $ref by bindings that are consumers of the channels provided by IIO devices. Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/iio-bindings.txt | 53 ----------------- .../devicetree/bindings/iio/iio-consumer.yaml | 59 +++++++++++++++++++ 2 files changed, 59 insertions(+), 53 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/iio-bindings.txt b/Documentation/devicetree/bindings/iio/iio-bindings.txt index aa63cac7323e..cfaed2b54fa9 100644 --- a/Documentation/devicetree/bindings/iio/iio-bindings.txt +++ b/Documentation/devicetree/bindings/iio/iio-bindings.txt @@ -47,56 +47,3 @@ Example for a configuration with trigger: }; }; -==IIO consumers== - -Required properties: -io-channels: List of phandle and IIO specifier pairs, one pair - for each IIO input to the device. Note: if the - IIO provider specifies '0' for #io-channel-cells, - then only the phandle portion of the pair will appear. - -Optional properties: -io-channel-names: - List of IIO input name strings sorted in the same - order as the io-channels property. Consumers drivers - will use io-channel-names to match IIO input names - with IIO specifiers. -io-channel-ranges: - Empty property indicating that child nodes can inherit named - IIO channels from this node. Useful for bus nodes to provide - and IIO channel to their children. - -For example: - - device { - io-channels = <&adc 1>, <&ref 0>; - io-channel-names = "vcc", "vdd"; - }; - -This represents a device with two IIO inputs, named "vcc" and "vdd". -The vcc channel is connected to output 1 of the &adc device, and the -vdd channel is connected to output 0 of the &ref device. - -==Example== - - adc: max1139@35 { - compatible = "maxim,max1139"; - reg = <0x35>; - #io-channel-cells = <1>; - }; - - ... - - iio-hwmon { - compatible = "iio-hwmon"; - io-channels = <&adc 0>, <&adc 1>, <&adc 2>, - <&adc 3>, <&adc 4>, <&adc 5>, - <&adc 6>, <&adc 7>, <&adc 8>, - <&adc 9>; - }; - - some_consumer { - compatible = "some-consumer"; - io-channels = <&adc 10>, <&adc 11>; - io-channel-names = "adc1", "adc2"; - }; diff --git a/Documentation/devicetree/bindings/iio/iio-consumer.yaml b/Documentation/devicetree/bindings/iio/iio-consumer.yaml new file mode 100644 index 000000000000..5f28cc29edce --- /dev/null +++ b/Documentation/devicetree/bindings/iio/iio-consumer.yaml @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/iio-consumer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic IIO consumer-bindings + +maintainers: + - Jonathan Cameron + +description: + This binding describes generic properties a consumer of the channels + provided by an IIO device may use. + + As well, direct readings of channels on an IIO Device, an IIO device + can provide services to consumer devices. Thes are in the form of + channel readings and properties. For example, an ADC might provide + 3 channels to an analog accelerometer so that an accelerometer + driver can use them to read the voltages that correspond to the + accelerations on the 3 axis and apply appropriate calibration to + provide useful outputs. + +properties: + io-channels: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: > + List of phandle and IIO specifier pairs, one pair + for each IIO input to the device. Note: if the + IIO provider specifies '0' for #io-channel-cells, + then only the phandle portion of the pair will appear. + + io-channel-names: + $ref: /schemas/types.yaml#/definitions/string-array + description: > + List of names associated with a given IIO channel by the consumer + device. An example for an analog accelerometer would be "accel_x". + Consumers drivers will use io-channel-names to locate the correct + phandle based reference in io-channels. + + io-channel-ranges: + type: boolean + description: > + Empty property indicating that child nodes can inherit named + IIO channels from this node. Useful for bus nodes to provide + and IIO channel to their children. + +additionalProperties: true + +examples: + - | + iio-hwmon { + compatible = "iio-hwmon"; + io-channels = <&adc 0>, <&adc 1>, <&adc 2>, + <&adc 3>, <&adc 4>, <&adc 5>, + <&adc 6>, <&adc 7>, <&adc 8>, + <&adc 9>; + }; +... \ No newline at end of file From patchwork Sun Oct 11 16:30:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11830947 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CE6B92C for ; Sun, 11 Oct 2020 16:33:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06C6822244 for ; Sun, 11 Oct 2020 16:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602433993; bh=8k26N85go+1RefiHDXvAcyTtVA5cPAcUtJ+6mS7XSvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cRDqS52G9FzaJep5CQv0VIE+9ND9XUTezzfBJt3vfnhwyWJ+Vj1ZqgNgPSoP+b7GQ SzcneS+G87nwyba++oejk8+KrElA2ZcJwXM/Vtka3kkRwuOeF/I6oQ0ZhHJJ1ShI+x AFF9ZVs+MS/FOTiXjsh820a4ezCJ1JYPgTJA9e1E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388191AbgJKQdM (ORCPT ); Sun, 11 Oct 2020 12:33:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:38830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388091AbgJKQdM (ORCPT ); Sun, 11 Oct 2020 12:33:12 -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 9E779221FF; Sun, 11 Oct 2020 16:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602433991; bh=8k26N85go+1RefiHDXvAcyTtVA5cPAcUtJ+6mS7XSvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JngxnZ8zAH6j6lZxFR8R2okZGPeees8eztoHP3LbB9uLtkNbR1PIeMxq0dkAb6u4J tf6YkQe7118HICl68cGza574VbGC6ymjXGj8+9HhVl9A6TIKa9/GfSVq/r1dEHsqHW 9QYzzHB+wRH2Nn8m3cAqEGNaEBLKjHZXjZ6xmj5k= From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring Cc: Jonathan Cameron , Peter Rosin Subject: [PATCH 2/2] dt-bindings:iio:dac:dpot-dac: yaml conversion. Date: Sun, 11 Oct 2020 17:30:31 +0100 Message-Id: <20201011163031.240708-3-jic23@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201011163031.240708-1-jic23@kernel.org> References: <20201011163031.240708-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Txt to yaml format conversion. I dropped the example section describind the measurement ADC, as that isn't strictly part of this binding. Uses a reference to the new iio-consumers.yaml binding. Signed-off-by: Jonathan Cameron Cc: Peter Rosin Acked-by: Peter Rosin --- .../devicetree/bindings/iio/dac/dpot-dac.txt | 41 ------------ .../devicetree/bindings/iio/dac/dpot-dac.yaml | 67 +++++++++++++++++++ 2 files changed, 67 insertions(+), 41 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt b/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt deleted file mode 100644 index fdf47a01bfef..000000000000 --- a/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt +++ /dev/null @@ -1,41 +0,0 @@ -Bindings for DAC emulation using a digital potentiometer - -It is assumed that the dpot is used as a voltage divider between the -current dpot wiper setting and the maximum resistance of the dpot. The -divided voltage is provided by a vref regulator. - - .------. - .-----------. | | - | vref |--' .---. - | regulator |--. | | - '-----------' | | d | - | | p | - | | o | wiper - | | t |<---------+ - | | | - | '---' dac output voltage - | | - '------+------------+ - -Required properties: -- compatible: Should be "dpot-dac" -- vref-supply: The regulator supplying the voltage divider. -- io-channels: Channel node of the dpot to be used for the voltage division. -- io-channel-names: Should be "dpot". - -Example: - - &i2c { - dpot: mcp4651-503@28 { - compatible = "microchip,mcp4651-503"; - reg = <0x28>; - #io-channel-cells = <1>; - }; - }; - - dac { - compatible = "dpot-dac"; - vref-supply = <®_3v3>; - io-channels = <&dpot 0>; - io-channel-names = "dpot"; - }; diff --git a/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml b/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml new file mode 100644 index 000000000000..b4a8073a3a3c --- /dev/null +++ b/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/dac/dpot-dac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: DAC emulation using a digital potentiometer + +maintainers: + - Peter Rosin + +description: | + It is assumed that the dpot is used as a voltage divider between the + current dpot wiper setting and the maximum resistance of the dpot. The + divided voltage is provided by a vref regulator. + + .------. + .-----------. | | + | vref |--' .---. + | regulator |--. | | + '-----------' | | d | + | | p | + | | o | wiper + | | t |<---------+ + | | | + | '---' dac output voltage + | | + '------+------------+ + +allOf: + - $ref: "../iio-consumer.yaml#" + +properties: + compatible: + const: dpot-dac + + reg: + maxItems: 1 + + vref-supply: + description: Regulator supplying the voltage divider. + + io-channels: + maxItems: 1 + description: | + Channel node of the dpot to be used for the voltage division. + + io-channel-names: + const: dpot + +required: + - compatible + - vref-supply + - io-channels + - io-channel-names + +additionalProperties: false + +examples: + - | + dac { + compatible = "dpot-dac"; + vref-supply = <®_3v3>; + io-channels = <&dpot 0>; + io-channel-names = "dpot"; + }; +...