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