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