qpnp-adc-tm.txt 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. Qualcomm's QPNP PMIC thermal monitor ADC driver (VADC_TM)
  2. QPNP PMIC thermal monitoring (TM) provides interface to thermal clients
  3. to set temperature thresholds and receive notification when the thresholds
  4. are crossed. A 15 bit ADC is used for measurements. The driver is part
  5. of the sysfs thermal framework that provides support to read the trip
  6. points, set threshold for the trip points and enable the trip points.
  7. Seperate kernel api's are provided to usb_id and batt_therm
  8. to set thresholds and receive threshold notifications.
  9. VADC_TM node
  10. Required properties:
  11. - compatible : should be "qcom,qpnp-adc-tm" for thermal ADC driver.
  12. - reg : offset and length of the PMIC Aribter register map.
  13. - address-cells : Must be one.
  14. - size-cells : Must be zero.
  15. - interrupts : The thermal ADC bank peripheral interrupts for eoc, high and low interrupts.
  16. - interrupt-names : Should be "eoc-int-en-set", "high-thr-en-set" and "low-thr-en-set".
  17. - qcom,adc-bit-resolution : Bit resolution of the ADC.
  18. - qcom,adc-vdd-reference : Voltage reference used by the ADC.
  19. Optional properties:
  20. - qcom,thermal-node : If present a thermal node is created and the channel is registered as
  21. part of the thermal sysfs which allows clients to use the thermal framework
  22. to set temperature thresholds and receive notification when the temperature
  23. crosses a set threshold, read temperature and enable/set trip types supported
  24. by the thermal framework.
  25. - qcom,meas-interval-timer-idx: If present select from the following timer index to choose
  26. a preset configurable measurement interval timer value. The driver defaults
  27. to timer 1 with a measurement interval of 1 second if the property is not present.
  28. 0 : Select Timer 1 for a measurement polling interval of 1 second.
  29. 1 : Select Timer 2 for a measurement polling interval of 500ms.
  30. 2 : Select Timer 3 for a measurement polling interval of 4 seconds.
  31. Client required property:
  32. - qcom,<consumer name>-adc_tm : The phandle to the corresponding adc_tm device.
  33. The consumer name passed to the driver when calling
  34. qpnp_get_adc_tm() is used to associate the client
  35. with the corresponding device.
  36. Channel nodes
  37. NOTE: Atleast one Channel node is required.
  38. Required properties:
  39. - label : Channel name used for sysfs entry.
  40. - reg : AMUX channel number.
  41. - qcom,decimation : Sampling rate to use for the individual channel measurement.
  42. Select from the following unsigned int.
  43. 0 : 512
  44. 1 : 1K
  45. 2 : 2K
  46. 3 : 4K
  47. - qcom,pre-div-channel-scaling : Pre-div used for the channel before the signal is being measured.
  48. Select from the following unsigned int for the corresponding
  49. numerator/denominator pre-div ratio.
  50. 0 : pre-div ratio of {1, 1}
  51. 1 : pre-div ratio of {1, 3}
  52. 2 : pre-div ratio of {1, 4}
  53. 3 : pre-div ratio of {1, 6}
  54. 4 : pre-div ratio of {1, 20}
  55. 5 : pre-div ratio of {1, 8}
  56. - 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 fuction 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.
  68. 2 : Returns result in milli degree's Centigrade.
  69. 3 : Returns current across 0.1 ohm resistor.
  70. 4 : Returns XO thermistor voltage in degree's Centigrade.
  71. - qcom,hw-settle-time : Settling period for the channel before ADC read.
  72. Select from the following unsigned int.
  73. 0 : 0us
  74. 1 : 100us
  75. 2 : 200us
  76. 3 : 300us
  77. 4 : 400us
  78. 5 : 500us
  79. 6 : 600us
  80. 7 : 700us
  81. 8 : 800us
  82. 9 : 900us
  83. 0xa : 1ms
  84. 0xb : 2ms
  85. 0xc : 4ms
  86. 0xd : 6ms
  87. 0xe : 8ms
  88. 0xf : 10ms
  89. - qcom,fast-avg-setup : Average number of samples to be used for measurement. Fast averaging
  90. provides the option to obtain a single measurement from the ADC that
  91. is an average of multiple samples. The value selected is 2^(value)
  92. Select from
  93. 0 : 1
  94. 1 : 2
  95. 2 : 4
  96. 3 : 8
  97. 4 : 16
  98. 5 : 32
  99. 6 : 64
  100. 7 : 128
  101. 8 : 256
  102. - qcom,btm-channel-number : There are 5 BTM channels. The BTM channel numbers are statically
  103. allocated to the corresponding channel node.
  104. - qcom,adc_tm-vadc : phandle to the corresponding VADC device to read the ADC channels.
  105. Client device example:
  106. /* Add to the clients node that needs the ADC_TM channel A/D */
  107. client_node {
  108. qcom,client-adc_tm = <&pm8941_adc_tm>;
  109. };
  110. Example:
  111. /* Main Node */
  112. qcom,vadc@3400 {
  113. compatible = "qcom,qpnp-adc-tm";
  114. reg = <0x3400 0x100>;
  115. #address-cells = <1>;
  116. #size-cells = <0>;
  117. interrupts = <0x0 0x34 0x0>,
  118. <0x0 0x34 0x3>,
  119. <0x0 0x34 0x4>;
  120. interrupt-names = "eoc-int-en-set",
  121. "high-thr-en-set",
  122. "low-thr-en-set";
  123. qcom,adc-bit-resolution = <15>;
  124. qcom,adc-vdd-reference = <1800>;
  125. qcom,adc_tm-vadc = <&pm8941_vadc>;
  126. /* Channel Node to be registered as part of thermal sysfs */
  127. chan@b5 {
  128. label = "pa_therm1";
  129. reg = <0xb5>;
  130. qcom,decimation = <0>;
  131. qcom,pre-div-channel-scaling = <0>;
  132. qcom,calibration-type = "absolute";
  133. qcom,scale-function = <2>;
  134. qcom,hw-settle-time = <0>;
  135. qcom,fast-avg-setup = <0>;
  136. qcom,btm-channel-number = <0x70>;
  137. qcom,thermal-node;
  138. };
  139. /* Channel Node */
  140. chan@6 {
  141. label = "vbat_sns";
  142. reg = <6>;
  143. qcom,decimation = <0>;
  144. qcom,pre-div-channel-scaling = <1>;
  145. qcom,calibration-type = "absolute";
  146. qcom,scale-function = <3>;
  147. qcom,hw-settle-time = <0>;
  148. qcom,fast-avg-setup = <0>;
  149. qcom,btm-channel-number = <0x78>;
  150. };
  151. };