File Index
Files and directories
Sign in
FILE

gpio-charger.yaml

File preview with syntax highlighting.

linux-6.19.14/Documentation/devicetree/bindings/power/supply/gpio-charger.yaml YAML
  1# SPDX-License-Identifier: GPL-2.0
  2%YAML 1.2
  3---
  4$id: http://devicetree.org/schemas/power/supply/gpio-charger.yaml#
  5$schema: http://devicetree.org/meta-schemas/core.yaml#
  6
  7title: simple battery chargers only communicating through GPIOs
  8
  9maintainers:
 10  - Sebastian Reichel <sre@kernel.org>
 11
 12description:
 13  This binding is for all chargers, which are working more or less
 14  autonomously, only providing some status GPIOs and possibly some
 15  GPIOs for limited control over the charging process.
 16
 17properties:
 18  compatible:
 19    const: gpio-charger
 20
 21  charger-type:
 22    enum:
 23      - unknown
 24      - battery
 25      - ups
 26      - mains
 27      - usb-sdp                   # USB standard downstream port
 28      - usb-dcp                   # USB dedicated charging port
 29      - usb-cdp                   # USB charging downstream port
 30      - usb-aca                   # USB accessory charger adapter
 31    description:
 32      Type of the charger, e.g. "mains" for a wall charger.
 33
 34  gpios:
 35    maxItems: 1
 36    description: GPIO indicating the charger presence
 37
 38  charge-status-gpios:
 39    maxItems: 1
 40    description: GPIO indicating the charging status
 41
 42  charge-current-limit-gpios:
 43    minItems: 1
 44    maxItems: 32
 45    description: GPIOs used for current limiting
 46
 47  charge-current-limit-mapping:
 48    description: List of tuples with current in uA and a GPIO bitmap (in
 49      this order). The tuples must be provided in descending order of the
 50      current limit.
 51    $ref: /schemas/types.yaml#/definitions/uint32-matrix
 52    items:
 53      items:
 54        - description:
 55            Current limit in uA
 56        - description:
 57            Encoded GPIO setting. Bit 0 represents last GPIO from the
 58            charge-current-limit-gpios property. Bit 1 second to last
 59            GPIO and so on.
 60
 61  charge-current-limit-default-microamp:
 62    description: Default charge current limit. Must be listed in
 63      charge-current-limit-mapping.
 64
 65required:
 66  - compatible
 67
 68anyOf:
 69  - required:
 70      - gpios
 71  - required:
 72      - charge-status-gpios
 73  - required:
 74      - charge-current-limit-gpios
 75
 76dependencies:
 77  charge-current-limit-gpios: [ charge-current-limit-mapping ]
 78  charge-current-limit-mapping: [ charge-current-limit-gpios ]
 79  charge-current-limit-default-microamp: [charge-current-limit-mapping]
 80
 81additionalProperties: false
 82
 83examples:
 84  - |
 85    #include <dt-bindings/gpio/gpio.h>
 86
 87    charger {
 88      compatible = "gpio-charger";
 89      charger-type = "usb-sdp";
 90
 91      gpios = <&gpd 28 GPIO_ACTIVE_LOW>;
 92      charge-status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>;
 93
 94      charge-current-limit-gpios = <&gpioA 11 GPIO_ACTIVE_HIGH>,
 95                                   <&gpioA 12 GPIO_ACTIVE_HIGH>;
 96      charge-current-limit-mapping = <2500000 0x00>, // 2.5 A => both GPIOs low
 97                                     <700000 0x01>, // 700 mA => GPIO A.12 high
 98                                     <0 0x02>; // 0 mA => GPIO A.11 high
 99      charge-current-limit-default-microamp = <700000>;
100    };
~/ Read-only file preview.