aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanimir Varbanov <svarbanov@mm-sol.com>2015-01-20 05:15:21 -0500
committerJonathan Cameron <jic23@kernel.org>2015-01-28 13:42:00 -0500
commitd3ba5586facfc038110333b5ce17f8bfccbcaddf (patch)
treebaa06c3530c06d1dc76a70f5e70a30ebe5a77149
parent2d8339d0ec7986d4654003f4da88e17ea14c1779 (diff)
DT: iio: vadc: document dt binding
Document DT binding for Qualcomm SPMI PMIC voltage ADC driver. Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt129
-rw-r--r--include/dt-bindings/iio/qcom,spmi-vadc.h119
2 files changed, 248 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt
new file mode 100644
index 000000000000..0fb46137f936
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt
@@ -0,0 +1,129 @@
1Qualcomm's SPMI PMIC voltage ADC
2
3SPMI PMIC voltage ADC (VADC) provides interface to clients to read
4voltage. The VADC is a 15-bit sigma-delta ADC.
5
6VADC node:
7
8- compatible:
9 Usage: required
10 Value type: <string>
11 Definition: Should contain "qcom,spmi-vadc".
12
13- reg:
14 Usage: required
15 Value type: <prop-encoded-array>
16 Definition: VADC base address and length in the SPMI PMIC register map.
17
18- #address-cells:
19 Usage: required
20 Value type: <u32>
21 Definition: Must be one. Child node 'reg' property should define ADC
22 channel number.
23
24- #size-cells:
25 Usage: required
26 Value type: <u32>
27 Definition: Must be zero.
28
29- #io-channel-cells:
30 Usage: required
31 Value type: <u32>
32 Definition: Must be one. For details about IIO bindings see:
33 Documentation/devicetree/bindings/iio/iio-bindings.txt
34
35- interrupts:
36 Usage: optional
37 Value type: <prop-encoded-array>
38 Definition: End of conversion interrupt.
39
40Channel node properties:
41
42- reg:
43 Usage: required
44 Value type: <u32>
45 Definition: ADC channel number.
46 See include/dt-bindings/iio/qcom,spmi-vadc.h
47
48- qcom,decimation:
49 Usage: optional
50 Value type: <u32>
51 Definition: This parameter is used to decrease ADC sampling rate.
52 Quicker measurements can be made by reducing decimation ratio.
53 Valid values are 512, 1024, 2048, 4096.
54 If property is not found, default value of 512 will be used.
55
56- qcom,pre-scaling:
57 Usage: optional
58 Value type: <u32 array>
59 Definition: Used for scaling the channel input signal before the signal is
60 fed to VADC. The configuration for this node is to know the
61 pre-determined ratio and use it for post scaling. Select one from
62 the following options.
63 <1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10>
64 If property is not found default value depending on chip will be used.
65
66- qcom,ratiometric:
67 Usage: optional
68 Value type: <empty>
69 Definition: Channel calibration type. If this property is specified
70 VADC will use the VDD reference (1.8V) and GND for channel
71 calibration. If property is not found, channel will be
72 calibrated with 0.625V and 1.25V reference channels, also
73 known as absolute calibration.
74
75- qcom,hw-settle-time:
76 Usage: optional
77 Value type: <u32>
78 Definition: Time between AMUX getting configured and the ADC starting
79 conversion. Delay = 100us * (value) for value < 11, and
80 2ms * (value - 10) otherwise.
81 Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800,
82 900 us and 1, 2, 4, 6, 8, 10 ms
83 If property is not found, channel will use 0us.
84
85- qcom,avg-samples:
86 Usage: optional
87 Value type: <u32>
88 Definition: Number of samples to be used for measurement.
89 Averaging provides the option to obtain a single measurement
90 from the ADC that is an average of multiple samples. The value
91 selected is 2^(value).
92 Valid values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
93 If property is not found, 1 sample will be used.
94
95NOTE:
96
97Following channels, also known as reference point channels, are used for
98result calibration and their channel configuration nodes should be defined:
99VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
100VADC_GND_REF and VADC_VDD_VADC.
101
102Example:
103
104 /* VADC node */
105 pmic_vadc: vadc@3100 {
106 compatible = "qcom,spmi-vadc";
107 reg = <0x3100 0x100>;
108 interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
109 #address-cells = <1>;
110 #size-cells = <0>;
111 #io-channel-cells = <1>;
112 io-channel-ranges;
113
114 /* Channel node */
115 usb_id_nopull {
116 reg = <VADC_LR_MUX10_USB_ID>;
117 qcom,decimation = <512>;
118 qcom,ratiometric;
119 qcom,hw-settle-time = <200>;
120 qcom,avg-samples = <1>;
121 qcom,pre-scaling = <1 3>;
122 };
123 };
124
125 /* IIO client node */
126 usb {
127 io-channels = <&pmic_vadc VADC_LR_MUX10_USB_ID>;
128 io-channel-names = "vadc";
129 };
diff --git a/include/dt-bindings/iio/qcom,spmi-vadc.h b/include/dt-bindings/iio/qcom,spmi-vadc.h
new file mode 100644
index 000000000000..42121fa238fa
--- /dev/null
+++ b/include/dt-bindings/iio/qcom,spmi-vadc.h
@@ -0,0 +1,119 @@
1/*
2 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
3 *
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
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_QCOM_SPMI_VADC_H
15#define _DT_BINDINGS_QCOM_SPMI_VADC_H
16
17/* Voltage ADC channels */
18#define VADC_USBIN 0x00
19#define VADC_DCIN 0x01
20#define VADC_VCHG_SNS 0x02
21#define VADC_SPARE1_03 0x03
22#define VADC_USB_ID_MV 0x04
23#define VADC_VCOIN 0x05
24#define VADC_VBAT_SNS 0x06
25#define VADC_VSYS 0x07
26#define VADC_DIE_TEMP 0x08
27#define VADC_REF_625MV 0x09
28#define VADC_REF_1250MV 0x0a
29#define VADC_CHG_TEMP 0x0b
30#define VADC_SPARE1 0x0c
31#define VADC_SPARE2 0x0d
32#define VADC_GND_REF 0x0e
33#define VADC_VDD_VADC 0x0f
34
35#define VADC_P_MUX1_1_1 0x10
36#define VADC_P_MUX2_1_1 0x11
37#define VADC_P_MUX3_1_1 0x12
38#define VADC_P_MUX4_1_1 0x13
39#define VADC_P_MUX5_1_1 0x14
40#define VADC_P_MUX6_1_1 0x15
41#define VADC_P_MUX7_1_1 0x16
42#define VADC_P_MUX8_1_1 0x17
43#define VADC_P_MUX9_1_1 0x18
44#define VADC_P_MUX10_1_1 0x19
45#define VADC_P_MUX11_1_1 0x1a
46#define VADC_P_MUX12_1_1 0x1b
47#define VADC_P_MUX13_1_1 0x1c
48#define VADC_P_MUX14_1_1 0x1d
49#define VADC_P_MUX15_1_1 0x1e
50#define VADC_P_MUX16_1_1 0x1f
51
52#define VADC_P_MUX1_1_3 0x20
53#define VADC_P_MUX2_1_3 0x21
54#define VADC_P_MUX3_1_3 0x22
55#define VADC_P_MUX4_1_3 0x23
56#define VADC_P_MUX5_1_3 0x24
57#define VADC_P_MUX6_1_3 0x25
58#define VADC_P_MUX7_1_3 0x26
59#define VADC_P_MUX8_1_3 0x27
60#define VADC_P_MUX9_1_3 0x28
61#define VADC_P_MUX10_1_3 0x29
62#define VADC_P_MUX11_1_3 0x2a
63#define VADC_P_MUX12_1_3 0x2b
64#define VADC_P_MUX13_1_3 0x2c
65#define VADC_P_MUX14_1_3 0x2d
66#define VADC_P_MUX15_1_3 0x2e
67#define VADC_P_MUX16_1_3 0x2f
68
69#define VADC_LR_MUX1_BAT_THERM 0x30
70#define VADC_LR_MUX2_BAT_ID 0x31
71#define VADC_LR_MUX3_XO_THERM 0x32
72#define VADC_LR_MUX4_AMUX_THM1 0x33
73#define VADC_LR_MUX5_AMUX_THM2 0x34
74#define VADC_LR_MUX6_AMUX_THM3 0x35
75#define VADC_LR_MUX7_HW_ID 0x36
76#define VADC_LR_MUX8_AMUX_THM4 0x37
77#define VADC_LR_MUX9_AMUX_THM5 0x38
78#define VADC_LR_MUX10_USB_ID 0x39
79#define VADC_AMUX_PU1 0x3a
80#define VADC_AMUX_PU2 0x3b
81#define VADC_LR_MUX3_BUF_XO_THERM 0x3c
82
83#define VADC_LR_MUX1_PU1_BAT_THERM 0x70
84#define VADC_LR_MUX2_PU1_BAT_ID 0x71
85#define VADC_LR_MUX3_PU1_XO_THERM 0x72
86#define VADC_LR_MUX4_PU1_AMUX_THM1 0x73
87#define VADC_LR_MUX5_PU1_AMUX_THM2 0x74
88#define VADC_LR_MUX6_PU1_AMUX_THM3 0x75
89#define VADC_LR_MUX7_PU1_AMUX_HW_ID 0x76
90#define VADC_LR_MUX8_PU1_AMUX_THM4 0x77
91#define VADC_LR_MUX9_PU1_AMUX_THM5 0x78
92#define VADC_LR_MUX10_PU1_AMUX_USB_ID 0x79
93#define VADC_LR_MUX3_BUF_PU1_XO_THERM 0x7c
94
95#define VADC_LR_MUX1_PU2_BAT_THERM 0xb0
96#define VADC_LR_MUX2_PU2_BAT_ID 0xb1
97#define VADC_LR_MUX3_PU2_XO_THERM 0xb2
98#define VADC_LR_MUX4_PU2_AMUX_THM1 0xb3
99#define VADC_LR_MUX5_PU2_AMUX_THM2 0xb4
100#define VADC_LR_MUX6_PU2_AMUX_THM3 0xb5
101#define VADC_LR_MUX7_PU2_AMUX_HW_ID 0xb6
102#define VADC_LR_MUX8_PU2_AMUX_THM4 0xb7
103#define VADC_LR_MUX9_PU2_AMUX_THM5 0xb8
104#define VADC_LR_MUX10_PU2_AMUX_USB_ID 0xb9
105#define VADC_LR_MUX3_BUF_PU2_XO_THERM 0xbc
106
107#define VADC_LR_MUX1_PU1_PU2_BAT_THERM 0xf0
108#define VADC_LR_MUX2_PU1_PU2_BAT_ID 0xf1
109#define VADC_LR_MUX3_PU1_PU2_XO_THERM 0xf2
110#define VADC_LR_MUX4_PU1_PU2_AMUX_THM1 0xf3
111#define VADC_LR_MUX5_PU1_PU2_AMUX_THM2 0xf4
112#define VADC_LR_MUX6_PU1_PU2_AMUX_THM3 0xf5
113#define VADC_LR_MUX7_PU1_PU2_AMUX_HW_ID 0xf6
114#define VADC_LR_MUX8_PU1_PU2_AMUX_THM4 0xf7
115#define VADC_LR_MUX9_PU1_PU2_AMUX_THM5 0xf8
116#define VADC_LR_MUX10_PU1_PU2_AMUX_USB_ID 0xf9
117#define VADC_LR_MUX3_BUF_PU1_PU2_XO_THERM 0xfc
118
119#endif /* _DT_BINDINGS_QCOM_SPMI_VADC_H */