qpnp-adc-current.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. Qualcomm's QPNP PMIC current ADC driver
  2. QPNP PMIC current ADC (IADC) provides interface to clients to read
  3. current. A 16 bit ADC is used for current measurements. There are multiple
  4. peripherals to the IADC and the scope of the driver is to provide interface
  5. for the USR peripheral of the IADC.
  6. IADC node
  7. Required properties:
  8. - compatible : should be "qcom,qpnp-iadc" for Current ADC driver.
  9. - reg : offset and length of the PMIC Arbiter register map.
  10. - reg-names : resource names used for the physical base address of the PMIC IADC
  11. peripheral, the SMBB_BAT_IF_TRIM_CNST_RDS register.
  12. Should be "iadc-base" for the PMIC IADC peripheral base register.
  13. Should be "batt-id-trim-cnst-rds" for reading the
  14. SMBB_BAT_IF_TRIM_CNST_RDS register.
  15. - address-cells : Must be one.
  16. - size-cells : Must be zero.
  17. - interrupts : The USR bank peripheral IADC interrupt.
  18. - interrupt-names : Should contain "eoc-int-en-set".
  19. - qcom,adc-bit-resolution : Bit resolution of the ADC.
  20. - qcom,adc-vdd-reference : Voltage reference used by the ADC.
  21. Optional properties:
  22. - qcom,rsense : Use this property when external rsense should be used
  23. for current calculation and specify the units in nano-ohms.
  24. - qcom,iadc-poll-eoc: Use polling instead of interrupts for End of Conversion completion.
  25. - qcom,use-default-rds-trim : Add this property to check if certain conditions are to be checked
  26. reading the SMBB_BAT_IF_CNST_RDS, IADC_RDS trim register and
  27. manufacturer type. Check the driver for conditions that each of the type.
  28. 0 : Select the TypeA to read the IADC and SMBB trim register and
  29. apply the default RSENSE if conditions are met.
  30. 1 : Select the TypeB to read the IADC, SMBB trim register and
  31. manufacturer type and apply the default RSENSE if conditions are met.
  32. 2 : Select the TypeC to read the IADC, SMBB trim register and
  33. apply the default RSENSE if conditions are met.
  34. - qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the
  35. PMIC type and revision for applying the appropriate temperature
  36. compensation parameters.
  37. Channel node
  38. NOTE: Atleast one Channel node is required.
  39. Client required property:
  40. - qcom,<consumer name>-iadc : The phandle to the corresponding iadc device.
  41. The consumer name passed to the driver when calling
  42. qpnp_get_iadc() is used to associate the client
  43. with the corresponding device.
  44. Required properties:
  45. - label : Channel name used for sysfs entry.
  46. - reg : AMUX channel number.
  47. - qcom,channel-num : Channel number associated to the AMUX input.
  48. - qcom,decimation : Sampling rate to use for the individual channel measurement.
  49. Select from the following unsigned int.
  50. 0 : 512
  51. 1 : 1K
  52. 2 : 2K
  53. 3 : 4K
  54. - qcom,fast-avg-setup : Average number of samples to be used for measurement. Fast averaging
  55. provides the option to obtain a single measurement from the ADC that
  56. is an average of multiple samples. The value selected is 2^(value)
  57. Select from the following unsigned int.
  58. 0 : 1
  59. 1 : 2
  60. 2 : 4
  61. 3 : 8
  62. 4 : 16
  63. 5 : 32
  64. 6 : 64
  65. 7 : 128
  66. 8 : 256
  67. - qcom,iadc-vadc : Corresponding phandle of the VADC device to read the die_temperature and set
  68. simultaneous voltage and current conversion requests.
  69. Example:
  70. /* Main Node */
  71. qcom,iadc@3200 {
  72. compatible = "qcom,qpnp-iadc";
  73. reg = <0x3200 0x100>;
  74. #address-cells = <1>;
  75. #size-cells = <0>;
  76. interrupts = <0 0x36 0>;
  77. interrupt-names = "eoc-int-en-set";
  78. qcom,adc-bit-resolution = <16>;
  79. qcom,adc-vdd-reference = <1800>;
  80. qcom,rsense = <1500>;
  81. qcom,iadc-vadc = <&pm8941_vadc>;
  82. /* Channel Node */
  83. chan@0 = {
  84. label = "rsense";
  85. reg = <0>;
  86. qcom,decimation = <0>;
  87. qcom,fast-avg-setup = <0>;
  88. };
  89. };
  90. Client device example:
  91. /* Add to the clients node that needs the IADC */
  92. client_node {
  93. qcom,client-iadc = <&pm8941_iadc>;
  94. };