From patchwork Wed Feb 28 10:16:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10247109 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 D358160212 for ; Wed, 28 Feb 2018 10:19:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B180328B57 for ; Wed, 28 Feb 2018 10:19:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5FED28C87; Wed, 28 Feb 2018 10:19:07 +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 8BD3F28C74 for ; Wed, 28 Feb 2018 10:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752173AbeB1KTF (ORCPT ); Wed, 28 Feb 2018 05:19:05 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:38714 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbeB1KTE (ORCPT ); Wed, 28 Feb 2018 05:19:04 -0500 Received: by mail-lf0-f67.google.com with SMTP id i80so2692226lfg.5 for ; Wed, 28 Feb 2018 02:19:04 -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=xxIuJ7p4EHQDb4no0UpiYhq72aP8qwS8KN+A0yQHpzA=; b=BDR4iODCGi5oI/VLKSw/taMxqnN+qHeOMqhUB2x105ALgJmVRaSHDbqReBUNar9FnJ k8FzgJJtx68Ookd7ZVpB6mFJSX+eANp5SR4ukhfCnGuv2cleXMARTJh0xhqPY2GhNHFV 89FlEPZ88RA834X/dqy+SySg/khd/flK+65fI= 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=xxIuJ7p4EHQDb4no0UpiYhq72aP8qwS8KN+A0yQHpzA=; b=ZZ6+AmVuy1GlSEWQdxL3ldb0HcbAhCcKDRQZlN7iLEH0jRBX2WbZqviwvRtihrQBnI tCYT0lcrT2XJ3N12alff3xORmymyBSuGrIyM3hs6xGNlplMj9DgDfPXqqWhcz2jrcPpd U+wpYWRa7FHp5ejiOqH72ESNCvPHVJrimoapLbLatqRfeZLCMYteHBjqZn7wfSJhFEEm fYy6yaF7ZzvEuh3fHejmxJ1f6QAj8qmSAfcgrcHOPWfsxwBxAzb1quO5kbQ0H+XDoBgZ AD3/uHp8tP8bYL/QR3SbwVskBrR2feOZvgJToBzJ1Bn7OZYVyfNbh7oaarpmCgjp0O75 2BhQ== X-Gm-Message-State: APf1xPA5sfyPJpgCYYQJd4rRnkunGto+vXao5eNU+6kMXtocBm5JrLOL vyE7i68SOKcCTTpH3FzYL/NBQA== X-Google-Smtp-Source: AG47ELsIILQxFCYWixKDzRFGmjNJ0udKGfD70ppCGbEK9pVDUn809If0FI7JFt14GmVMg40Bidcf5Q== X-Received: by 10.25.34.81 with SMTP id i78mr3953375lfi.50.1519813143297; Wed, 28 Feb 2018 02:19:03 -0800 (PST) Received: from localhost.localdomain (c-cb7471d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.116.203]) by smtp.gmail.com with ESMTPSA id w8sm285347lje.75.2018.02.28.02.19.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 02:19:02 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Andy Gross , David Brown Cc: Stephen Boyd , Bjorn Andersson , linux-soc@vger.kernel.org, Linus Walleij , John Stultz Subject: [PATCH] ARM: dts: add XOADC and IIO HWMON to APQ8064 Date: Wed, 28 Feb 2018 11:16:58 +0100 Message-Id: <20180228101658.28603-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.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 PM8921 XOADC node to the PM8921 PMIC node, defines the 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 Nexus 7 tablet: lsiio Device 000: PM8921-XOADC cd /sys/bus/iio/devices/iio:device0 cat in_voltage10_input 616461 (0.625V reference voltage) cat in_voltage11_input (1.25V reference voltage) cat temp1_input 35852 (die temperature) Cc: John Stultz Signed-off-by: Linus Walleij --- arch/arm/boot/dts/qcom-apq8064.dtsi | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi index 3ca96e361878..5341a39c0392 100644 --- a/arch/arm/boot/dts/qcom-apq8064.dtsi +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi @@ -316,6 +316,23 @@ }; }; + + /* + * 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>; /* Charger temperature */ + }; + soc: soc { #address-cells = <1>; #size-cells = <1>; @@ -770,6 +787,52 @@ debounce = <15625>; pull-up; }; + + xoadc: xoadc@197 { + compatible = "qcom,pm8921-adc"; + reg = <197>; + interrupts-extended = <&pmicintc 78 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>; + }; + vph_pwr: adc-channel@04 { + reg = <0x00 0x04>; + }; + batt_therm: adc-channel@08 { + reg = <0x00 0x08>; + }; + batt_id: adc-channel@09 { + reg = <0x00 0x09>; + }; + 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>; + }; + chg_temp: adc-channel@0e { + reg = <0x00 0x0e>; + }; + ref_muxoff: adc-channel@0f { + reg = <0x00 0x0f>; + }; + }; }; };