16e776188STobias Schramm# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
26e776188STobias Schramm%YAML 1.2
36e776188STobias Schramm---
46e776188STobias Schramm$id: http://devicetree.org/schemas/power/supply/cw2015_battery.yaml#
56e776188STobias Schramm$schema: http://devicetree.org/meta-schemas/core.yaml#
66e776188STobias Schramm
76e776188STobias Schrammtitle: Battery driver for CW2015 shuntless fuel gauge by CellWise.
86e776188STobias Schramm
96e776188STobias Schrammmaintainers:
106e776188STobias Schramm  - Tobias Schramm <t.schramm@manjaro.org>
116e776188STobias Schramm
126e776188STobias Schrammdescription: |
136e776188STobias Schramm  The driver can utilize information from a simple-battery linked via a
146e776188STobias Schramm  phandle in monitored-battery. If specified the driver uses the
156e776188STobias Schramm  charge-full-design-microamp-hours property of the battery.
166e776188STobias Schramm
176e776188STobias Schrammproperties:
186e776188STobias Schramm  compatible:
196e776188STobias Schramm    const: cellwise,cw2015
206e776188STobias Schramm
216e776188STobias Schramm  reg:
226e776188STobias Schramm    maxItems: 1
236e776188STobias Schramm
246e776188STobias Schramm  cellwise,battery-profile:
256e776188STobias Schramm    description: |
266e776188STobias Schramm      This property specifies characteristics of the battery used. The format
276e776188STobias Schramm      of this binary blob is kept secret by CellWise. The only way to obtain
286e776188STobias Schramm      it is to mail two batteries to a test facility of CellWise and receive
296e776188STobias Schramm      back a test report with the binary blob.
30086e9074SRob Herring    $ref: /schemas/types.yaml#definitions/uint8-array
31086e9074SRob Herring    minItems: 64
326e776188STobias Schramm    maxItems: 64
336e776188STobias Schramm
346e776188STobias Schramm  cellwise,monitor-interval-ms:
356e776188STobias Schramm    description:
366e776188STobias Schramm      Specifies the interval in milliseconds gauge values are polled at
376e776188STobias Schramm    minimum: 250
386e776188STobias Schramm
396e776188STobias Schramm  power-supplies:
406e776188STobias Schramm    description:
416e776188STobias Schramm      Specifies supplies used for charging the battery connected to this gauge
42086e9074SRob Herring    $ref: /schemas/types.yaml#/definitions/phandle-array
43086e9074SRob Herring    minItems: 1
446e776188STobias Schramm    maxItems: 8 # Should be enough
456e776188STobias Schramm
466e776188STobias Schramm  monitored-battery:
476e776188STobias Schramm    description:
486e776188STobias Schramm      Specifies the phandle of a simple-battery connected to this gauge
496e776188STobias Schramm    $ref: /schemas/types.yaml#/definitions/phandle
506e776188STobias Schramm
516e776188STobias Schrammrequired:
526e776188STobias Schramm  - compatible
536e776188STobias Schramm  - reg
546e776188STobias Schramm
555be478f9SRob HerringadditionalProperties: false
565be478f9SRob Herring
576e776188STobias Schrammexamples:
586e776188STobias Schramm  - |
596e776188STobias Schramm    i2c {
606e776188STobias Schramm        #address-cells = <1>;
616e776188STobias Schramm        #size-cells = <0>;
626e776188STobias Schramm
636e776188STobias Schramm        cw2015@62 {
646e776188STobias Schramm            compatible = "cellwise,cw201x";
656e776188STobias Schramm            reg = <0x62>;
666e776188STobias Schramm            cellwise,battery-profile = /bits/ 8 <
676e776188STobias Schramm                0x17 0x67 0x80 0x73 0x6E 0x6C 0x6B 0x63
686e776188STobias Schramm                0x77 0x51 0x5C 0x58 0x50 0x4C 0x48 0x36
696e776188STobias Schramm                0x15 0x0C 0x0C 0x19 0x5B 0x7D 0x6F 0x69
706e776188STobias Schramm                0x69 0x5B 0x0C 0x29 0x20 0x40 0x52 0x59
716e776188STobias Schramm                0x57 0x56 0x54 0x4F 0x3B 0x1F 0x7F 0x17
726e776188STobias Schramm                0x06 0x1A 0x30 0x5A 0x85 0x93 0x96 0x2D
736e776188STobias Schramm                0x48 0x77 0x9C 0xB3 0x80 0x52 0x94 0xCB
746e776188STobias Schramm                0x2F 0x00 0x64 0xA5 0xB5 0x11 0xF0 0x11
756e776188STobias Schramm           >;
766e776188STobias Schramm           cellwise,monitor-interval-ms = <5000>;
776e776188STobias Schramm           monitored-battery = <&bat>;
786e776188STobias Schramm           power-supplies = <&mains_charger>, <&usb_charger>;
796e776188STobias Schramm       };
806e776188STobias Schramm    };
816e776188STobias Schramm
82