Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fuel_gauge: Add battery cutoff support
Many fuel gauge ICs offer a battery cutoff/shipping mode functionality that cutoff charge from the battery. This is often useful for preserving battery charge on devices while in storage. Add battery cutoff support to the fuel gauge API with a generic default SBS driver showing an example of support in tests. Signed-off-by: Aaron Massey <aaronmassey@google.com>
- Loading branch information
1 parent
37cc256
commit c6f5791
Showing
14 changed files
with
356 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Copyright 2023 Google LLC | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
description: | | ||
Properties for fuel-gauges that may control battery cutoff, this is common in SBS compliant or | ||
similarly smart battery fuel gauges. | ||
Note: These properties are to be used with meaningful defaults in fuel gauge ICs that implement | ||
battery cutoff support. See the default fuel gauge SBS Gauge compatible as an example. | ||
properties: | ||
battery-cutoff-support: | ||
description: | | ||
Helper prop that indicates whether this device can cutoff the battery, this is also often | ||
referred to as ship or sleep mode. Any non-zero value means battery cutoff is supported. | ||
type: boolean | ||
battery-cutoff-reg-addr: | ||
description: | | ||
Address of register to receive cutoff payload for battery cutoff. | ||
type: int | ||
battery-cutoff-payload: | ||
description: | | ||
Payload to write to cutoff battery register. This must be array of 2 integers. If your | ||
battery only requires a single payload, duplicate the value. This will cause the driver to | ||
issue the cutoff twice. | ||
type: array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Copyright 2023 Google LLC | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
compatible: "sbs,default-sbs-gauge" | ||
|
||
include: ["sbs,sbs-gauge-new-api.yaml", "battery_cutoff.yaml"] | ||
|
||
description: | | ||
Default generic smart battery fuel gauge driver. Includes support for battery cutoff if enabled. | ||
This compatible is intended to be used with the abstract SBS Gauge compatible because it is | ||
actuated by the SBS driver for SBS compliant fuel gauge ICs. | ||
properties: | ||
battery-cutoff-reg-addr: | ||
# For SBS compliant fuel gauges this is usually "ManufactuerAccess" | ||
default: 0x0 | ||
battery-cutoff-payload: | ||
default: [0x0010, 0x0010] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.