blob: 83403ba8628feeb93a95de10615f25ab0e8a418c [file] [log] [blame]
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -07001Qualcomm's QPNP PMIC Voltage ADC Arbiter
2
3QPNP PMIC Voltage ADC (VADC) provides interface to clients to read
4Voltage. A 15 bit ADC is used for Voltage measurements. There are multiple
5peripherals to the VADC and the scope of the driver is to provide interface
6for the USR peripheral of the VADC.
7
8VADC node
9
10Required properties:
11- compatible : should be "qcom,qpnp-vadc" for Voltage ADC driver.
12- reg : offset and length of the PMIC Aribter register map.
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -080013- address-cells : Must be one.
14- size-cells : Must be zero.
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -070015- interrupts : The USR bank peripheral VADC interrupt.
Siddartha Mohanadoss12109952012-11-20 14:57:51 -080016- interrupt-names : Should contain "eoc-int-en-set".
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -070017- qcom,adc-bit-resolution : Bit resolution of the ADC.
18- qcom,adc-vdd-reference : Voltage reference used by the ADC.
19
20Channel nodes
21NOTE: Atleast one Channel node is required.
22
Siddartha Mohanadoss462088b2013-07-27 19:58:09 -070023Optional properties:
24- qcom,vadc-poll-eoc: Use polling instead of interrupts for End of Conversion completion.
Siddartha Mohanadoss93761842013-09-11 17:46:54 -070025- qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the
26 PMIC type and revision for applying the appropriate temperature
27 compensation parameters.
Siddartha Mohanadoss462088b2013-07-27 19:58:09 -070028
Siddartha Mohanadoss3cb2b6b2013-06-21 12:07:05 -070029Client required property:
30- qcom,<consumer name>-vadc : The phandle to the corresponding vadc device.
31 The consumer name passed to the driver when calling
32 qpnp_get_vadc() is used to associate the client
33 with the corresponding device.
34
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -070035Required properties:
36- label : Channel name used for sysfs entry.
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -080037- reg : AMUX channel number.
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -070038- qcom,decimation : Sampling rate to use for the individual channel measurement.
39 Select from following unsigned int.
40 0 : 512
41 1 : 1K
42 2 : 2K
43 3 : 4K
44- qcom,pre-div-channel-scaling : Pre-div used for the channel before the signal
Siddartha Mohanadossc049b9c2013-02-16 17:17:49 -080045 is being measured. Some of the AMUX channels
46 support dividing the signal from a predetermined
47 ratio. The configuration for this node is to know
48 the pre-determined ratio and use it for post scaling.
49 Select from the following unsinged int.
50 0 : {1, 1}
51 1 : {1, 3}
52 2 : {1, 4}
53 3 : {1, 6}
54 4 : {1, 20}
Dipen Parmar46f8ac62014-01-19 22:45:11 +053055 5 : {1, 8}
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -070056- qcom,calibration-type : Reference voltage to use for channel calibration.
57 Channel calibration is dependendent on the channel.
58 Certain channels like XO_THERM, BATT_THERM use ratiometric
59 calibration. Most other channels fall under absolute calibration.
60 Select from the following strings.
61 "absolute" : Uses the 625mv and 1.25V reference channels.
62 "ratiometric" : Uses the reference Voltage/GND for calibration.
63- qcom,scale-function : Scaling function used to convert raw ADC code to units specific to
64 a given channel.
65 Select from the following unsigned int.
66 0 : Default scaling to convert raw adc code to voltage.
67 1 : Conversion to temperature based on btm parameters.
Siddartha Mohanadosse77edf12012-09-13 14:26:32 -070068 2 : Returns result in degC for 100k pull-up.
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -070069 3 : Returns current across 0.1 ohm resistor.
70 4 : Returns XO thermistor voltage in degree's Centigrade.
Siddartha Mohanadosse77edf12012-09-13 14:26:32 -070071 5 : Returns result in degC for 150k pull-up.
Wu Fenglin2c6ef8f2013-12-17 11:33:33 +080072 9 : Conversion to temperature based on -15~55 allowable
73 battery charging tempeature setting for btm parameters.
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -070074- qcom,hw-settle-time : Settling period for the channel before ADC read.
75 Select from the following unsigned int.
76 0 : 0us
77 1 : 100us
78 2 : 200us
79 3 : 300us
80 4 : 400us
81 5 : 500us
82 6 : 600us
83 7 : 700us
84 8 : 800us
85 9 : 900us
86 0xa : 1ms
87 0xb : 2ms
88 0xc : 4ms
89 0xd : 6ms
90 0xe : 8ms
91 0xf : 10ms
92- qcom,fast-avg-setup : Average number of samples to be used for measurement. Fast averaging
93 provides the option to obtain a single measurement from the ADC that
94 is an average of multiple samples. The value selected is 2^(value)
95 Select from the following unsigned int.
96 0 : 1
97 1 : 2
98 2 : 4
99 3 : 8
100 4 : 16
101 5 : 32
102 6 : 64
103 7 : 128
104 8 : 256
105
106Example:
107 /* Main Node */
108 qcom,vadc@3100 {
109 compatible = "qcom,qpnp-vadc";
110 reg = <0x3100 0x100>;
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -0800111 #address-cells = <1>;
112 #size-cells = <0>;
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -0700113 interrupts = <0x0 0x31 0x0>;
Siddartha Mohanadoss12109952012-11-20 14:57:51 -0800114 interrupt-names = "eoc-int-en-set";
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -0700115 qcom,adc-bit-resolution = <15>;
116 qcom,adc-vdd-reference = <1800>;
117
118 /* Channel Node */
119 chan@0 {
120 label = "usb_in";
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -0800121 reg = <0>;
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -0700122 qcom,decimation = <0>;
Siddartha Mohanadossc049b9c2013-02-16 17:17:49 -0800123 qcom,pre-div-channel-scaling = <4>;
Siddartha Mohanadoss7b116e12012-06-05 23:27:46 -0700124 qcom,calibration-type = "absolute";
125 qcom,scale-function = <0>;
126 qcom,hw-settle-time = <0>;
127 qcom,fast-avg-setup = <0>;
128 };
129 };
Siddartha Mohanadossc049b9c2013-02-16 17:17:49 -0800130
Siddartha Mohanadoss3cb2b6b2013-06-21 12:07:05 -0700131Client device example:
132/* Add to the clients node that needs the VADC channel A/D */
133client_node {
134 qcom,client-vadc = <&pm8941_vadc>;
135};
136
Siddartha Mohanadossc049b9c2013-02-16 17:17:49 -0800137/* Clients have an option of measuring an analog signal through an MPP.
138 MPP block is not part of the VADC block but is an individual PMIC
139 block that has an option to support clients to configure an MPP as
140 an analog input which can be routed through one of the VADC pre-mux
141 inputs. Here is an example of how to configure an MPP as an analog
142 input */
143
144/* Configure MPP4 as an Analog input to AMUX8 and read from channel 0x23 */
145/* MPP DT configuration in the platform DT file*/
146 mpp@a300 { /* MPP 4 */
147 qcom,mode = <4>; /* AIN input */
148 qcom,invert = <1>; /* Enable MPP */
149 qcom,ain-route = <3>; /* AMUX 8 */
150 qcom,master-en = <1>;
151 qcom,src-sel = <0>; /* Function constant */
152 };
153
154/* VADC Channel configuration */
155 chan@23 {
156 label = "mpp4_div3";
157 reg = <0x23>;
158 qcom,decimation = <0>;
159 qcom,pre-div-channel-scaling = <1>;
160 qcom,calibration-type = "absolute";
161 qcom,scale-function = <0>;
162 qcom,hw-settle-time = <0>;
163 qcom,fast-avg-setup = <0>;
164 };