All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] power: supply: core: Introduce one property to present the battery internal resistance
@ 2018-09-26  2:59 Baolin Wang
  2018-09-26  2:59 ` [PATCH v2 2/4] power: supply: core: Introduce properties to present the battery OCV table Baolin Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 26+ messages in thread
From: Baolin Wang @ 2018-09-26  2:59 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland
  Cc: linux-pm, devicetree, linux-kernel, yuanjiang.yu, baolin.wang,
	broonie, ctatlor97, linus.walleij

Introduce one property to present the battery internal resistance for battery
information.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
Changes from v1:
 - New patch in v2.
---
 .../devicetree/bindings/power/supply/battery.txt   |    2 ++
 drivers/power/supply/power_supply_core.c           |    3 +++
 include/linux/power_supply.h                       |    1 +
 3 files changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/supply/battery.txt b/Documentation/devicetree/bindings/power/supply/battery.txt
index f4d3b4a..25b9d2e 100644
--- a/Documentation/devicetree/bindings/power/supply/battery.txt
+++ b/Documentation/devicetree/bindings/power/supply/battery.txt
@@ -22,6 +22,7 @@ Optional Properties:
  - charge-term-current-microamp: current for charge termination phase
  - constant-charge-current-max-microamp: maximum constant input current
  - constant-charge-voltage-max-microvolt: maximum constant input voltage
+ - internal-resistance-micro-ohms: battery internal resistance
 
 Battery properties are named, where possible, for the corresponding
 elements in enum power_supply_property, defined in
@@ -42,6 +43,7 @@ Example:
 		charge-term-current-microamp = <128000>;
 		constant-charge-current-max-microamp = <900000>;
 		constant-charge-voltage-max-microvolt = <4200000>;
+		internal-resistance-micro-ohms = <250000>;
 	};
 
 	charger: charger@11 {
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index e853618..9f3452f 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -579,6 +579,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
 	info->charge_term_current_ua         = -EINVAL;
 	info->constant_charge_current_max_ua = -EINVAL;
 	info->constant_charge_voltage_max_uv = -EINVAL;
+	info->internal_resistance_uohm       = -EINVAL;
 
 	if (!psy->of_node) {
 		dev_warn(&psy->dev, "%s currently only supports devicetree\n",
@@ -616,6 +617,8 @@ int power_supply_get_battery_info(struct power_supply *psy,
 			     &info->constant_charge_current_max_ua);
 	of_property_read_u32(battery_np, "constant_charge_voltage_max_microvolt",
 			     &info->constant_charge_voltage_max_uv);
+	of_property_read_u32(battery_np, "internal-resistance-micro-ohms",
+			     &info->internal_resistance_uohm);
 
 	return 0;
 }
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f807691..019452d 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -326,6 +326,7 @@ struct power_supply_battery_info {
 	int charge_term_current_ua;	    /* microAmps */
 	int constant_charge_current_max_ua; /* microAmps */
 	int constant_charge_voltage_max_uv; /* microVolts */
+	int internal_resistance_uohm;       /* microOhms */
 };
 
 extern struct atomic_notifier_head power_supply_notifier;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2018-09-27  6:40 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26  2:59 [PATCH v2 1/4] power: supply: core: Introduce one property to present the battery internal resistance Baolin Wang
2018-09-26  2:59 ` [PATCH v2 2/4] power: supply: core: Introduce properties to present the battery OCV table Baolin Wang
2018-09-26  8:02   ` Linus Walleij
2018-09-26  8:02     ` Linus Walleij
2018-09-26 13:51   ` Sebastian Reichel
2018-09-27  1:10     ` Baolin Wang
2018-09-27  6:40       ` Sebastian Reichel
2018-09-26  2:59 ` [PATCH v2 3/4] dt-bindings: power: Add Spreadtrum SC27XX fuel gauge unit documentation Baolin Wang
2018-09-26  8:04   ` Linus Walleij
2018-09-26  8:04     ` Linus Walleij
2018-09-26 14:14   ` Sebastian Reichel
2018-09-26  2:59 ` [PATCH v2 4/4] power: supply: Add Spreadtrum SC27XX fuel gauge unit driver Baolin Wang
2018-09-26  8:09   ` Linus Walleij
2018-09-26  8:09     ` Linus Walleij
2018-09-26  8:33     ` Baolin Wang
2018-09-26  8:33       ` Baolin Wang
2018-09-26 15:30   ` Sebastian Reichel
2018-09-27  5:17     ` Baolin Wang
2018-09-26  8:00 ` [PATCH v2 1/4] power: supply: core: Introduce one property to present the battery internal resistance Linus Walleij
2018-09-26  8:00   ` Linus Walleij
2018-09-26  8:30   ` Baolin Wang
2018-09-26  8:30     ` Baolin Wang
2018-09-26 12:45     ` Sebastian Reichel
2018-09-26 12:45       ` Sebastian Reichel
2018-09-27  1:06       ` Baolin Wang
2018-09-27  1:06         ` Baolin Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.