From patchwork Sat May 13 14:15:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9725241 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 CFD2260381 for ; Sat, 13 May 2017 14:15:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B602C288E0 for ; Sat, 13 May 2017 14:15:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA80E288E4; Sat, 13 May 2017 14:15:52 +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=ham 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 201B3288E0 for ; Sat, 13 May 2017 14:15:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752275AbdEMOPu (ORCPT ); Sat, 13 May 2017 10:15:50 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35903 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751877AbdEMOPu (ORCPT ); Sat, 13 May 2017 10:15:50 -0400 Received: by mail-lf0-f41.google.com with SMTP id h4so13219218lfj.3 for ; Sat, 13 May 2017 07:15:49 -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=yk9y2loQMr3w/t/sPrvvoVtvw7Mk2PbODxWh8Q6XmZg=; b=YHzjs6XQ0/aMzLze39C6VSVdh5HZ9cGaxUgs8jBchuf6G0QykAMACzY6phwT1UI+L3 1ANN2Ho7tgTFZJNfJECqgQ1LKBC2y9UsbFWC2lS/2/G/+8FpZdcPf2bkBLJaO2ncz0ql xZMpl4QI+Xy5hbjDnjd21fdEo4yzlQ8WnVwZw= 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=yk9y2loQMr3w/t/sPrvvoVtvw7Mk2PbODxWh8Q6XmZg=; b=dh8QeU91CHaetmN8iPTvXCpYvzo95mz8dnJ7hbFJyWBlNlIS9VoGEQnhdSRjvxEtg2 636wFn9tPQBNQ5BATbVvAzmnZ8k1O7WNNkK1LJ+5nPrdjr9t7OOH7Yo4LYirYPCwBY87 9v4oa64xV06le2G17qED4+n2Lc4Eji2a5Hk/oPiVzksuvywfjgxifxuPFmTeRTUVzFvT Tzm+ytxA9T11YaSu7y//WGfuVZUrmHch7lswKwu9mp30eVNFn4j+FV69Lnq672fjE6mr yitBQWhoYs7PabOtgM/KceUwbFqC83h1E7Lms/gGA8v8ZFeQiueM1KuDRmqIinfvtNKO 9JFg== X-Gm-Message-State: AODbwcA9vK7Sxq779eoumHmCmu+RZAlx7mWpeAEzl+m9Tt6ykkO9QUkU Pnl2pDDNOOiAM2aq X-Received: by 10.46.21.79 with SMTP id 15mr3643160ljv.15.1494684948311; Sat, 13 May 2017 07:15:48 -0700 (PDT) Received: from genomnajs.bredbandsbolaget.se (c-0e0be055.014-348-6c756e10.cust.bredbandsbolaget.se. [85.224.11.14]) by smtp.gmail.com with ESMTPSA id x24sm442130ljd.5.2017.05.13.07.15.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 May 2017 07:15:46 -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 v6] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060 Date: Sat, 13 May 2017 16:15:43 +0200 Message-Id: <20170513141543.24759-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 Acked-by: Bjorn Andersson --- ChangeLog v5->v6: - Fix two typos in the DTSI file. - The driver is now merged, all dependencies are in place upstream. 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 747669a62aa8..f5631e810e9d 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 0x02>, /* 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@03 { + 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>;