summaryrefslogtreecommitdiff
path: root/zephyr/dts/bindings/battery
diff options
context:
space:
mode:
authorMichał Barnaś <mb@semihalf.com>2021-08-19 14:41:52 +0200
committerCommit Bot <commit-bot@chromium.org>2021-09-03 21:30:57 +0000
commit970bd536ade4a2f4922a0dc95dfc7a7458ada89a (patch)
treec32e683887843d82de9d2f5c4aa697c2c1bebbf5 /zephyr/dts/bindings/battery
parent0c0ba0a2b1297fa9bb1c47da95c220ae1df3b9e2 (diff)
downloadchrome-ec-970bd536ade4a2f4922a0dc95dfc7a7458ada89a.tar.gz
zephyr: add batteries to device tree
This commit adds possibility to define board's batteries in device tree. Default battery is defined by adding "default_battery" as node's label. It also adds common batteries definitions that can be used using compatible string. If no 'batteries' node is defined in device tree, custom board's logic must be used and old "named-batteries" should be defined. BRANCH=main BUG=b:183544739 TEST=This commit shouldn't change behaviour of any build. Compiling and flashing CrOS EC and Zephyr should work without problems. Change-Id: I94f0121f45eb061f1358fadbcd7d8006c08b0bea Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3107385 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/dts/bindings/battery')
-rw-r--r--zephyr/dts/bindings/battery/as3gwrc3ka,c235-41.yaml47
-rw-r--r--zephyr/dts/bindings/battery/battery-fuel-gauge.yaml84
-rw-r--r--zephyr/dts/bindings/battery/battery-info.yaml71
-rw-r--r--zephyr/dts/bindings/battery/battery-smart.yaml19
-rw-r--r--zephyr/dts/bindings/battery/lgc,ap16l8j.yaml47
-rw-r--r--zephyr/dts/bindings/battery/lgc,ap18c8k.yaml49
-rw-r--r--zephyr/dts/bindings/battery/murata,ap18c4k.yaml49
-rw-r--r--zephyr/dts/bindings/battery/panasonic,ap16l5j-009.yaml49
-rw-r--r--zephyr/dts/bindings/battery/panasonic,ap16l5j.yaml49
9 files changed, 464 insertions, 0 deletions
diff --git a/zephyr/dts/bindings/battery/as3gwrc3ka,c235-41.yaml b/zephyr/dts/bindings/battery/as3gwrc3ka,c235-41.yaml
new file mode 100644
index 0000000000..94463eca89
--- /dev/null
+++ b/zephyr/dts/bindings/battery/as3gwrc3ka,c235-41.yaml
@@ -0,0 +1,47 @@
+description: "AS3GWRc3KA C235-41"
+compatible: "as3gwrc3ka,c235-41"
+
+include: battery-smart.yaml
+
+properties:
+ enum-name:
+ type: string
+ default: "as3gwrc3ka,c235-41"
+
+ # Fuel gauge
+ manuf_name:
+ default: "AS3GWRc3KA"
+ device_name:
+ default: "C235-41"
+ ship_mode_reg_addr:
+ default: 0x00
+ ship_mode_reg_data:
+ default: [ 0x10, 0x10 ]
+ fet_reg_addr:
+ default: 0x99
+ fet_reg_mask:
+ default: 0x0c
+ fet_disconnect_val:
+ default: 0x0c
+
+ # Battery info
+ voltage_max:
+ default: 8800
+ voltage_normal:
+ default: 7700
+ voltage_min:
+ default: 6000
+ precharge_current:
+ default: 256
+ start_charging_min_c:
+ default: 0
+ start_charging_max_c:
+ default: 45
+ charging_min_c:
+ default: 0
+ charging_max_c:
+ default: 60
+ discharging_min_c:
+ default: 0
+ discharging_max_c:
+ default: 60
diff --git a/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml b/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml
new file mode 100644
index 0000000000..9365910aa6
--- /dev/null
+++ b/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml
@@ -0,0 +1,84 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description: |
+ Battery fuel gauge parameters
+
+compatible: "battery-fuel-gauge"
+
+properties:
+ manuf_name:
+ description: Manufacturer name
+ type: string
+ device_name:
+ description: Model/Device name
+ type: string
+ ship_mode_wb_support:
+ description: |
+ Write Block support. If this is true, then i2c write block command
+ will be used instead of a 16-bit write
+ Value must be either 0 or 1.
+ type: int
+ ship_mode_reg_addr:
+ description: |
+ Address of register responsible for enabling ship mode.
+ type: int
+ ship_mode_reg_data:
+ description: |
+ Values written to register to enable ship mode.
+ type: array
+ sleep_mode_support:
+ description: |
+ Defines if battery support fuel gauge sleep command.
+ Value must be either 0 or 1.
+ type: int
+ sleep_mode_reg_addr:
+ description: |
+ Defines address where command will be sent to go into sleep mode.
+ type: int
+ sleep_mode_reg_data:
+ description: |
+ Defines value which will be sent to register to go into sleep mode.
+ type: int
+ fet_mfgacc_support:
+ description: |
+ Defines if battery supports manufacturer access command.
+ If enabled, FET status is read using the ManufacturerBlockAccess (0x44)
+ to read the OperationStatus (0x54) register.
+ The fet_reg_mask and fet_disconnect_val properties must still be
+ defined.
+ Value must be either 0 or 1.
+ type: int
+ fet_reg_addr:
+ description: |
+ Address of register which reports charging and discharging FETs status.
+ This property is ignored if fet_mfgacc_support is true.
+ type: int
+ fet_reg_mask:
+ description: |
+ Mask which determines which bit in status value contains the
+ discharge FET status.
+ type: int
+ fet_disconnect_val:
+ description: |
+ Value that describes which bits must be set to determine that
+ discharge FET has disconnected the battery.
+ type: int
+ fet_cfet_mask:
+ description: |
+ Mask which determines which bit in status value contains the
+ charge FET status. If this value is 0, this means there's
+ no charge FET.
+ type: int
+ fet_cfet_off_val:
+ description: |
+ Value that describes which bits must be set to determine that
+ charge FET has disconnected the battery.
+ type: int
+ imbalance_mv:
+ description: |
+ This property is used if CONFIG_BATTERY_MEASURE_IMBALANCE is defined.
+ It should be an enum and its value should be a name of function
+ which will be assigned to imbalance_mv pointer.
+ type: string
diff --git a/zephyr/dts/bindings/battery/battery-info.yaml b/zephyr/dts/bindings/battery/battery-info.yaml
new file mode 100644
index 0000000000..b84056c266
--- /dev/null
+++ b/zephyr/dts/bindings/battery/battery-info.yaml
@@ -0,0 +1,71 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description:
+ Information about battery
+ Voltage is in millivolts
+ Current is in milliamperes
+ Temperature is in Celsius degrees
+
+compatible: "battery-info"
+
+properties:
+ voltage_max:
+ description: |
+ Maximum voltage that can be applied to the battery.
+ type: int
+ voltage_normal:
+ description: |
+ Nominal voltage of the battery.
+ type: int
+ voltage_min:
+ description: |
+ Minimum voltage of the battery.
+ If current voltage is below this value, system will shutdown.
+ type: int
+ precharge_voltage:
+ description: |
+ Voltage used during the precharge phase. Not all chargers
+ may take these into account.
+ type: int
+ precharge_current:
+ description: |
+ Maximum current used during the precharge phase.
+ type: int
+ start_charging_min_c:
+ description: |
+ Minimum temperature of battery to start charging it.
+ This value is used only if CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
+ is defined.
+ type: int
+ start_charging_max_c:
+ description: |
+ Maximum temperature of battery to start charging it.
+ This value is used only if CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
+ is defined.
+ type: int
+ charging_min_c:
+ description: |
+ Minimum temperature of battery during charging it. If the battery
+ temperature falls below this value, charging will be stopped.
+ This value is used only if CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
+ is defined.
+ type: int
+ charging_max_c:
+ description: |
+ Maximum temperature of battery during charging it. If the battery
+ temperature raises above this value, charging will be stopped.
+ This value is used only if CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
+ is defined.
+ type: int
+ discharging_min_c:
+ description: |
+ Minimum working temperature of battery.
+ If temperature is below this value, the system will shutdown.
+ type: int
+ discharging_max_c:
+ description: |
+ Maximum working temperature of battery.
+ If temperature is above this value, the system will shutdown.
+ type: int
diff --git a/zephyr/dts/bindings/battery/battery-smart.yaml b/zephyr/dts/bindings/battery/battery-smart.yaml
new file mode 100644
index 0000000000..ce0a330077
--- /dev/null
+++ b/zephyr/dts/bindings/battery/battery-smart.yaml
@@ -0,0 +1,19 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+compatible: "battery-smart"
+
+include: [ "base.yaml", "battery-info.yaml", "battery-fuel-gauge.yaml" ]
+
+properties:
+ enum-name:
+ description: Unique value used for creating enum of batteries types
+ type: string
+ enum:
+ - "as3gwrc3ka,c235-41"
+ - "lgc,ap16l8j"
+ - "lgc,ap18c8k"
+ - "murata,ap18c4k"
+ - "panasonic,ap16l5j"
+ - "panasonic,ap16l5j-009"
diff --git a/zephyr/dts/bindings/battery/lgc,ap16l8j.yaml b/zephyr/dts/bindings/battery/lgc,ap16l8j.yaml
new file mode 100644
index 0000000000..546b33522a
--- /dev/null
+++ b/zephyr/dts/bindings/battery/lgc,ap16l8j.yaml
@@ -0,0 +1,47 @@
+description: "LGC KT0020G010 AP16L8J"
+compatible: "lgc,ap16l8j"
+
+include: battery-smart.yaml
+
+properties:
+ enum-name:
+ type: string
+ default: "lgc,ap16l8j"
+
+ # Fuel gauge
+ manuf_name:
+ default: "LGC KT0020G010"
+ device_name:
+ default: "AP16L8J"
+ ship_mode_reg_addr:
+ default: 0x3A
+ ship_mode_reg_data:
+ default: [ 0xC574, 0xC574 ]
+ fet_mfgacc_support:
+ default: 1
+ fet_reg_mask:
+ default: 0x0002
+ fet_disconnect_val:
+ default: 0x0
+
+ # Battery info
+ voltage_max:
+ default: 8700
+ voltage_normal:
+ default: 7500
+ voltage_min:
+ default: 6000
+ precharge_current:
+ default: 256
+ start_charging_min_c:
+ default: 0
+ start_charging_max_c:
+ default: 50
+ charging_min_c:
+ default: 0
+ charging_max_c:
+ default: 60
+ discharging_min_c:
+ default: -20
+ discharging_max_c:
+ default: 75
diff --git a/zephyr/dts/bindings/battery/lgc,ap18c8k.yaml b/zephyr/dts/bindings/battery/lgc,ap18c8k.yaml
new file mode 100644
index 0000000000..727c510e04
--- /dev/null
+++ b/zephyr/dts/bindings/battery/lgc,ap18c8k.yaml
@@ -0,0 +1,49 @@
+description: "LGC KT0030G020 AP18C8K"
+compatible: "lgc,ap18c8k"
+
+include: battery-smart.yaml
+
+properties:
+ enum-name:
+ type: string
+ default: "lgc,ap18c8k"
+
+ # Fuel gauge
+ manuf_name:
+ default: "LGC KT0030G020"
+ device_name:
+ default: "AP18C8K"
+ ship_mode_reg_addr:
+ default: 0x3A
+ ship_mode_reg_data:
+ default: [ 0xC574, 0xC574 ]
+ fet_mfgacc_support:
+ default: 0
+ fet_reg_addr:
+ default: 0x43
+ fet_reg_mask:
+ default: 0x0001
+ fet_disconnect_val:
+ default: 0x0
+
+ # Battery info
+ voltage_max:
+ default: 13050
+ voltage_normal:
+ default: 11250
+ voltage_min:
+ default: 9000
+ precharge_current:
+ default: 256
+ start_charging_min_c:
+ default: 0
+ start_charging_max_c:
+ default: 50
+ charging_min_c:
+ default: 0
+ charging_max_c:
+ default: 60
+ discharging_min_c:
+ default: -20
+ discharging_max_c:
+ default: 75
diff --git a/zephyr/dts/bindings/battery/murata,ap18c4k.yaml b/zephyr/dts/bindings/battery/murata,ap18c4k.yaml
new file mode 100644
index 0000000000..c8301beaa3
--- /dev/null
+++ b/zephyr/dts/bindings/battery/murata,ap18c4k.yaml
@@ -0,0 +1,49 @@
+description: "Murata KT00304012 AP18C4K"
+compatible: "murata,ap18c4k"
+
+include: battery-smart.yaml
+
+properties:
+ enum-name:
+ type: string
+ default: "murata,ap18c4k"
+
+ # Fuel gauge
+ manuf_name:
+ default: "Murata KT00304012"
+ device_name:
+ default: "AP18C4K"
+ ship_mode_reg_addr:
+ default: 0x3A
+ ship_mode_reg_data:
+ default: [ 0xC574, 0xC574 ]
+ fet_mfgacc_support:
+ default: 0
+ fet_reg_addr:
+ default: 0x0
+ fet_reg_mask:
+ default: 0x2000
+ fet_disconnect_val:
+ default: 0x2000
+
+ # Battery info
+ voltage_max:
+ default: 13200
+ voltage_normal:
+ default: 11400
+ voltage_min:
+ default: 9000
+ precharge_current:
+ default: 256
+ start_charging_min_c:
+ default: 0
+ start_charging_max_c:
+ default: 50
+ charging_min_c:
+ default: 0
+ charging_max_c:
+ default: 60
+ discharging_min_c:
+ default: -20
+ discharging_max_c:
+ default: 75
diff --git a/zephyr/dts/bindings/battery/panasonic,ap16l5j-009.yaml b/zephyr/dts/bindings/battery/panasonic,ap16l5j-009.yaml
new file mode 100644
index 0000000000..a198049881
--- /dev/null
+++ b/zephyr/dts/bindings/battery/panasonic,ap16l5j-009.yaml
@@ -0,0 +1,49 @@
+description: "Panasonic KT00205009 AP16L5J"
+compatible: "panasonic,ap16l5j-009"
+
+include: battery-smart.yaml
+
+properties:
+ enum-name:
+ type: string
+ default: "panasonic,ap16l5j-009"
+
+ # Fuel gauge
+ manuf_name:
+ default: "PANASONIC KT00205009"
+ device_name:
+ default: "AP16L5J"
+ ship_mode_reg_addr:
+ default: 0x3A
+ ship_mode_reg_data:
+ default: [ 0xC574, 0xC574 ]
+ fet_mfgacc_support:
+ default: 0
+ fet_reg_addr:
+ default: 0x0
+ fet_reg_mask:
+ default: 0x4000
+ fet_disconnect_val:
+ default: 0x0
+
+ # Battery info
+ voltage_max:
+ default: 8800
+ voltage_normal:
+ default: 7700
+ voltage_min:
+ default: 6000
+ precharge_current:
+ default: 256
+ start_charging_min_c:
+ default: 0
+ start_charging_max_c:
+ default: 50
+ charging_min_c:
+ default: 0
+ charging_max_c:
+ default: 60
+ discharging_min_c:
+ default: -20
+ discharging_max_c:
+ default: 75
diff --git a/zephyr/dts/bindings/battery/panasonic,ap16l5j.yaml b/zephyr/dts/bindings/battery/panasonic,ap16l5j.yaml
new file mode 100644
index 0000000000..fcfff98de1
--- /dev/null
+++ b/zephyr/dts/bindings/battery/panasonic,ap16l5j.yaml
@@ -0,0 +1,49 @@
+description: "Panasonic AP16L5J"
+compatible: "panasonic,ap16l5j"
+
+include: battery-smart.yaml
+
+properties:
+ enum-name:
+ type: string
+ default: "panasonic,ap16l5j"
+
+ # Fuel gauge
+ manuf_name:
+ default: "PANASONIC"
+ device_name:
+ default: "AP16L5J"
+ ship_mode_reg_addr:
+ default: 0x3A
+ ship_mode_reg_data:
+ default: [ 0xC574, 0xC574 ]
+ fet_mfgacc_support:
+ default: 0
+ fet_reg_addr:
+ default: 0x0
+ fet_reg_mask:
+ default: 0x4000
+ fet_disconnect_val:
+ default: 0x0
+
+ # Battery info
+ voltage_max:
+ default: 8800
+ voltage_normal:
+ default: 7700
+ voltage_min:
+ default: 6000
+ precharge_current:
+ default: 256
+ start_charging_min_c:
+ default: 0
+ start_charging_max_c:
+ default: 50
+ charging_min_c:
+ default: 0
+ charging_max_c:
+ default: 60
+ discharging_min_c:
+ default: -20
+ discharging_max_c:
+ default: 75