All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: sre@kernel.org, robh@kernel.org
Cc: mark.rutland@arm.com, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@networkimprov.net
Subject: [PATCH v3 2/4] power: supply: core: add charging voltage/current battery info
Date: Fri, 26 May 2017 13:04:11 +0200	[thread overview]
Message-ID: <20170526110413.24836-2-enric.balletbo@collabora.com> (raw)
In-Reply-To: <20170526110413.24836-1-enric.balletbo@collabora.com>

Add the parameters to define the battery charging voltage and charging
current. Charger driver can get this information from the struct
power_supply_battery_info and apply the desired value.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v2:
 - Requested by Sebastian Reichel
   - Move to its own patch and apply to simple-battery framework.
Changes since v1:
 - Requested by Rob Herring
   - Rename ti,charge-* to charge-* to be standard properties.
   - Use unit suffixes as per bindings/property-units.txt

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

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 862fa8fc..a6857c2 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -530,6 +530,8 @@ 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->charge_voltage_uv = -EINVAL;
+	info->charge_current_ua = -EINVAL;
 
 	if (!psy->of_node) {
 		dev_warn(&psy->dev, "%s currently only supports devicetree\n",
@@ -559,6 +561,10 @@ 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, "charge-voltage-microvolt",
+			     &info->charge_voltage_uv);
+	of_property_read_u32(battery_np, "charge-current-microamp",
+			     &info->charge_current_ua);
 
 	return 0;
 }
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 8220f7b..3eea323 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -302,6 +302,8 @@ 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 charge_voltage_uv;		/* microVolts */
+	int charge_current_ua;		/* microAmp */
 };
 
 extern struct atomic_notifier_head power_supply_notifier;
-- 
2.9.3

WARNING: multiple messages have this Message-ID (diff)
From: Enric Balletbo i Serra <enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
To: sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: mark.rutland-5wv7dgnIgG8@public.gmane.org,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org
Subject: [PATCH v3 2/4] power: supply: core: add charging voltage/current battery info
Date: Fri, 26 May 2017 13:04:11 +0200	[thread overview]
Message-ID: <20170526110413.24836-2-enric.balletbo@collabora.com> (raw)
In-Reply-To: <20170526110413.24836-1-enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>

Add the parameters to define the battery charging voltage and charging
current. Charger driver can get this information from the struct
power_supply_battery_info and apply the desired value.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
---
Changes since v2:
 - Requested by Sebastian Reichel
   - Move to its own patch and apply to simple-battery framework.
Changes since v1:
 - Requested by Rob Herring
   - Rename ti,charge-* to charge-* to be standard properties.
   - Use unit suffixes as per bindings/property-units.txt

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

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 862fa8fc..a6857c2 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -530,6 +530,8 @@ 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->charge_voltage_uv = -EINVAL;
+	info->charge_current_ua = -EINVAL;
 
 	if (!psy->of_node) {
 		dev_warn(&psy->dev, "%s currently only supports devicetree\n",
@@ -559,6 +561,10 @@ 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, "charge-voltage-microvolt",
+			     &info->charge_voltage_uv);
+	of_property_read_u32(battery_np, "charge-current-microamp",
+			     &info->charge_current_ua);
 
 	return 0;
 }
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 8220f7b..3eea323 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -302,6 +302,8 @@ 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 charge_voltage_uv;		/* microVolts */
+	int charge_current_ua;		/* microAmp */
 };
 
 extern struct atomic_notifier_head power_supply_notifier;
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-05-26 11:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 11:04 [PATCH v3 1/4] dt-bindings: power: supply: add battery charge voltage/current Enric Balletbo i Serra
2017-05-26 11:04 ` Enric Balletbo i Serra
2017-05-26 11:04 ` Enric Balletbo i Serra [this message]
2017-05-26 11:04   ` [PATCH v3 2/4] power: supply: core: add charging voltage/current battery info Enric Balletbo i Serra
2017-05-26 21:22   ` Liam Breck
2017-05-26 21:22     ` Liam Breck
2017-05-27 20:12     ` Enric Balletbo Serra
2017-05-27 20:12       ` Enric Balletbo Serra
2017-05-26 11:04 ` [PATCH v3 3/4] dt-bindings: power: tps65217_charger: add NTC type for battery temperature measurement Enric Balletbo i Serra
2017-05-26 21:26   ` Liam Breck
2017-05-26 21:26     ` Liam Breck
2017-05-27 20:14     ` Enric Balletbo Serra
2017-05-27 20:14       ` Enric Balletbo Serra
2017-05-26 11:04 ` [PATCH v3 4/4] power: tps65217_charger: add support for NTC type, voltage and current charge Enric Balletbo i Serra
2017-05-26 22:31   ` Liam Breck
2017-05-26 22:31     ` Liam Breck
2017-06-08 16:11   ` Sebastian Reichel
2017-06-08 16:11     ` Sebastian Reichel
2017-05-26 21:20 ` [PATCH v3 1/4] dt-bindings: power: supply: add battery charge voltage/current Liam Breck
2017-05-26 21:20   ` Liam Breck
2017-05-27 20:11   ` Enric Balletbo Serra
2017-05-27 20:11     ` Enric Balletbo Serra
2017-06-01  7:01     ` Liam Breck
2017-06-01  8:18       ` Enric Balletbo Serra
2017-06-01 10:25         ` Liam Breck
2017-06-01 10:32           ` Enric Balletbo Serra
2017-05-31 18:50 ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170526110413.24836-2-enric.balletbo@collabora.com \
    --to=enric.balletbo@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@networkimprov.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh@kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.