blob: d0cad52d4763e2278cd4372da0697e6d2154ba8c [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 Mohanadossc4a6af12012-07-13 18:50:12 -070036
37Channel node
38NOTE: Atleast one Channel node is required.
39
Siddartha Mohanadoss55d0bca2013-06-24 08:29:34 -070040Client required property:
41- qcom,<consumer name>-iadc : The phandle to the corresponding iadc device.
42 The consumer name passed to the driver when calling
43 qpnp_get_iadc() is used to associate the client
44 with the corresponding device.
45
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -070046Required properties:
47- label : Channel name used for sysfs entry.
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -080048- reg : AMUX channel number.
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -070049- qcom,channel-num : Channel number associated to the AMUX input.
50- qcom,decimation : Sampling rate to use for the individual channel measurement.
51 Select from the following unsigned int.
52 0 : 512
53 1 : 1K
54 2 : 2K
55 3 : 4K
56- qcom,pre-div-channel-scaling : Pre-div used for the channel before the signal
57 is being measured.
58- qcom,calibration-type : Calibration point values vary with temperature.
59 For improved accuracy fresh gain and offset point values
60 can be used for calibration. Reading fresh values for ever
61 read affects the reading time. Application can use the historic
62 values used from the trim register values.
63 Select from the following strings.
64 "absolute" : Uses TRIM gain and offset values for calibration.
65 "ratiometric" : Calculate the gain and offset calibration value when an ADC
66 request is issued.
67- qcom,scale-function : Scaling fuction used to convert raw ADC code to units specific to
68 a given channel.
69 Select from the following unsigned int.
70 0 : Default scaling to convert raw adc code to voltage.
71 1 : Conversion to temperature based on btm parameters.
72 2 : Returns result in milli degree's Centigrade.
73 3 : Returns current across 0.1 ohm resistor.
74 4 : Returns XO thermistor voltage in degree's Centigrade.
75- qcom,hw-settle-time : Settling period for the channel before ADC read.
76 Select from the following unsigned int.
77 0 : 0us
78 1 : 100us
79 2 : 200us
80 3 : 300us
81 4 : 400us
82 5 : 500us
83 6 : 600us
84 7 : 700us
85 8 : 800us
86 9 : 900us
87 0xa : 1ms
88 0xb : 2ms
89 0xc : 4ms
90 0xd : 6ms
91 0xe : 8ms
92 0xf : 10ms
93- qcom,fast-avg-setup : Average number of samples to be used for measurement. Fast averaging
94 provides the option to obtain a single measurement from the ADC that
95 is an average of multiple samples. The value selected is 2^(value)
96 Select from the following unsigned int.
97 0 : 1
98 1 : 2
99 2 : 4
100 3 : 8
101 4 : 16
102 5 : 32
103 6 : 64
104 7 : 128
105 8 : 256
Siddartha Mohanadoss3cb2b6b2013-06-21 12:07:05 -0700106- qcom,iadc-vadc : Corresponding phandle of the VADC device to read the die_temperature and set
107 simultaneous voltage and current conversion requests.
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700108
109Example:
110 /* Main Node */
111 qcom,iadc@3200 {
112 compatible = "qcom,qpnp-iadc";
113 reg = <0x3200 0x100>;
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -0800114 #address-cells = <1>;
115 #size-cells = <0>;
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700116 interrupts = <0 0x36 0>;
Siddartha Mohanadoss12109952012-11-20 14:57:51 -0800117 interrupt-names = "eoc-int-en-set";
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700118 qcom,adc-bit-resolution = <16>;
119 qcom,adc-vdd-reference = <1800>;
120 qcom,rsense = <1500>;
Siddartha Mohanadoss3cb2b6b2013-06-21 12:07:05 -0700121 qcom,iadc-vadc = <&pm8941_vadc>;
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700122
123 /* Channel Node */
124 chan@0 = {
125 label = "rsense";
Siddartha Mohanadoss96be0a02012-12-07 14:38:48 -0800126 reg = <0>;
Siddartha Mohanadossc4a6af12012-07-13 18:50:12 -0700127 qcom,decimation = <0>;
128 qcom,pre-div-channel-scaling = <20>;
129 qcom,calibration-type = "fresh";
130 qcom,scale-function = <0>;
131 qcom,hw-settle-time = <0>;
132 qcom,fast-avg-setup = <0>;
133 };
134 };
Siddartha Mohanadoss55d0bca2013-06-24 08:29:34 -0700135
136Client device example:
137/* Add to the clients node that needs the IADC */
138client_node {
139 qcom,client-iadc = <&pm8941_iadc>;
140};