18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci%YAML 1.2 38c2ecf20Sopenharmony_ci--- 48c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/power/supply/gpio-charger.yaml# 58c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml# 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_cititle: simple battery chargers only communicating through GPIOs 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_cimaintainers: 108c2ecf20Sopenharmony_ci - Sebastian Reichel <sre@kernel.org> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cidescription: 138c2ecf20Sopenharmony_ci This binding is for all chargers, which are working more or less 148c2ecf20Sopenharmony_ci autonomously, only providing some status GPIOs and possibly some 158c2ecf20Sopenharmony_ci GPIOs for limited control over the charging process. 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciproperties: 188c2ecf20Sopenharmony_ci compatible: 198c2ecf20Sopenharmony_ci const: gpio-charger 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci charger-type: 228c2ecf20Sopenharmony_ci enum: 238c2ecf20Sopenharmony_ci - unknown 248c2ecf20Sopenharmony_ci - battery 258c2ecf20Sopenharmony_ci - ups 268c2ecf20Sopenharmony_ci - mains 278c2ecf20Sopenharmony_ci - usb-sdp # USB standard downstream port 288c2ecf20Sopenharmony_ci - usb-dcp # USB dedicated charging port 298c2ecf20Sopenharmony_ci - usb-cdp # USB charging downstream port 308c2ecf20Sopenharmony_ci - usb-aca # USB accessory charger adapter 318c2ecf20Sopenharmony_ci description: 328c2ecf20Sopenharmony_ci Type of the charger, e.g. "mains" for a wall charger. 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci gpios: 358c2ecf20Sopenharmony_ci maxItems: 1 368c2ecf20Sopenharmony_ci description: GPIO indicating the charger presence 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci charge-status-gpios: 398c2ecf20Sopenharmony_ci maxItems: 1 408c2ecf20Sopenharmony_ci description: GPIO indicating the charging status 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci charge-current-limit-gpios: 438c2ecf20Sopenharmony_ci minItems: 1 448c2ecf20Sopenharmony_ci maxItems: 32 458c2ecf20Sopenharmony_ci description: GPIOs used for current limiting 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci charge-current-limit-mapping: 488c2ecf20Sopenharmony_ci description: List of tuples with current in uA and a GPIO bitmap (in 498c2ecf20Sopenharmony_ci this order). The tuples must be provided in descending order of the 508c2ecf20Sopenharmony_ci current limit. 518c2ecf20Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32-matrix 528c2ecf20Sopenharmony_ci items: 538c2ecf20Sopenharmony_ci items: 548c2ecf20Sopenharmony_ci - description: 558c2ecf20Sopenharmony_ci Current limit in uA 568c2ecf20Sopenharmony_ci - description: 578c2ecf20Sopenharmony_ci Encoded GPIO setting. Bit 0 represents last GPIO from the 588c2ecf20Sopenharmony_ci charge-current-limit-gpios property. Bit 1 second to last 598c2ecf20Sopenharmony_ci GPIO and so on. 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cirequired: 628c2ecf20Sopenharmony_ci - compatible 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_cianyOf: 658c2ecf20Sopenharmony_ci - required: 668c2ecf20Sopenharmony_ci - gpios 678c2ecf20Sopenharmony_ci - required: 688c2ecf20Sopenharmony_ci - charge-status-gpios 698c2ecf20Sopenharmony_ci - required: 708c2ecf20Sopenharmony_ci - charge-current-limit-gpios 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_cidependencies: 738c2ecf20Sopenharmony_ci charge-current-limit-gpios: [ charge-current-limit-mapping ] 748c2ecf20Sopenharmony_ci charge-current-limit-mapping: [ charge-current-limit-gpios ] 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ciadditionalProperties: false 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ciexamples: 798c2ecf20Sopenharmony_ci - | 808c2ecf20Sopenharmony_ci #include <dt-bindings/gpio/gpio.h> 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci charger { 838c2ecf20Sopenharmony_ci compatible = "gpio-charger"; 848c2ecf20Sopenharmony_ci charger-type = "usb-sdp"; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci gpios = <&gpd 28 GPIO_ACTIVE_LOW>; 878c2ecf20Sopenharmony_ci charge-status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci charge-current-limit-gpios = <&gpioA 11 GPIO_ACTIVE_HIGH>, 908c2ecf20Sopenharmony_ci <&gpioA 12 GPIO_ACTIVE_HIGH>; 918c2ecf20Sopenharmony_ci charge-current-limit-mapping = <2500000 0x00>, // 2.5 A => both GPIOs low 928c2ecf20Sopenharmony_ci <700000 0x01>, // 700 mA => GPIO A.12 high 938c2ecf20Sopenharmony_ci <0 0x02>; // 0 mA => GPIO A.11 high 948c2ecf20Sopenharmony_ci }; 95