1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/power/supply/sbs,sbs-battery.yaml#
5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
7c66ec88fSEmmanuel Vadottitle: SBS compliant battery
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
10c66ec88fSEmmanuel Vadot  - Sebastian Reichel <sre@kernel.org>
11c66ec88fSEmmanuel Vadot
12c66ec88fSEmmanuel Vadotdescription: |
13c66ec88fSEmmanuel Vadot  Battery compatible with the smart battery system specifications
14c66ec88fSEmmanuel Vadot
15*2eb4d8dcSEmmanuel VadotallOf:
16*2eb4d8dcSEmmanuel Vadot  - $ref: power-supply.yaml#
17c66ec88fSEmmanuel Vadot
18*2eb4d8dcSEmmanuel Vadotproperties:
19c66ec88fSEmmanuel Vadot  compatible:
20c66ec88fSEmmanuel Vadot    oneOf:
21c66ec88fSEmmanuel Vadot      - items:
22c66ec88fSEmmanuel Vadot          - enum:
23*2eb4d8dcSEmmanuel Vadot              - ti,bq20z45
24c66ec88fSEmmanuel Vadot              - ti,bq20z65
25c66ec88fSEmmanuel Vadot              - ti,bq20z75
26c66ec88fSEmmanuel Vadot          - enum:
27c66ec88fSEmmanuel Vadot              - sbs,sbs-battery
28c66ec88fSEmmanuel Vadot      - items:
29c66ec88fSEmmanuel Vadot          - const: sbs,sbs-battery
30c66ec88fSEmmanuel Vadot
31c66ec88fSEmmanuel Vadot  reg:
32c66ec88fSEmmanuel Vadot    maxItems: 1
33c66ec88fSEmmanuel Vadot
34c66ec88fSEmmanuel Vadot  sbs,i2c-retry-count:
35c66ec88fSEmmanuel Vadot    description:
36c66ec88fSEmmanuel Vadot      The number of times to retry I2C transactions on I2C IO failure.
37c66ec88fSEmmanuel Vadot    default: 0
38c66ec88fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
39c66ec88fSEmmanuel Vadot
40c66ec88fSEmmanuel Vadot  sbs,poll-retry-count:
41c66ec88fSEmmanuel Vadot    description:
42c66ec88fSEmmanuel Vadot      The number of times to try looking for new status after an external
43c66ec88fSEmmanuel Vadot      change notification.
44c66ec88fSEmmanuel Vadot    default: 0
45c66ec88fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
46c66ec88fSEmmanuel Vadot
47c66ec88fSEmmanuel Vadot  sbs,battery-detect-gpios:
48c66ec88fSEmmanuel Vadot    description:
49c66ec88fSEmmanuel Vadot      GPIO which signals battery detection. If this is not supplied, the bus
50c66ec88fSEmmanuel Vadot      needs to be polled to detect the battery.
51c66ec88fSEmmanuel Vadot    maxItems: 1
52c66ec88fSEmmanuel Vadot
53c66ec88fSEmmanuel Vadot  sbs,disable-charger-broadcasts:
54c66ec88fSEmmanuel Vadot    description:
55c66ec88fSEmmanuel Vadot      SBS batteries by default send broadcast messages to SBS compliant chargers to
56c66ec88fSEmmanuel Vadot      configure max. charge current/voltage. If your hardware does not have an SBS
57c66ec88fSEmmanuel Vadot      compliant charger it should be disabled via this property to avoid blocking
58c66ec88fSEmmanuel Vadot      the bus. Also some SBS battery fuel gauges are known to have a buggy multi-
59c66ec88fSEmmanuel Vadot      master implementation.
60c66ec88fSEmmanuel Vadot    type: boolean
61c66ec88fSEmmanuel Vadot
62c66ec88fSEmmanuel Vadotrequired:
63c66ec88fSEmmanuel Vadot  - compatible
64c66ec88fSEmmanuel Vadot  - reg
65c66ec88fSEmmanuel Vadot
66*2eb4d8dcSEmmanuel VadotunevaluatedProperties: false
67c66ec88fSEmmanuel Vadot
68c66ec88fSEmmanuel Vadotexamples:
69c66ec88fSEmmanuel Vadot  - |
70c66ec88fSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
71c66ec88fSEmmanuel Vadot
72c66ec88fSEmmanuel Vadot    i2c {
73c66ec88fSEmmanuel Vadot        #address-cells = <1>;
74c66ec88fSEmmanuel Vadot        #size-cells = <0>;
75c66ec88fSEmmanuel Vadot
76c66ec88fSEmmanuel Vadot        battery@b {
77c66ec88fSEmmanuel Vadot            compatible = "ti,bq20z75", "sbs,sbs-battery";
78c66ec88fSEmmanuel Vadot            reg = <0xb>;
79c66ec88fSEmmanuel Vadot            sbs,i2c-retry-count = <2>;
80c66ec88fSEmmanuel Vadot            sbs,poll-retry-count = <10>;
81c66ec88fSEmmanuel Vadot            sbs,battery-detect-gpios = <&gpio 122 GPIO_ACTIVE_HIGH>;
82c66ec88fSEmmanuel Vadot            sbs,disable-charger-broadcasts;
83c66ec88fSEmmanuel Vadot       };
84c66ec88fSEmmanuel Vadot    };
85