adc-battery.yaml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/power/supply/adc-battery.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: ADC battery
  7. maintainers:
  8. - Sebastian Reichel <sre@kernel.org>
  9. description:
  10. Basic battery capacity meter, which only reports basic battery data
  11. via ADC channels and optionally indicate that the battery is full by
  12. polling a GPIO line.
  13. The voltage is expected to be measured between the battery terminals
  14. and mandatory. The optional current/power channel is expected to
  15. monitor the current/power flowing out of the battery. Last but not
  16. least the temperature channel is supposed to measure the battery
  17. temperature.
  18. allOf:
  19. - $ref: power-supply.yaml#
  20. properties:
  21. compatible:
  22. const: adc-battery
  23. charged-gpios:
  24. description:
  25. GPIO which signals that the battery is fully charged. The GPIO is
  26. often provided by charger ICs, that are not software controllable.
  27. maxItems: 1
  28. io-channels:
  29. minItems: 1
  30. maxItems: 4
  31. io-channel-names:
  32. minItems: 1
  33. items:
  34. - const: voltage
  35. - enum: [ current, power, temperature ]
  36. - enum: [ power, temperature ]
  37. - const: temperature
  38. monitored-battery: true
  39. required:
  40. - compatible
  41. - io-channels
  42. - io-channel-names
  43. - monitored-battery
  44. unevaluatedProperties: false
  45. examples:
  46. - |
  47. #include <dt-bindings/gpio/gpio.h>
  48. fuel-gauge {
  49. compatible = "adc-battery";
  50. charged-gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
  51. io-channels = <&adc 13>, <&adc 37>;
  52. io-channel-names = "voltage", "current";
  53. power-supplies = <&charger>;
  54. monitored-battery = <&battery>;
  55. };