aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddartha Mohanadoss <smohanad@codeaurora.org>2018-08-02 21:43:38 -0400
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-08-03 17:37:03 -0400
commit2fca585502716c25c52ad4fe54207f80762bc7b4 (patch)
tree66985a35ae7524ea858b2addfe1fc26da09db558
parent5e45729608dd231a771817c7af4e2be61ef3b659 (diff)
dt-bindings: iio: adc: Add DT binding document for PMIC5 ADC
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 <smohanad@codeaurora.org> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt77
-rw-r--r--include/dt-bindings/iio/qcom,spmi-vadc.h115
2 files changed, 172 insertions, 20 deletions
diff --git a/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt
index 0fb46137f936..8498f11d06cd 100644
--- a/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt
+++ b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt
@@ -1,7 +1,9 @@
1Qualcomm's SPMI PMIC voltage ADC 1Qualcomm's SPMI PMIC ADC
2 2
3SPMI PMIC voltage ADC (VADC) provides interface to clients to read 3- SPMI PMIC voltage ADC (VADC) provides interface to clients to read
4voltage. The VADC is a 15-bit sigma-delta ADC. 4 voltage. The VADC is a 15-bit sigma-delta ADC.
5- SPMI PMIC5 voltage ADC (ADC) provides interface to clients to read
6 voltage. The VADC is a 16-bit sigma-delta ADC.
5 7
6VADC node: 8VADC node:
7 9
@@ -9,6 +11,8 @@ VADC node:
9 Usage: required 11 Usage: required
10 Value type: <string> 12 Value type: <string>
11 Definition: Should contain "qcom,spmi-vadc". 13 Definition: Should contain "qcom,spmi-vadc".
14 Should contain "qcom,spmi-adc5" for PMIC5 ADC driver.
15 Should contain "qcom,spmi-adc-rev2" for PMIC rev2 ADC driver.
12 16
13- reg: 17- reg:
14 Usage: required 18 Usage: required
@@ -45,13 +49,26 @@ Channel node properties:
45 Definition: ADC channel number. 49 Definition: ADC channel number.
46 See include/dt-bindings/iio/qcom,spmi-vadc.h 50 See include/dt-bindings/iio/qcom,spmi-vadc.h
47 51
52- label:
53 Usage: required for "qcom,spmi-adc5" and "qcom,spmi-adc-rev2"
54 Value type: <empty>
55 Definition: ADC input of the platform as seen in the schematics.
56 For thermistor inputs connected to generic AMUX or GPIO inputs
57 these can vary across platform for the same pins. Hence select
58 the platform schematics name for this channel.
59
48- qcom,decimation: 60- qcom,decimation:
49 Usage: optional 61 Usage: optional
50 Value type: <u32> 62 Value type: <u32>
51 Definition: This parameter is used to decrease ADC sampling rate. 63 Definition: This parameter is used to decrease ADC sampling rate.
52 Quicker measurements can be made by reducing decimation ratio. 64 Quicker measurements can be made by reducing decimation ratio.
53 Valid values are 512, 1024, 2048, 4096. 65 - For compatible property "qcom,spmi-vadc", valid values are
54 If property is not found, default value of 512 will be used. 66 512, 1024, 2048, 4096. If property is not found, default value
67 of 512 will be used.
68 - For compatible property "qcom,spmi-adc5", valid values are 250, 420
69 and 840. If property is not found, default value of 840 is used.
70 - For compatible property "qcom,spmi-adc-rev2", valid values are 256,
71 512 and 1024. If property is not present, default value is 1024.
55 72
56- qcom,pre-scaling: 73- qcom,pre-scaling:
57 Usage: optional 74 Usage: optional
@@ -66,21 +83,38 @@ Channel node properties:
66- qcom,ratiometric: 83- qcom,ratiometric:
67 Usage: optional 84 Usage: optional
68 Value type: <empty> 85 Value type: <empty>
69 Definition: Channel calibration type. If this property is specified 86 Definition: Channel calibration type.
70 VADC will use the VDD reference (1.8V) and GND for channel 87 - For compatible property "qcom,spmi-vadc", if this property is
71 calibration. If property is not found, channel will be 88 specified VADC will use the VDD reference (1.8V) and GND for
72 calibrated with 0.625V and 1.25V reference channels, also 89 channel calibration. If property is not found, channel will be
73 known as absolute calibration. 90 calibrated with 0.625V and 1.25V reference channels, also
91 known as absolute calibration.
92 - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
93 if this property is specified VADC will use the VDD reference
94 (1.875V) and GND for channel calibration. If property is not found,
95 channel will be calibrated with 0V and 1.25V reference channels,
96 also known as absolute calibration.
74 97
75- qcom,hw-settle-time: 98- qcom,hw-settle-time:
76 Usage: optional 99 Usage: optional
77 Value type: <u32> 100 Value type: <u32>
78 Definition: Time between AMUX getting configured and the ADC starting 101 Definition: Time between AMUX getting configured and the ADC starting
79 conversion. Delay = 100us * (value) for value < 11, and 102 conversion. The 'hw_settle_time' is an index used from valid values
80 2ms * (value - 10) otherwise. 103 and programmed in hardware to achieve the hardware settling delay.
81 Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800, 104 - For compatible property "qcom,spmi-vadc" and "qcom,spmi-adc-rev2",
82 900 us and 1, 2, 4, 6, 8, 10 ms 105 Delay = 100us * (hw_settle_time) for hw_settle_time < 11,
83 If property is not found, channel will use 0us. 106 and 2ms * (hw_settle_time - 10) otherwise.
107 Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800,
108 900 us and 1, 2, 4, 6, 8, 10 ms.
109 If property is not found, channel will use 0us.
110 - For compatible property "qcom,spmi-adc5", delay = 15us for
111 value 0, 100us * (value) for values < 11,
112 and 2ms * (value - 10) otherwise.
113 Valid values are: 15, 100, 200, 300, 400, 500, 600, 700, 800,
114 900 us and 1, 2, 4, 6, 8, 10 ms
115 Certain controller digital versions have valid values of
116 15, 100, 200, 300, 400, 500, 600, 700, 1, 2, 4, 8, 16, 32, 64, 128 ms
117 If property is not found, channel will use 15us.
84 118
85- qcom,avg-samples: 119- qcom,avg-samples:
86 Usage: optional 120 Usage: optional
@@ -89,13 +123,18 @@ Channel node properties:
89 Averaging provides the option to obtain a single measurement 123 Averaging provides the option to obtain a single measurement
90 from the ADC that is an average of multiple samples. The value 124 from the ADC that is an average of multiple samples. The value
91 selected is 2^(value). 125 selected is 2^(value).
92 Valid values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 126 - For compatible property "qcom,spmi-vadc", valid values
93 If property is not found, 1 sample will be used. 127 are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
128 If property is not found, 1 sample will be used.
129 - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
130 valid values are: 1, 2, 4, 8, 16
131 If property is not found, 1 sample will be used.
94 132
95NOTE: 133NOTE:
96 134
97Following channels, also known as reference point channels, are used for 135For compatible property "qcom,spmi-vadc" following channels, also known as
98result calibration and their channel configuration nodes should be defined: 136reference point channels, are used for result calibration and their channel
137configuration nodes should be defined:
99VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV, 138VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
100VADC_GND_REF and VADC_VDD_VADC. 139VADC_GND_REF and VADC_VDD_VADC.
101 140
diff --git a/include/dt-bindings/iio/qcom,spmi-vadc.h b/include/dt-bindings/iio/qcom,spmi-vadc.h
index 42121fa238fa..bf54b5adc065 100644
--- a/include/dt-bindings/iio/qcom,spmi-vadc.h
+++ b/include/dt-bindings/iio/qcom,spmi-vadc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. 2 * Copyright (c) 2012-2014,2018 The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
@@ -116,4 +116,117 @@
116#define VADC_LR_MUX10_PU1_PU2_AMUX_USB_ID 0xf9 116#define VADC_LR_MUX10_PU1_PU2_AMUX_USB_ID 0xf9
117#define VADC_LR_MUX3_BUF_PU1_PU2_XO_THERM 0xfc 117#define VADC_LR_MUX3_BUF_PU1_PU2_XO_THERM 0xfc
118 118
119/* ADC channels for SPMI PMIC5 */
120
121#define ADC5_REF_GND 0x00
122#define ADC5_1P25VREF 0x01
123#define ADC5_VREF_VADC 0x02
124#define ADC5_VREF_VADC5_DIV_3 0x82
125#define ADC5_VPH_PWR 0x83
126#define ADC5_VBAT_SNS 0x84
127#define ADC5_VCOIN 0x85
128#define ADC5_DIE_TEMP 0x06
129#define ADC5_USB_IN_I 0x07
130#define ADC5_USB_IN_V_16 0x08
131#define ADC5_CHG_TEMP 0x09
132#define ADC5_BAT_THERM 0x0a
133#define ADC5_BAT_ID 0x0b
134#define ADC5_XO_THERM 0x0c
135#define ADC5_AMUX_THM1 0x0d
136#define ADC5_AMUX_THM2 0x0e
137#define ADC5_AMUX_THM3 0x0f
138#define ADC5_AMUX_THM4 0x10
139#define ADC5_AMUX_THM5 0x11
140#define ADC5_GPIO1 0x12
141#define ADC5_GPIO2 0x13
142#define ADC5_GPIO3 0x14
143#define ADC5_GPIO4 0x15
144#define ADC5_GPIO5 0x16
145#define ADC5_GPIO6 0x17
146#define ADC5_GPIO7 0x18
147#define ADC5_SBUx 0x99
148#define ADC5_MID_CHG_DIV6 0x1e
149#define ADC5_OFF 0xff
150
151/* 30k pull-up1 */
152#define ADC5_BAT_THERM_30K_PU 0x2a
153#define ADC5_BAT_ID_30K_PU 0x2b
154#define ADC5_XO_THERM_30K_PU 0x2c
155#define ADC5_AMUX_THM1_30K_PU 0x2d
156#define ADC5_AMUX_THM2_30K_PU 0x2e
157#define ADC5_AMUX_THM3_30K_PU 0x2f
158#define ADC5_AMUX_THM4_30K_PU 0x30
159#define ADC5_AMUX_THM5_30K_PU 0x31
160#define ADC5_GPIO1_30K_PU 0x32
161#define ADC5_GPIO2_30K_PU 0x33
162#define ADC5_GPIO3_30K_PU 0x34
163#define ADC5_GPIO4_30K_PU 0x35
164#define ADC5_GPIO5_30K_PU 0x36
165#define ADC5_GPIO6_30K_PU 0x37
166#define ADC5_GPIO7_30K_PU 0x38
167#define ADC5_SBUx_30K_PU 0x39
168
169/* 100k pull-up2 */
170#define ADC5_BAT_THERM_100K_PU 0x4a
171#define ADC5_BAT_ID_100K_PU 0x4b
172#define ADC5_XO_THERM_100K_PU 0x4c
173#define ADC5_AMUX_THM1_100K_PU 0x4d
174#define ADC5_AMUX_THM2_100K_PU 0x4e
175#define ADC5_AMUX_THM3_100K_PU 0x4f
176#define ADC5_AMUX_THM4_100K_PU 0x50
177#define ADC5_AMUX_THM5_100K_PU 0x51
178#define ADC5_GPIO1_100K_PU 0x52
179#define ADC5_GPIO2_100K_PU 0x53
180#define ADC5_GPIO3_100K_PU 0x54
181#define ADC5_GPIO4_100K_PU 0x55
182#define ADC5_GPIO5_100K_PU 0x56
183#define ADC5_GPIO6_100K_PU 0x57
184#define ADC5_GPIO7_100K_PU 0x58
185#define ADC5_SBUx_100K_PU 0x59
186
187/* 400k pull-up3 */
188#define ADC5_BAT_THERM_400K_PU 0x6a
189#define ADC5_BAT_ID_400K_PU 0x6b
190#define ADC5_XO_THERM_400K_PU 0x6c
191#define ADC5_AMUX_THM1_400K_PU 0x6d
192#define ADC5_AMUX_THM2_400K_PU 0x6e
193#define ADC5_AMUX_THM3_400K_PU 0x6f
194#define ADC5_AMUX_THM4_400K_PU 0x70
195#define ADC5_AMUX_THM5_400K_PU 0x71
196#define ADC5_GPIO1_400K_PU 0x72
197#define ADC5_GPIO2_400K_PU 0x73
198#define ADC5_GPIO3_400K_PU 0x74
199#define ADC5_GPIO4_400K_PU 0x75
200#define ADC5_GPIO5_400K_PU 0x76
201#define ADC5_GPIO6_400K_PU 0x77
202#define ADC5_GPIO7_400K_PU 0x78
203#define ADC5_SBUx_400K_PU 0x79
204
205/* 1/3 Divider */
206#define ADC5_GPIO1_DIV3 0x92
207#define ADC5_GPIO2_DIV3 0x93
208#define ADC5_GPIO3_DIV3 0x94
209#define ADC5_GPIO4_DIV3 0x95
210#define ADC5_GPIO5_DIV3 0x96
211#define ADC5_GPIO6_DIV3 0x97
212#define ADC5_GPIO7_DIV3 0x98
213#define ADC5_SBUx_DIV3 0x99
214
215/* Current and combined current/voltage channels */
216#define ADC5_INT_EXT_ISENSE 0xa1
217#define ADC5_PARALLEL_ISENSE 0xa5
218#define ADC5_CUR_REPLICA_VDS 0xa7
219#define ADC5_CUR_SENS_BATFET_VDS_OFFSET 0xa9
220#define ADC5_CUR_SENS_REPLICA_VDS_OFFSET 0xab
221#define ADC5_EXT_SENS_OFFSET 0xad
222
223#define ADC5_INT_EXT_ISENSE_VBAT_VDATA 0xb0
224#define ADC5_INT_EXT_ISENSE_VBAT_IDATA 0xb1
225#define ADC5_EXT_ISENSE_VBAT_VDATA 0xb2
226#define ADC5_EXT_ISENSE_VBAT_IDATA 0xb3
227#define ADC5_PARALLEL_ISENSE_VBAT_VDATA 0xb4
228#define ADC5_PARALLEL_ISENSE_VBAT_IDATA 0xb5
229
230#define ADC5_MAX_CHANNEL 0xc0
231
119#endif /* _DT_BINDINGS_QCOM_SPMI_VADC_H */ 232#endif /* _DT_BINDINGS_QCOM_SPMI_VADC_H */