blob: 9acf54a30ba7b39613f24856efbc86956b0e25eb [file] [log] [blame]
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -07001Qualcomm's QPNP PMIC current ADC driver
2
3QPNP PMIC current ADC (IADC) provides interface to clients to read
4current. A 16 bit ADC is used for current measurements. There are multiple
5peripherals to the IADC and the scope of the driver is to provide interface
6for the USR peripheral of the IADC.
7
8IADC node
9
10Required properties:
11- compatible : should be "qcom,qpnp-iadc" for Current ADC driver.
Siddartha Mohanadoss18c4b9f2014-01-23 16:13:31 -080012- reg : offset and length of the PMIC Arbiter register map.
13- reg-names : resource names used for the physical base address of the PMIC IADC
14 peripheral, the SMBB_BAT_IF_TRIM_CNST_RDS register.
15 Should be "iadc-base" for the PMIC IADC peripheral base register.
16 Should be "batt-id-trim-cnst-rds" for reading the
17 SMBB_BAT_IF_TRIM_CNST_RDS register.
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -080018- address-cells : Must be one.
19- size-cells : Must be zero.
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -070020- interrupts : The USR bank peripheral IADC interrupt.
Siddartha Mohanadoss12109952012-11-20 14:57:51 -080021- interrupt-names : Should contain "eoc-int-en-set".
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -070022- qcom,adc-bit-resolution : Bit resolution of the ADC.
23- qcom,adc-vdd-reference : Voltage reference used by the ADC.
Siddartha Mohanadosse70010b2013-04-04 14:51:41 -070024
25Optional properties:
26- qcom,rsense : Use this property when external rsense should be used
27 for current calculation and specify the units in nano-ohms.
Siddartha Mohanadossf82a6f22013-07-27 20:47:34 -070028- qcom,iadc-poll-eoc: Use polling instead of interrupts for End of Conversion completion.
Siddartha Mohanadoss18c4b9f2014-01-23 16:13:31 -080029- qcom,use-default-rds-trim : Add this property to check if certain conditions are to be checked
30 reading the SMBB_BAT_IF_CNST_RDS, IADC_RDS trim register and
31 manufacturer type. Check the driver for conditions that each of the type.
32 0 : Select this type to read the IADC and SMBB trim register and
33 apply the default RSENSE if conditions are met.
34 1 : Select this type to read the IADC, SMBB trim register and
35 manufacturer type and apply the default RSENSE if conditions are met.
Siddartha Mohanadoss93761842013-09-11 17:46:54 -070036- qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the
37 PMIC type and revision for applying the appropriate temperature
38 compensation parameters.
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -070039
40Channel node
41NOTE: Atleast one Channel node is required.
42
Siddartha Mohanadoss55d0bca2013-06-24 08:29:34 -070043Client required property:
44- qcom,<consumer name>-iadc : The phandle to the corresponding iadc device.
45 The consumer name passed to the driver when calling
46 qpnp_get_iadc() is used to associate the client
47 with the corresponding device.
48
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -070049Required properties:
50- label : Channel name used for sysfs entry.
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -080051- reg : AMUX channel number.
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -070052- qcom,channel-num : Channel number associated to the AMUX input.
53- qcom,decimation : Sampling rate to use for the individual channel measurement.
54 Select from the following unsigned int.
55 0 : 512
56 1 : 1K
57 2 : 2K
58 3 : 4K
59- qcom,pre-div-channel-scaling : Pre-div used for the channel before the signal
60 is being measured.
61- qcom,calibration-type : Calibration point values vary with temperature.
62 For improved accuracy fresh gain and offset point values
63 can be used for calibration. Reading fresh values for ever
64 read affects the reading time. Application can use the historic
65 values used from the trim register values.
66 Select from the following strings.
67 "absolute" : Uses TRIM gain and offset values for calibration.
68 "ratiometric" : Calculate the gain and offset calibration value when an ADC
69 request is issued.
70- qcom,scale-function : Scaling fuction used to convert raw ADC code to units specific to
71 a given channel.
72 Select from the following unsigned int.
73 0 : Default scaling to convert raw adc code to voltage.
74 1 : Conversion to temperature based on btm parameters.
75 2 : Returns result in milli degree's Centigrade.
76 3 : Returns current across 0.1 ohm resistor.
77 4 : Returns XO thermistor voltage in degree's Centigrade.
78- qcom,hw-settle-time : Settling period for the channel before ADC read.
79 Select from the following unsigned int.
80 0 : 0us
81 1 : 100us
82 2 : 200us
83 3 : 300us
84 4 : 400us
85 5 : 500us
86 6 : 600us
87 7 : 700us
88 8 : 800us
89 9 : 900us
90 0xa : 1ms
91 0xb : 2ms
92 0xc : 4ms
93 0xd : 6ms
94 0xe : 8ms
95 0xf : 10ms
96- qcom,fast-avg-setup : Average number of samples to be used for measurement. Fast averaging
97 provides the option to obtain a single measurement from the ADC that
98 is an average of multiple samples. The value selected is 2^(value)
99 Select from the following unsigned int.
100 0 : 1
101 1 : 2
102 2 : 4
103 3 : 8
104 4 : 16
105 5 : 32
106 6 : 64
107 7 : 128
108 8 : 256
Siddartha Mohanadoss3cb2b6b2013-06-21 12:07:05 -0700109- qcom,iadc-vadc : Corresponding phandle of the VADC device to read the die_temperature and set
110 simultaneous voltage and current conversion requests.
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700111
112Example:
113 /* Main Node */
114 qcom,iadc@3200 {
115 compatible = "qcom,qpnp-iadc";
116 reg = <0x3200 0x100>;
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -0800117 #address-cells = <1>;
118 #size-cells = <0>;
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700119 interrupts = <0 0x36 0>;
Siddartha Mohanadoss12109952012-11-20 14:57:51 -0800120 interrupt-names = "eoc-int-en-set";
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700121 qcom,adc-bit-resolution = <16>;
122 qcom,adc-vdd-reference = <1800>;
123 qcom,rsense = <1500>;
Siddartha Mohanadoss3cb2b6b2013-06-21 12:07:05 -0700124 qcom,iadc-vadc = <&pm8941_vadc>;
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700125
126 /* Channel Node */
127 chan@0 = {
128 label = "rsense";
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -0800129 reg = <0>;
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700130 qcom,decimation = <0>;
131 qcom,pre-div-channel-scaling = <20>;
132 qcom,calibration-type = "fresh";
133 qcom,scale-function = <0>;
134 qcom,hw-settle-time = <0>;
135 qcom,fast-avg-setup = <0>;
136 };
137 };
Siddartha Mohanadoss55d0bca2013-06-24 08:29:34 -0700138
139Client device example:
140/* Add to the clients node that needs the IADC */
141client_node {
142 qcom,client-iadc = <&pm8941_iadc>;
143};