From patchwork Tue Apr 25 08:03:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9697691 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2DEFA601D3 for ; Tue, 25 Apr 2017 08:05:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35BFC2858E for ; Tue, 25 Apr 2017 08:05:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29068285F1; Tue, 25 Apr 2017 08:05:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2ADA2858E for ; Tue, 25 Apr 2017 08:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1176386AbdDYIFX (ORCPT ); Tue, 25 Apr 2017 04:05:23 -0400 Received: from mail-lf0-f43.google.com ([209.85.215.43]:35295 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1176356AbdDYIDa (ORCPT ); Tue, 25 Apr 2017 04:03:30 -0400 Received: by mail-lf0-f43.google.com with SMTP id 75so86217631lfs.2 for ; Tue, 25 Apr 2017 01:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=dZII3ESG4ZVO/PhC3YybZ7ljOsQ35nnOERiRWDEnNXc=; b=GVYjtNHahepVgZq1G2IZiGXtgqrBpwDBYn1BO/XF96jUvmtJgdEU6H33/lFzJs8L9v MhmcMmL4U+J548f26NL+QaclxM/jUuxzDmJ9vxzOcctm/LP0YgS0EIKn/PHAAOOXZN+t ni9jkfyt2NTDmMSuW54dR3A25Xx+9BjcW70Ks= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dZII3ESG4ZVO/PhC3YybZ7ljOsQ35nnOERiRWDEnNXc=; b=aUKyhdd3DdhlOLTNgkhdc0u/4qHPfrQPfdrKRDMhwv84kDKqCDs+CNhMje+9/YbPCL D9dAo3WO+j+NQ2Qh0hjX0a067HECjoNVzR0rZgmHob6hpSPw3qcFtRj7g3BPK54uFF8r oBtw9ejWJrquHTpntx1TsdbB8KDcaaG6+g49QB+xY/iZl8ufLZdk3pQPSlEBNhl6V4aD GijOFrn8wudnSa5LceP0bi/9xVIo841TnLd0bp5d1KOp71nu7VGZDd2yWVxGdKTraEej FsJv05sIkQbsI7UtTPJcbn7lBpjRefIXpfBo277/QvCYyDwOfPKGTwy33+vBIOACw4Ca +ugw== X-Gm-Message-State: AN3rC/7nZOFOFwT/NcZ8QC/ojEXZI7teMXo5/Pb0ihh5ln7eo2btatro YGwGypmaTqyhH9yP X-Received: by 10.25.67.81 with SMTP id m17mr9695954lfj.33.1493107408605; Tue, 25 Apr 2017 01:03:28 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 26sm3771861lfr.7.2017.04.25.01.03.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Apr 2017 01:03:27 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Andy Gross , Bjorn Andersson Cc: Stephen Boyd , Linus Walleij Subject: [PATCH 1/2 v5] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060 Date: Tue, 25 Apr 2017 10:03:24 +0200 Message-Id: <20170425080324.3876-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds the PM8058 XOADC node to the PM8058 PMIC node, defines the 16 channels and further also define an IIO HWMON node for the channels that are used for housekeeping of voltages and die temperature for the PMIC chip die. Tested on the APQ8060 DragonBoard: cd /sys/class/hwmon/hwmon0 cat in2_input 4773 (DC mains ~5V) cat in4_input 625 (0.625V reference voltage) cat in5_input 1250 (1.25V reference voltage) cat temp1_input 35852 (die temperature) Signed-off-by: Linus Walleij --- ChangeLog v1->v5: - Switch to the twocell addressing scheme specified in the new bindings. - The bindings and IIO driver are both queued for v4.12 in the IIO tree and pending in linux-next --- arch/arm/boot/dts/qcom-msm8660.dtsi | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi index 91c9a62ae725..3934a123b182 100644 --- a/arch/arm/boot/dts/qcom-msm8660.dtsi +++ b/arch/arm/boot/dts/qcom-msm8660.dtsi @@ -63,6 +63,22 @@ }; }; + /* + * These channels from the ADC are simply hardware monitors. + * That is why the ADC is referred to as "HKADC" - HouseKeeping + * ADC. + */ + iio-hwmon { + compatible = "iio-hwmon"; + io-channels = <&xoadc 0x00 0x01>, /* Battery */ + <&xoadc 0x00 0x01>, /* DC in (charger) */ + <&xoadc 0x00 0x04>, /* VPH the main system voltage */ + <&xoadc 0x00 0x0b>, /* Die temperature */ + <&xoadc 0x00 0x0c>, /* Reference voltage 1.25V */ + <&xoadc 0x00 0x0d>, /* Reference voltage 0.625V */ + <&xoadc 0x00 0x0e>; /* Reference voltage 0.325V */ + }; + soc: soc { #address-cells = <1>; #size-cells = <1>; @@ -267,6 +283,49 @@ row-hold = <91500>; }; + xoadc: xoadc@197 { + compatible = "qcom,pm8058-adc"; + reg = <0x197>; + interrupts-extended = <&pm8058 76 IRQ_TYPE_EDGE_RISING>; + #address-cells = <2>; + #size-cells = <0>; + #io-channel-cells = <2>; + + vcoin: adc-channel@00 { + reg = <0x00 0x00>; + }; + vbat: adc-channel@01 { + reg = <0x00 0x01>; + }; + dcin: adc-channel@02 { + reg = <0x00 0x02>; + }; + ichg: adc-channel@30 { + reg = <0x00 0x03>; + }; + vph_pwr: adc-channel@04 { + reg = <0x00 0x04>; + }; + usb_vbus: adc-channel@0a { + reg = <0x00 0x0a>; + }; + die_temp: adc-channel@0b { + reg = <0x00 0x0b>; + }; + ref_625mv: adc-channel@0c { + reg = <0x00 0x0c>; + }; + ref_1250mv: adc-channel@0d { + reg = <0x00 0x0d>; + }; + ref_325mv: adc-channel@0e { + reg = <0x00 0x0e>; + }; + ref_muxoff: adc-channel@0f { + reg = <0x00 0x0f>; + }; + }; + rtc@1e8 { compatible = "qcom,pm8058-rtc"; reg = <0x1e8>;