Skip to contentSkip to conversation

power_supply: Add additional health properties to the header

PATCH In review Dan Murphy 2 participants 7 messages Oct 29, 2019 – Jan 7, 2020

Subsystems (2)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH v2 1/3 power_supply: Add additional health properties to the header

Add HEALTH_WARM, HEALTH_COOL and HEALTH_HOT to the health enum.

---

v2 - No changes

 include/linux/power_supply.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/power_supply.h +3 -0
index 28413f737e7d..bd0d3225f245 100644
@@ -61,6 +61,9 @@ enum {
 	POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
 	POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
 	POWER_SUPPLY_HEALTH_OVERCURRENT,
+	POWER_SUPPLY_HEALTH_WARM,
+	POWER_SUPPLY_HEALTH_COOL,
+	POWER_SUPPLY_HEALTH_HOT,
 };
 
 enum {
Signature · 1 line
2.22.0.214.g8dca754b1e
author
#1 lore raw

PATCH v2 2/3 dt-bindings: power: Add the bq2515x family dt bindings

Add the bindings for the bq25150 and bq25155 500mA charging ICs from Texas Instruments.

Datasheet:
http://www.ti.com/lit/ds/symlink/bq25150.pdf
http://www.ti.com/lit/ds/symlink/bq25155.pdf

---

v2 - Converted to yaml format and removed ti,* properties for already defined properties

 .../bindings/power/supply/bq2515x.yaml        | 85 +++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq2515x.yaml
Documentation/devicetree/bindings/power/supply/bq2515x.yaml new file +85 -0
new file mode 100644
index 000000000000..4e6225056f45
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (C) 2019 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq2515x.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TI bq2515x 500-mA Linear charger family
+
+maintainers:
+  - Dan Murphy <[email protected]>
+
+description: |
+  The BQ2515x family is a highly integrated battery charge management IC that
+  integrates the most common functions for wearable devices, namely a charger,
+  an output voltage rail, ADC for battery and system monitoring, and
+  push-button controller.
+
+  Specifications about the charger can be found at:
+    http://www.ti.com/lit/ds/symlink/bq25150.pdf
+    http://www.ti.com/lit/ds/symlink/bq25155.pdf
+
+properties:
+  compatible:
+    enum:
+      - ti,bq25150
+      - ti,bq25155
+
+  reg:
+    maxItems: 1
+
+  pg-gpios:
+    description: |
+       GPIO used for connecting the bq2515x device PG (Power Good)
+       pin.  This pin should be used if possible as this is the
+       recommended way to obtain the charger's input PG state.
+       If this pin is not specified a software-based approach for PG
+       detection is used.
+
+  reset-gpios:
+    description: |
+       GPIO used for hardware reset.
+
+  low-power-gpios:
+    description: |
+       GPIO used for low power mode of IC.
+
+  charge-enable-gpios:
+    description: |
+       GPIO used to turn on and off charging.
+
+  constant-charge-current-max-microamp:
+    description: |
+       Maximum charging current in micro Amps.
+    minimum: 50000
+    maximum: 600000
+
+  voltage-max-design-microvolt:
+    description: |
+       Maximum charging voltage in micro volts.
+    minimum: 3600000
+    maximum: 4600000
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      charger@6b {
+          compatible = "ti,bq25150";
+          reg = <0x6b>;
+
+          pg-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
+          reset-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
+          low-power-gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
+          charge-enable-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+          constant-charge-current-max-microamp = <300000>;
+          voltage-max-design-microvolt = <4200000>;
+      };
+    };
Signature · 1 line
2.22.0.214.g8dca754b1e
#2 lore raw

Re: [PATCH v2 2/3] dt-bindings: power: Add the bq2515x family dt bindings

Hi,

Quoted 64 lines · Dan Murphy

Add the bindings for the bq25150 and bq25155 500mA charging ICs from Texas Instruments.

Datasheet:
http://www.ti.com/lit/ds/symlink/bq25150.pdf
http://www.ti.com/lit/ds/symlink/bq25155.pdf

---

v2 - Converted to yaml format and removed ti,* properties for already defined properties

 .../bindings/power/supply/bq2515x.yaml        | 85 +++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq2515x.yaml
Documentation/devicetree/bindings/power/supply/bq2515x.yaml new file +40 -0
new file mode 100644
index 000000000000..4e6225056f45
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (C) 2019 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq2515x.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TI bq2515x 500-mA Linear charger family
+
+maintainers:
+  - Dan Murphy <[email protected]>
+
+description: |
+  The BQ2515x family is a highly integrated battery charge management IC that
+  integrates the most common functions for wearable devices, namely a charger,
+  an output voltage rail, ADC for battery and system monitoring, and
+  push-button controller.
+
+  Specifications about the charger can be found at:
+    http://www.ti.com/lit/ds/symlink/bq25150.pdf
+    http://www.ti.com/lit/ds/symlink/bq25155.pdf
+
+properties:
+  compatible:
+    enum:
+      - ti,bq25150
+      - ti,bq25155
+
+  reg:
+    maxItems: 1
+
+  pg-gpios:
+    description: |
+       GPIO used for connecting the bq2515x device PG (Power Good)
+       pin.  This pin should be used if possible as this is the
+       recommended way to obtain the charger's input PG state.
+       If this pin is not specified a software-based approach for PG
+       detection is used.
+
+  reset-gpios:

Documentation/devicetree/bindings/power/supply/bq2515x.yaml line 50

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/bq2515x.yaml new file +10 -0
+    description: |
+       GPIO used for hardware reset.
+
+  low-power-gpios:
+    description: |
+       GPIO used for low power mode of IC.
+
+  charge-enable-gpios:
+    description: |
+       GPIO used to turn on and off charging.

Above looks ok to me.

Documentation/devicetree/bindings/power/supply/bq2515x.yaml line 62

Quoted 11 lines
Documentation/devicetree/bindings/power/supply/bq2515x.yaml new file +11 -0
+  constant-charge-current-max-microamp:
+    description: |
+       Maximum charging current in micro Amps.
+    minimum: 50000
+    maximum: 600000
+
+  voltage-max-design-microvolt:
+    description: |
+       Maximum charging voltage in micro volts.
+    minimum: 3600000
+    maximum: 4600000

These two should use the simple-battery binding, as seen in Documentation/devicetree/bindings/power/supply/battery.txt

-- Sebastian

Quoted 26 lines
Documentation/devicetree/bindings/power/supply/bq2515x.yaml new file +23 -0
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      charger@6b {
+          compatible = "ti,bq25150";
+          reg = <0x6b>;
+
+          pg-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
+          reset-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
+          low-power-gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
+          charge-enable-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+          constant-charge-current-max-microamp = <300000>;
+          voltage-max-design-microvolt = <4200000>;
+      };
+    };
Signature · 1 line
2.22.0.214.g8dca754b1e
author
#3 lore raw

PATCH v2 3/3 power: supply: bq2515x: Introduce the bq2515x family

In reply to Dan Murphy

Introduce the bq25150 and bq25155 supply chargers.

---

v2 - Made associated changes from DT changes, change conversions to uV as opposed to mV, and change OVERHEAT reporting to HOT.

 drivers/power/supply/Kconfig           |   8 +
 drivers/power/supply/Makefile          |   1 +
 drivers/power/supply/bq2515x_charger.c | 739 +++++++++++++++++++++++++
 3 files changed, 748 insertions(+)
 create mode 100644 drivers/power/supply/bq2515x_charger.c
drivers/power/supply/Kconfig +8 -0
index c84a7b1caeb6..d6228516fc70 100644
@@ -589,6 +589,14 @@ config CHARGER_BQ24735
 	help
 	  Say Y to enable support for the TI BQ24735 battery charger.
 
+config CHARGER_BQ2515X
+	tristate "TI BQ2515X battery charger family"
+	depends on I2C
+	depends on GPIOLIB || COMPILE_TEST
+	select REGMAP_I2C
+	help
+	  Say Y to enable support for the TI BQ2515X battery charger.
+
 config CHARGER_BQ25890
 	tristate "TI BQ25890 battery charger driver"
 	depends on I2C
drivers/power/supply/Makefile +1 -0
index 6c7da920ea83..8fcc175a7e22 100644
@@ -80,6 +80,7 @@ obj-$(CONFIG_CHARGER_BQ2415X)	+= bq2415x_charger.o
 obj-$(CONFIG_CHARGER_BQ24190)	+= bq24190_charger.o
 obj-$(CONFIG_CHARGER_BQ24257)	+= bq24257_charger.o
 obj-$(CONFIG_CHARGER_BQ24735)	+= bq24735-charger.o
+obj-$(CONFIG_CHARGER_BQ2515X)	+= bq2515x_charger.o
 obj-$(CONFIG_CHARGER_BQ25890)	+= bq25890_charger.o
 obj-$(CONFIG_CHARGER_SMB347)	+= smb347-charger.o
 obj-$(CONFIG_CHARGER_TPS65090)	+= tps65090-charger.o
drivers/power/supply/bq2515x_charger.c new file +739 -0

739 lines not on this page · raw message

Signature · 1 line
2.22.0.214.g8dca754b1e
author
#4 lore raw
In reply to Dan Murphy

Bump

Quoted 24 lines · Dan Murphy

Add HEALTH_WARM, HEALTH_COOL and HEALTH_HOT to the health enum.

---

v2 - No changes

  include/linux/power_supply.h | 3 +++
  1 file changed, 3 insertions(+)
include/linux/power_supply.h +3 -0
index 28413f737e7d..bd0d3225f245 100644
@@ -61,6 +61,9 @@ enum {
  	POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
  	POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
  	POWER_SUPPLY_HEALTH_OVERCURRENT,
+	POWER_SUPPLY_HEALTH_WARM,
+	POWER_SUPPLY_HEALTH_COOL,
+	POWER_SUPPLY_HEALTH_HOT,
  };
 
  enum {
#5 lore raw
In reply to Dan Murphy

Hi Dan,

Quoted 4 lines · Dan Murphy

Add HEALTH_WARM, HEALTH_COOL and HEALTH_HOT to the health enum.

---

This needs to update /sys/class/power_supply/<supply_name>/health entry in Documentation/ABI/testing/sysfs-class-power. Also it needs to update power_supply_health_text in drivers/power/supply/power_supply_sysfs.c.

-- Sebastian

Quoted 23 lines

v2 - No changes

 include/linux/power_supply.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/power_supply.h +3 -0
index 28413f737e7d..bd0d3225f245 100644
@@ -61,6 +61,9 @@ enum {
 	POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
 	POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
 	POWER_SUPPLY_HEALTH_OVERCURRENT,
+	POWER_SUPPLY_HEALTH_WARM,
+	POWER_SUPPLY_HEALTH_COOL,
+	POWER_SUPPLY_HEALTH_HOT,
 };
 
 enum {
Signature · 1 line
2.22.0.214.g8dca754b1e
author
#6 lore raw

Sebastian

Quoted 9 lines · Sebastian Reichel

Hi Dan,

Quoted 4 lines · Dan Murphy

Add HEALTH_WARM, HEALTH_COOL and HEALTH_HOT to the health enum.

---

This needs to update /sys/class/power_supply/<supply_name>/health entry in Documentation/ABI/testing/sysfs-class-power. Also it needs

I noticed "Over Current" was missing from the ABI doc.  Do you want that addition in a separate patch or can I add it in my update?

Dan

<snip>