From patchwork Tue Jun 11 09:56:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Myl=C3=A8ne_Josserand?= X-Patchwork-Id: 1113611 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45NQR340ppz9sNf for ; Tue, 11 Jun 2019 19:57:35 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405136AbfFKJ5d (ORCPT ); Tue, 11 Jun 2019 05:57:33 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:60623 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405130AbfFKJ5c (ORCPT ); Tue, 11 Jun 2019 05:57:32 -0400 X-Originating-IP: 90.88.159.246 Received: from dell-desktop.home (aaubervilliers-681-1-40-246.w90-88.abo.wanadoo.fr [90.88.159.246]) (Authenticated sender: mylene.josserand@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 32F5240019; Tue, 11 Jun 2019 09:57:29 +0000 (UTC) From: =?utf-8?q?Myl=C3=A8ne_Josserand?= To: peda@axentia.se, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, mylene.josserand@bootlin.com Subject: [PATCH v1 3/3] dt-bindings: iio: afe: Add hwmon example Date: Tue, 11 Jun 2019 11:56:59 +0200 Message-Id: <20190611095659.29845-4-mylene.josserand@bootlin.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190611095659.29845-1-mylene.josserand@bootlin.com> References: <20190611095659.29845-1-mylene.josserand@bootlin.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org With the support of CHAN_INFO_PROCESSED in voltage-divider, it is possible to read the processed values directly from iio's sysfs entries or by using iio-hwmon. Add an example for this last use case. Signed-off-by: Mylène Josserand --- .../bindings/iio/afe/voltage-divider.txt | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt b/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt index b452a8406107..f7e1c7cb2744 100644 --- a/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt +++ b/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt @@ -51,3 +51,27 @@ sysv { spi-max-frequency = <1000000>; }; }; + +It is also possible to retrieve the processed values using hwmon node: + +div0: div0 { + compatible = "voltage-divider"; + io-channels = <&adc0 0>; /* Channel 0 of the ADC */ + output-ohms = <47>; /* R2 */ + full-ohms = <73>; /* R1 (26) + R2 (47) */ + #io-channel-cells = <1>; +}; + +div1: div1 { + compatible = "voltage-divider"; + io-channels = <&adc0 1>; /* Channel 1 of the ADC */ + output-ohms = <47>; /* R2 */ + full-ohms = <115>; /* R1 (68) + R2 (47) */ + #io-channel-cells = <1>; +}; + +iio-hwmon { + compatible = "iio-hwmon"; + io-channels = <&div0 0>, <&div1 0>; + io-channel-names = "3v3", "usb"; +};