18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci%YAML 1.2
38c2ecf20Sopenharmony_ci---
48c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/power/supply/sbs,sbs-battery.yaml#
58c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cititle: SBS compliant battery
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cimaintainers:
108c2ecf20Sopenharmony_ci  - Sebastian Reichel <sre@kernel.org>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cidescription: |
138c2ecf20Sopenharmony_ci  Battery compatible with the smart battery system specifications
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciproperties:
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci  compatible:
188c2ecf20Sopenharmony_ci    oneOf:
198c2ecf20Sopenharmony_ci      - items:
208c2ecf20Sopenharmony_ci          - enum:
218c2ecf20Sopenharmony_ci              - ti,bq20z65
228c2ecf20Sopenharmony_ci              - ti,bq20z75
238c2ecf20Sopenharmony_ci          - enum:
248c2ecf20Sopenharmony_ci              - sbs,sbs-battery
258c2ecf20Sopenharmony_ci      - items:
268c2ecf20Sopenharmony_ci          - const: sbs,sbs-battery
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci  reg:
298c2ecf20Sopenharmony_ci    maxItems: 1
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci  sbs,i2c-retry-count:
328c2ecf20Sopenharmony_ci    description:
338c2ecf20Sopenharmony_ci      The number of times to retry I2C transactions on I2C IO failure.
348c2ecf20Sopenharmony_ci    default: 0
358c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci  sbs,poll-retry-count:
388c2ecf20Sopenharmony_ci    description:
398c2ecf20Sopenharmony_ci      The number of times to try looking for new status after an external
408c2ecf20Sopenharmony_ci      change notification.
418c2ecf20Sopenharmony_ci    default: 0
428c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci  sbs,battery-detect-gpios:
458c2ecf20Sopenharmony_ci    description:
468c2ecf20Sopenharmony_ci      GPIO which signals battery detection. If this is not supplied, the bus
478c2ecf20Sopenharmony_ci      needs to be polled to detect the battery.
488c2ecf20Sopenharmony_ci    maxItems: 1
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci  sbs,disable-charger-broadcasts:
518c2ecf20Sopenharmony_ci    description:
528c2ecf20Sopenharmony_ci      SBS batteries by default send broadcast messages to SBS compliant chargers to
538c2ecf20Sopenharmony_ci      configure max. charge current/voltage. If your hardware does not have an SBS
548c2ecf20Sopenharmony_ci      compliant charger it should be disabled via this property to avoid blocking
558c2ecf20Sopenharmony_ci      the bus. Also some SBS battery fuel gauges are known to have a buggy multi-
568c2ecf20Sopenharmony_ci      master implementation.
578c2ecf20Sopenharmony_ci    type: boolean
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_cirequired:
608c2ecf20Sopenharmony_ci  - compatible
618c2ecf20Sopenharmony_ci  - reg
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciadditionalProperties: false
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ciexamples:
668c2ecf20Sopenharmony_ci  - |
678c2ecf20Sopenharmony_ci    #include <dt-bindings/gpio/gpio.h>
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci    i2c {
708c2ecf20Sopenharmony_ci        #address-cells = <1>;
718c2ecf20Sopenharmony_ci        #size-cells = <0>;
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci        battery@b {
748c2ecf20Sopenharmony_ci            compatible = "ti,bq20z75", "sbs,sbs-battery";
758c2ecf20Sopenharmony_ci            reg = <0xb>;
768c2ecf20Sopenharmony_ci            sbs,i2c-retry-count = <2>;
778c2ecf20Sopenharmony_ci            sbs,poll-retry-count = <10>;
788c2ecf20Sopenharmony_ci            sbs,battery-detect-gpios = <&gpio 122 GPIO_ACTIVE_HIGH>;
798c2ecf20Sopenharmony_ci            sbs,disable-charger-broadcasts;
808c2ecf20Sopenharmony_ci       };
818c2ecf20Sopenharmony_ci    };
82