From patchwork Tue Dec 6 13:50:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 86839 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2023464qgi; Tue, 6 Dec 2016 05:51:10 -0800 (PST) X-Received: by 10.99.65.65 with SMTP id o62mr112458476pga.73.1481032270156; Tue, 06 Dec 2016 05:51:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si19556137plg.334.2016.12.06.05.51.09; Tue, 06 Dec 2016 05:51:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753100AbcLFNvI (ORCPT + 7 others); Tue, 6 Dec 2016 08:51:08 -0500 Received: from mail-wj0-f170.google.com ([209.85.210.170]:36466 "EHLO mail-wj0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752957AbcLFNvH (ORCPT ); Tue, 6 Dec 2016 08:51:07 -0500 Received: by mail-wj0-f170.google.com with SMTP id tk12so26669205wjb.3 for ; Tue, 06 Dec 2016 05:51:06 -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=3XlNMKzYM+Hfud7BgcGXxsEqBbG+mqSHpSpleSmH9Ao=; b=D34CJXVABQpg0PCA6tzIFWvaLWDmrDrFmeY5tyblWSgeaveGHML2Tm++yvbphPM5XT FRbBYmKTj/EDXWsPbaH5YU9rFx+WHUbO7q5VjhDWpytAfxNCj4HiUZB6uWP0sALU9wSV 2wMYHNDz54spxy/j4rx+lG+oD5VAsApn6i7Yg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3XlNMKzYM+Hfud7BgcGXxsEqBbG+mqSHpSpleSmH9Ao=; b=nK6GOSYmznNI0diW7Yj7m0q2hIU1t2/vKgW9XYfp0pHAqmUewlR8SH8ZHPloOZugDs N8qPD8b7rcMyPfr4GxOCd6VUdSL+eDvgue2kG6A9wTy+lTX1DBl5oifilovFnxKgCzfm EqB3fRzfa4+Ui6cO9no6DQXFM73NgvP6gAqwlr8hFvPq9lBQ45dbQITeQYCO/ZQxco8Y 9JHXPo3gigL3RiyZs8y5rZSmGksTBUNfzBSlAVJF/C/8c92UJQJqn1WV/k16mvXD0KHU /JRhahIT3O2u+bDvemyJ1jvbC4emDkJzS/GZd6xgxkdxv5AZU0oo2BVmIpY83th8j7kd 23/A== X-Gm-Message-State: AKaTC00p+ZaJ/ggI4Uqci4uDnu4HtuoL8+Y+HIlBiq764ZYADH18CHNaus0LhzbvsQ/47FlU X-Received: by 10.25.27.145 with SMTP id b139mr19954573lfb.114.1481032265133; Tue, 06 Dec 2016 05:51:05 -0800 (PST) Received: from linuslaptop.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c25sm1329038ljb.32.2016.12.06.05.51.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 05:51:04 -0800 (PST) From: Linus Walleij To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: Linus Walleij , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, "Ivan T . Ivanov" , Andy Gross , Bjorn Andersson , Stephen Boyd Subject: [PATCH 1/3] iio: adc: add device tree bindings for Qualcomm PM8xxx ADCs Date: Tue, 6 Dec 2016 14:50:53 +0100 Message-Id: <1481032253-27019-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds the device tree bindings for the Qualcomm PM8xxx ADCs. This is based on the existing DT bindings for the SPMI ADC so there are hopefully no controversial features. Cc: devicetree@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: Ivan T. Ivanov Cc: Andy Gross Cc: Bjorn Andersson Cc: Stephen Boyd Signed-off-by: Linus Walleij --- .../bindings/iio/adc/qcom,pm8xxx-xoadc.txt | 160 +++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt b/Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt new file mode 100644 index 000000000000..6e51e3e74b88 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/qcom,pm8xxx-xoadc.txt @@ -0,0 +1,160 @@ +Qualcomm's PM8xxx voltage XOADC + +The Qualcomm PM8xxx PMICs contain a HK/XO ADC (Housekeeping/Chrystal +oscillator ADC) encompass PM8018, PM8038, PM8058, PM8917 and PM8921. + +Required properties: + +- compatible: should be one of: + "qcom,pm8018-adc" + "qcom,pm8038-adc" + "qcom,pm8058-adc" + "qcom,pm8917-adc" + "qcom,pm8921-adc" + +- reg: should contain the ADC base address in the PMIC, typically + 0x197. + +The following required properties are standard for IO channels, see +iio-bindings.txt for more details: + +- #address-cells: should be set to <1> + +- #size-cells: should be set to <0> + +- #io-channel-cells: should be set to <1> + +- interrupts: should refer to the parent PMIC interrupt controller + and reference the proper ADC interrupt. + +Required subnodes: + +The ADC channels are configured as subnodes of the ADC. Since some of +them are used for calibrating the ADC, these nodes are compulsory: + +ref_625mv { + reg = <0x0c>; +}; + +ref_1250mv { + reg = <0x0d>; +}; + +ref_muxoff { + reg = <0x0f>; +}; + +These three nodes are used for absolute and ratiometric calibration +and only need to have these reg values: they are by hardware defined +to be 1:1 ratio converters that sample 625, 1250 and 0 V and create +an interpolation calibration for all other ADCs. + +Optional subnodes: any channels other than channel 0x0c, 0x0d and +0x0f are optional. + +Required channel node properties: + +- reg: should contain the hardware channel number in the range + 0 .. 0x0f (4 bits). The hardware only supports 16 channels. + +Optional channel node properties: + +- qcom,decimation: + Value type: + Definition: This parameter is used to decrease ADC sampling rate. + Quicker measurements can be made by reducing decimation ratio. + Valid values are 512, 1024, 2048, 4096. + If property is not found, default value of 512 will be used. + +- qcom,ratiometric: + Value type: + Definition: Channel calibration type. If this property is specified + VADC will use the VDD reference (1.8V) and GND for channel + calibration. If property is not found, channel will be + calibrated with 0.625V and 1.25V reference channels, also + known as absolute calibration. + +- qcom,ratiometric-ref: + Value type: + Definition: The reference voltage pair when using ratiometric + calibration: + 0 = XO_IN/XOADC_GND + 1 = PMIC_IN/XOADC_GND + 2 = PMIC_IN/BMS_CSP + 3 (invalid) + 4 = XOADC_GND/XOADC_GND + 5 = XOADC_VREF/XOADC_GND + +Example: + +xoadc: xoadc@197 { + compatible = "qcom,pm8058-adc"; + reg = <0x197>; + interrupt-parent = <&pm8058>; + interrupts = <76 1>; + #address-cells = <1>; + #size-cells = <0>; + #io-channel-cells = <1>; + + vcoin { + reg = <0x00>; + }; + vbat { + reg = <0x01>; + }; + dcin { + reg = <0x02>; + }; + ichg { + reg = <0x03>; + }; + vph_pwr { + reg = <0x04>; + }; + mpp5 { + reg = <0x05>; + }; + mpp6 { + reg = <0x06>; + }; + mpp7 { + reg = <0x07>; + }; + mpp8 { + reg = <0x08>; + }; + mpp9 { + reg = <0x09>; + }; + usb_vbus { + reg = <0x0a>; + }; + die_temp { + reg = <0x0b>; + }; + ref_625mv { + reg = <0x0c>; + }; + ref_1250mv { + reg = <0x0d>; + }; + ref_325mv { + reg = <0x0e>; + }; + ref_muxoff { + reg = <0x0f>; + }; +}; + + +/* IIO client node */ +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 */ +};