summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt
blob: c8787688122af921211a48d997c4935c2faabe5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
Qualcomm's SPMI PMIC ADC

- SPMI PMIC voltage ADC (VADC) provides interface to clients to read
  voltage. The VADC is a 15-bit sigma-delta ADC.
- SPMI PMIC5 voltage ADC (ADC) provides interface to clients to read
  voltage. The VADC is a 16-bit sigma-delta ADC.

VADC node:

- compatible:
    Usage: required
    Value type: <string>
    Definition: Should contain "qcom,spmi-vadc".
                Should contain "qcom,spmi-adc5" for PMIC5 ADC driver.
                Should contain "qcom,spmi-adc-rev2" for PMIC rev2 ADC driver.
                Should contain "qcom,pms405-adc" for PMS405 PMIC

- reg:
    Usage: required
    Value type: <prop-encoded-array>
    Definition: VADC base address in the SPMI PMIC register map.

- #address-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be one. Child node 'reg' property should define ADC
            channel number.

- #size-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be zero.

- #io-channel-cells:
    Usage: required
    Value type: <u32>
    Definition: Must be one. For details about IIO bindings see:
            Documentation/devicetree/bindings/iio/iio-bindings.txt

- interrupts:
    Usage: optional
    Value type: <prop-encoded-array>
    Definition: End of conversion interrupt.

Channel node properties:

- reg:
    Usage: required
    Value type: <u32>
    Definition: ADC channel number.
            See include/dt-bindings/iio/qcom,spmi-vadc.h

- label:
    Usage: required for "qcom,spmi-adc5" and "qcom,spmi-adc-rev2"
    Value type: <empty>
    Definition: ADC input of the platform as seen in the schematics.
            For thermistor inputs connected to generic AMUX or GPIO inputs
            these can vary across platform for the same pins. Hence select
            the platform schematics name for this channel.

- qcom,decimation:
    Usage: optional
    Value type: <u32>
    Definition: This parameter is used to decrease ADC sampling rate.
            Quicker measurements can be made by reducing decimation ratio.
            - For compatible property "qcom,spmi-vadc", valid values are
              512, 1024, 2048, 4096. If property is not found, default value
              of 512 will be used.
            - For compatible property "qcom,spmi-adc5", valid values are 250, 420
              and 840. If property is not found, default value of 840 is used.
            - For compatible property "qcom,spmi-adc-rev2", valid values are 256,
              512 and 1024. If property is not present, default value is 1024.

- qcom,pre-scaling:
    Usage: optional
    Value type: <u32 array>
    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,ratiometric:
    Usage: optional
    Value type: <empty>
    Definition: Channel calibration type.
            - For compatible property "qcom,spmi-vadc", 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.
            - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
              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: <u32>
    Definition: Time between AMUX getting configured and the ADC starting
            conversion. The 'hw_settle_time' is an index used from valid values
            and programmed in hardware to achieve the hardware settling delay.
            - For compatible property "qcom,spmi-vadc" and "qcom,spmi-adc-rev2",
              Delay = 100us * (hw_settle_time) for hw_settle_time < 11,
              and 2ms * (hw_settle_time - 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 0us.
            - For compatible property "qcom,spmi-adc5", delay = 15us for
              value 0, 100us * (value) for values < 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
              Certain controller digital versions have valid values of
              15, 100, 200, 300, 400, 500, 600, 700, 1, 2, 4, 8, 16, 32, 64, 128 ms
              If property is not found, channel will use 15us.

- qcom,avg-samples:
    Usage: optional
    Value type: <u32>
    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).
            - For compatible property "qcom,spmi-vadc", valid values
              are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
              If property is not found, 1 sample will be used.
            - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
              valid values are: 1, 2, 4, 8, 16
              If property is not found, 1 sample will be used.

NOTE:

For compatible property "qcom,spmi-vadc" following channels, also known as
reference point channels, are used for result calibration and their channel
configuration nodes should be defined:
VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
VADC_GND_REF and VADC_VDD_VADC.

Example:

#include <dt-bindings/iio/qcom,spmi-vadc.h>
#include <linux/irq.h>
/* ... */

	/* VADC node */
	pmic_vadc: vadc@3100 {
		compatible = "qcom,spmi-vadc";
		reg = <0x3100>;
		interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
		#address-cells = <1>;
		#size-cells = <0>;
		#io-channel-cells = <1>;
		io-channel-ranges;

		/* Channel node */
		adc-chan@VADC_LR_MUX10_USB_ID {
			reg = <VADC_LR_MUX10_USB_ID>;
			qcom,decimation = <512>;
			qcom,ratiometric;
			qcom,hw-settle-time = <200>;
			qcom,avg-samples = <1>;
			qcom,pre-scaling = <1 3>;
		};
	};

	/* IIO client node */
	usb {
		io-channels = <&pmic_vadc VADC_LR_MUX10_USB_ID>;
		io-channel-names = "vadc";
	};