95 lines · yaml
1# SPDX-License-Identifier: GPL-2.02%YAML 1.23---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 GPIOs8 9maintainers:10 - Sebastian Reichel <sre@kernel.org>11 12description:13 This binding is for all chargers, which are working more or less14 autonomously, only providing some status GPIOs and possibly some15 GPIOs for limited control over the charging process.16 17properties:18 compatible:19 const: gpio-charger20 21 charger-type:22 enum:23 - unknown24 - battery25 - ups26 - mains27 - usb-sdp # USB standard downstream port28 - usb-dcp # USB dedicated charging port29 - usb-cdp # USB charging downstream port30 - usb-aca # USB accessory charger adapter31 description:32 Type of the charger, e.g. "mains" for a wall charger.33 34 gpios:35 maxItems: 136 description: GPIO indicating the charger presence37 38 charge-status-gpios:39 maxItems: 140 description: GPIO indicating the charging status41 42 charge-current-limit-gpios:43 minItems: 144 maxItems: 3245 description: GPIOs used for current limiting46 47 charge-current-limit-mapping:48 description: List of tuples with current in uA and a GPIO bitmap (in49 this order). The tuples must be provided in descending order of the50 current limit.51 $ref: /schemas/types.yaml#/definitions/uint32-matrix52 items:53 items:54 - description:55 Current limit in uA56 - description:57 Encoded GPIO setting. Bit 0 represents last GPIO from the58 charge-current-limit-gpios property. Bit 1 second to last59 GPIO and so on.60 61required:62 - compatible63 64anyOf:65 - required:66 - gpios67 - required:68 - charge-status-gpios69 - required:70 - charge-current-limit-gpios71 72dependencies:73 charge-current-limit-gpios: [ charge-current-limit-mapping ]74 charge-current-limit-mapping: [ charge-current-limit-gpios ]75 76additionalProperties: false77 78examples:79 - |80 #include <dt-bindings/gpio/gpio.h>81 82 charger {83 compatible = "gpio-charger";84 charger-type = "usb-sdp";85 86 gpios = <&gpd 28 GPIO_ACTIVE_LOW>;87 charge-status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>;88 89 charge-current-limit-gpios = <&gpioA 11 GPIO_ACTIVE_HIGH>,90 <&gpioA 12 GPIO_ACTIVE_HIGH>;91 charge-current-limit-mapping = <2500000 0x00>, // 2.5 A => both GPIOs low92 <700000 0x01>, // 700 mA => GPIO A.12 high93 <0 0x02>; // 0 mA => GPIO A.11 high94 };95