Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580573

[PATCH v3 02/18] power: supply: power_supply_core: add constant-current-charge optional property

From Quentin Schulz <quentin.schulz@free-electrons.com>
Newsgroups linux.kernel
Subject [PATCH v3 02/18] power: supply: power_supply_core: add constant-current-charge optional property
Date 2017-02-14 15:30 +0100
Message-ID <taMhb-2YK-3@gated-at.bofh.it> (permalink)
References <taHUe-8vw-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This adds the constant-current-charge property to the list of optional
properties for the battery.

The constant charge current is critical for batteries as they can't
handle all charge currents.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---

added in v3

 drivers/power/supply/power_supply_core.c | 3 +++
 include/linux/power_supply.h             | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index ced8fef..c844def 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -498,6 +498,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
 	info->energy_full_design_uwh = -EINVAL;
 	info->charge_full_design_uah = -EINVAL;
 	info->voltage_min_design_uv  = -EINVAL;
+	info->constant_charge_current_ua  = -EINVAL;
 
 	if (!psy->of_node) {
 		dev_warn(&psy->dev, "%s currently only supports devicetree\n",
@@ -522,6 +523,8 @@ int power_supply_get_battery_info(struct power_supply *psy,
 			     &info->charge_full_design_uah);
 	of_property_read_u32(battery_np, "voltage-min-design-microvolt",
 			     &info->voltage_min_design_uv);
+	of_property_read_u32(battery_np, "constant-charge-current-microamp",
+			     &info->constant_charge_current_ua);
 
 	return 0;
 }
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index e84f1d3..f723a8e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -301,6 +301,7 @@ struct power_supply_battery_info {
 	int energy_full_design_uwh;	/* microWatt-hours */
 	int charge_full_design_uah;	/* microAmp-hours */
 	int voltage_min_design_uv;	/* microVolts */
+	int constant_charge_current_ua; /* microAmps */
 };
 
 extern struct atomic_notifier_head power_supply_notifier;
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/18] add support for AXP20X and AXP22X power supply drivers Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-02-14 15:20 +0100
  [PATCH v3 02/18] power: supply: power_supply_core: add constant-current-charge optional property Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-02-14 15:30 +0100
  [PATCH v3 03/18] mfd: axp20x: correct name of temperature data ADC registers Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-02-14 15:50 +0100
  Re: [PATCH v3 00/18] add support for AXP20X and AXP22X power supply  drivers Lee Jones <lee.jones@linaro.org> - 2017-02-15 10:40 +0100

csiph-web