From patchwork Tue May 8 21:38:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddartha Mohanadoss X-Patchwork-Id: 10387613 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 87EE7602C2 for ; Tue, 8 May 2018 21:38:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6039728FFD for ; Tue, 8 May 2018 21:38:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54ABE2902D; Tue, 8 May 2018 21:38:41 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 BABF929003 for ; Tue, 8 May 2018 21:38:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755489AbeEHVik (ORCPT ); Tue, 8 May 2018 17:38:40 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52114 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755266AbeEHVii (ORCPT ); Tue, 8 May 2018 17:38:38 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 47B12600D0; Tue, 8 May 2018 21:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525815518; bh=QVXxdTVx+QK0khAPzBpYi6j1BGpHuFJc5Q6/farizjM=; h=From:To:Cc:Subject:Date:From; b=Wv0ej7AHQV9FkBbhx5Qk5qsT5YvAiUy5NhwtdsQ/ntmnL7c8ky6GUFz8PAA2gbNCH vRekcbY5C16/h0yraVBSHU8x3PQFJi71vLbG/ZNW/d3CXqfgvQMO7B2FKNX+HTK4PD 9UHwQ4QuY77u+EZP44pytzcykzbJCAi7KkRkLc/8= Received: from smohanad-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: smohanad@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E2E0460250; Tue, 8 May 2018 21:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525815517; bh=QVXxdTVx+QK0khAPzBpYi6j1BGpHuFJc5Q6/farizjM=; h=From:To:Cc:Subject:Date:From; b=FrTyKUBWel+QNJ2JH6sBEbIcZkwAdJ+C6+gqaF5IkX5oZjDlQhPmSxqekoWfeCKW3 PJMmJjp/vkiRH/2JjkoO9hEJyqfGkoeiAa4xPR1Gv85xBGoa472qA8+i7wHm2/jifQ e3zi4XAKqEXnSFAnYWLDW67YVEZVFU/8HoTxgPEg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E2E0460250 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=smohanad@codeaurora.org From: Siddartha Mohanadoss To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Rob Herring , cdevired@codeaurora.org, rphani@codeaurora.org, sivaa@codeaurora.org, Siddartha Mohanadoss Subject: [PATCH 1/2] dt-bindings: iio: adc: Add DT binding document for PMIC5 ADC Date: Tue, 8 May 2018 14:38:21 -0700 Message-Id: <1525815501-27588-1-git-send-email-smohanad@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PMIC5 ADC has support for clients to measure voltage and current on inputs connected to the PMIC. Clients include reading voltage phone power and on board system thermistors for thermal management. ADC5 on certain PMIC has support to read battery current. This change adds documentation. Signed-off-by: Siddartha Mohanadoss --- .../devicetree/bindings/iio/adc/qcom,spmi-adc5.txt | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/qcom,spmi-adc5.txt diff --git a/Documentation/devicetree/bindings/iio/adc/qcom,spmi-adc5.txt b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-adc5.txt new file mode 100644 index 0000000..c9268ba --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-adc5.txt @@ -0,0 +1,137 @@ +Qualcomm Technologies Inc. SPMI PMIC5 voltage and current ADC + +SPMI PMIC5 voltage ADC (ADC) provides interface to clients to read +voltage. The VADC is a 16-bit sigma-delta ADC. + +ADC node: + +- compatible: + Usage: required + Value type: + Definition: Should contain "qcom,spmi-adc5" for PMIC5 ADC driver. + Should contain "qcom,spmi-adc-rev2" for PMIC refresh ADC driver. + +- reg: + Usage: required + Value type: + Definition: VADC base address and length in the SPMI PMIC register map. + +- #address-cells: + Usage: required + Value type: + Definition: Must be one. Child node 'reg' property should define ADC + channel number. + +- #size-cells: + Usage: required + Value type: + Definition: Must be zero. + +- #io-channel-cells: + Usage: required + Value type: + Definition: Must be one. For details about IIO bindings see: + Documentation/devicetree/bindings/iio/iio-bindings.txt + +- interrupts: + Usage: optional + Value type: + Definition: End of conversion interrupt. + +Channel node properties: + +- reg: + Usage: required + Value type: + Definition: ADC channel number. + See include/dt-bindings/iio/qcom,spmi-vadc.h + +- label: + Usage: required + Value type: + Definition: ADC datasheet channel name. + For thermistor inputs connected to generic AMUX or GPIO inputs + these can vary across platform for the same pins. Hence select + the datasheet name for this channel. + +- qcom,pre-scaling: + Usage: required + Value type: + Definition: Used for scaling the channel input signal before the signal is + fed to VADC. The configuration for this node is to know the + pre-determined ratio and use it for post scaling. Select one from + the following options. + <1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10> + If property is not found default value depending on chip will be used. + +- qcom,decimation: + Usage: optional + Value type: + Definition: This parameter is used to decrease ADC sampling rate. + Quicker measurements can be made by reducing decimation ratio. + For PMIC5 ADC, combined two step decimation values are 250, 420 and 840. + If property is not found, default value of 840 will be used. + For PMIC refresh ADC, supported decimation values are 256, 512, 1024. + If property is not found, default value of 1024 will be used. + +- qcom,ratiometric: + Usage: optional + Value type: + Definition: Channel calibration type. If this property is specified + VADC will use the VDD reference (1.875V) and GND for channel + calibration. If property is not found, channel will be + calibrated with 0V and 1.25V reference channels, also + known as absolute calibration. + +- qcom,hw-settle-time: + Usage: optional + Value type: + Definition: Time between AMUX getting configured and the ADC starting + conversion. + For PMIC5, delay = 15us for value 0, + 100us * (value) for values 0 < value < 11, and + 2ms * (value - 10) otherwise. + Valid values are: 15, 100, 200, 300, 400, 500, 600, 700, 800, + 900 us and 1, 2, 4, 6, 8, 10 ms + If property is not found, channel will use 15us. + For PMIC rev2, delay = 100us * (value) for values 0 < value < 11, and + 2ms * (value - 10) otherwise. + Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800, + 900 us and 1, 2, 4, 6, 8, 10 ms + If property is not found, channel will use 0 us. + +- qcom,avg-samples: + Usage: optional + Value type: + Definition: Number of samples to be used for measurement. + Averaging provides the option to obtain a single measurement + from the ADC that is an average of multiple samples. The value + selected is 2^(value). + Valid values are: 1, 2, 4, 8, 16 + If property is not found, 1 sample will be used. + +Example: + + /* VADC node */ + pmic_vadc: vadc@3100 { + compatible = "qcom,spmi-adc5"; + reg = <0x3100 0x100>; + interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>; + #address-cells = <1>; + #size-cells = <0>; + #io-channel-cells = <1>; + io-channel-ranges; + + /* Channel node */ + vph_pwr { + reg = ; + label = "vph_pwr"; + qcom,pre-scaling = <1 3>; + }; + }; + + /* IIO client node */ + usb { + io-channels = <&pmic_vadc ADC_VPH_PWR>; + io-channel-names = "vadc"; + };