From patchwork Tue Jan 31 10:21:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9546891 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 17824604A0 for ; Tue, 31 Jan 2017 10:29:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A96328285 for ; Tue, 31 Jan 2017 10:29:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3346282F5; Tue, 31 Jan 2017 10:29: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 714CC28285 for ; Tue, 31 Jan 2017 10:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751510AbdAaK3v (ORCPT ); Tue, 31 Jan 2017 05:29:51 -0500 Received: from mail-lf0-f44.google.com ([209.85.215.44]:36358 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751576AbdAaK3t (ORCPT ); Tue, 31 Jan 2017 05:29:49 -0500 Received: by mail-lf0-f44.google.com with SMTP id z134so208865835lff.3 for ; Tue, 31 Jan 2017 02:29:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=TorG+EtHjFaRGvwJtp+Utns2q8bo7WqVDGBqkg57lZs=; b=a7YrWukuo7W9NDGAlwuIfBOboS+9x85PK/dXiTls8SDY/ja2RJwo3jDpiQF3/QbyUK 28zlWo5JdSCn737c6gSBOhSEoVmqyMnX5oPODtzMKtC2qGZLc1aa1fbeImjP9mUh0Wgv U3X51Vtj3m6E2xuS/nks7CKGOVF6+12lb7IoU= 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=TorG+EtHjFaRGvwJtp+Utns2q8bo7WqVDGBqkg57lZs=; b=eaniTB00EWtDBZC6c0eLPBHVOkzzKUrGOVRoCiNyA8qz7ONv8nKBSNj69TGCJ481/d CX2M29OwRdzZcVAsCC63kShvbA2ADiVHycauMSHGoiYyxs8nYpuzcrxbPD8lZrTz/9V0 nIooOFOd3cZhkunVN+9kewAvGct+NfvpSjh3IHJfx2udJOmgs35PepDS/ULTYObBA0+a fpQpZdndj3ihreOG2Mr9QaT9gwMgPSDHZt6TEiw/V05aRm1oGk/7szYzUVvWidT/9Dje cF/88dIq5mFq4yO+DSUsNYThVGp9R28i9oXLDSli9CBDu+rCbLEo4ihAM0RHVu6x3WXU Iqtw== X-Gm-Message-State: AIkVDXL70gmBeF41F7ATymYIJ+1G4nNq3K76nNdg/XNBheeXRbG/QOS/B7gbYqJcrx6B2Spd X-Received: by 10.46.22.15 with SMTP id w15mr9226935ljd.35.1485858091500; Tue, 31 Jan 2017 02:21:31 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x64sm4462959lfd.15.2017.01.31.02.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jan 2017 02:21:30 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Andy Gross , Bjorn Andersson Cc: Stephen Boyd , David Brown , Linus Walleij Subject: [PATCH 1/2] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060 Date: Tue, 31 Jan 2017 11:21:13 +0100 Message-Id: <20170131102114.25085-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 --- Andy: these bindings have been merged to the IIO tree and ACKed by DT maintainers. --- arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 27 ++++++++++++ arch/arm/boot/dts/qcom-msm8660.dtsi | 59 ++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts index 39d9e6ddefed..c04960371c5e 100644 --- a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts +++ b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts @@ -327,6 +327,33 @@ }; }; + xoadc@197 { + /* Reference voltage 2.2 V */ + xoadc-ref-supply = <&pm8058_l18>; + + /* Board-specific channels */ + mpp5 { + /* Connected to AOUT of ALS sensor */ + reg = <0x05>; + }; + mpp6 { + /* Connected to test point TP43 */ + reg = <0x06>; + }; + mpp7 { + /* Connected to battery thermistor */ + reg = <0x07>; + }; + mpp8 { + /* Connected to battery ID detector */ + reg = <0x08>; + }; + mpp9 { + /* Connected to XO thermistor */ + reg = <0x09>; + }; + }; + led@48 { /* * The keypad LED @0x48 is routed to diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi index 91c9a62ae725..5ca6df54f9b5 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 0x01>, /* Battery */ + <&xoadc 0x02>, /* DC in (charger) */ + <&xoadc 0x04>, /* VPH the main system voltage */ + <&xoadc 0x0b>, /* Die temperature */ + <&xoadc 0x0c>, /* Reference voltage 1.25V */ + <&xoadc 0x0d>, /* Reference voltage 0.625V */ + <&xoadc 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 = <1>; + #size-cells = <0>; + #io-channel-cells = <1>; + + vcoin: adc-channel@0 { + reg = <0x00>; + }; + vbat: adc-channel@1 { + reg = <0x01>; + }; + dcin: adc-channel@2 { + reg = <0x02>; + }; + ichg: adc-channel@3 { + reg = <0x03>; + }; + vph_pwr: adc-channel@4 { + reg = <0x04>; + }; + usb_vbus: adc-channel@a { + reg = <0x0a>; + }; + die_temp: adc-channel@b { + reg = <0x0b>; + }; + ref_625mv: adc-channel@c { + reg = <0x0c>; + }; + ref_1250mv: adc-channel@d { + reg = <0x0d>; + }; + ref_325mv: adc-channel@e { + reg = <0x0e>; + }; + ref_muxoff: adc-channel@f { + reg = <0x0f>; + }; + }; + rtc@1e8 { compatible = "qcom,pm8058-rtc"; reg = <0x1e8>;