Skip to contentSkip to conversation

charger_manager: update charge profile upon temperature zone change

PATCH Applied Ramakrishna Pallala 2 participants 4 messages May 7, 2012 – Jun 20, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 charger_manager: update charge profile upon temperature zone change

Battery vendors like UER suggest to program Low Charge Voltage in case of high or low temperatures. So a battery can have different charge profile with in the battery operating temperature limits.

Next, there could be events like drop or rise in VBUS voltage in that case we might have to adjust the charge current to stabilize VBUS voltage.

This patch allows the Charger-Manager to adjust the charging parameters upon events like VBUS rise or drop and allows batteries to have multiple charge profiles for different temperature zones.

---
 Documentation/power/charger-manager.txt |   10 ++++++++++
 drivers/power/charger-manager.c         |    6 +++++-
 include/linux/power/charger-manager.h   |    5 +++++
 3 files changed, 20 insertions(+), 1 deletions(-)
Documentation/power/charger-manager.txt +10 -0
index b4f7f4b..6fa2a10 100644
@@ -50,6 +50,15 @@ Charger Manager supports the following:
 	restarts charging. This check is also performed while suspended by
 	setting wakeup time accordingly and using suspend_again.
 
+* Support for adjusting charging parameters
+	Batteries can have different charge profiles with in the battery
+	operating temperature limits. And events like drop or rise in VBUS
+	voltage require adjustment of charge current to stabilize VBUS voltage.
+
+	Charger Manager provides a function pointer "charging_zone_changed" which
+	can be implemented by platform/core drivers and Charger Manager checks
+	this function to update the charger.
+
 * Support for uevent-notify
 	With the charger-related events, the device sends
 	notification to users with UEVENT.
@@ -169,6 +178,7 @@ char *psy_fuel_gauge;
 	: Power-supply-class name of the fuel gauge.
 
 int (*temperature_out_of_range)(int *mC);
+bool (*charging_zone_changed)(int mC);
 bool measure_battery_temp;
 	: This callback returns 0 if the temperature is safe for charging,
 	a positive number if it is too hot to charge, and a negative number
drivers/power/charger-manager.c +5 -1
index 86935ec..9f46353 100644
@@ -424,13 +424,17 @@ static void fullbatt_vchk(struct work_struct *work)
 static bool _cm_monitor(struct charger_manager *cm)
 {
 	struct charger_desc *desc = cm->desc;
+	bool update_charger = false;
 	int temp = desc->temperature_out_of_range(&cm->last_temp_mC);
 
 	dev_dbg(cm->dev, "monitoring (%2.2d.%3.3dC)\n",
 		cm->last_temp_mC / 1000, cm->last_temp_mC % 1000);
 
+	if (desc->charging_zone_changed)
+		update_charger = desc->charging_zone_changed(cm->last_temp_mC);
+
 	/* It has been stopped or charging already */
-	if (!!temp == !!cm->emergency_stop)
+	if ((!!temp == !!cm->emergency_stop) && !update_charger)
 		return false;
 
 	if (temp) {
include/linux/power/charger-manager.h +5 -0
index 241065c..302107d 100644
@@ -90,6 +90,10 @@ struct charger_global_desc {
  *	return_value > 0: overheat
  *	return_value == 0: normal
  *	return_value < 0: cold
+ * @charging_zone_changed:
+ *	Determine whether charge profile need an update
+ *	return_value true if charge profile update required
+ *	return_value false if charge profile update is not required
  * @measure_battery_temp:
  *	true: measure battery temperature
  *	false: measure ambient temperature
@@ -114,6 +118,7 @@ struct charger_desc {
 	char *psy_fuel_gauge;
 
 	int (*temperature_out_of_range)(int *mC);
+	bool (*charging_zone_changed)(int mC);
 	bool measure_battery_temp;
 };
 
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 7 lines · Ramakrishna Pallala

Battery vendors like UER suggest to program Low Charge Voltage in case of high or low temperatures. So a battery can have different charge profile with in the battery operating temperature limits.

Next, there could be events like drop or rise in VBUS voltage in that case we might have to adjust the charge current to stabilize VBUS voltage.

Quoted 6 lines

This patch allows the Charger-Manager to adjust the charging parameters upon events like VBUS rise or drop and allows batteries to have multiple charge profiles for different temperature zones.

---

Applied, thanks a lot!

Signature · 2 lines
Anton Vorontsov
Email: [email protected]
#2 lore raw
Quoted 8 lines · Anton Vorontsov
Quoted 7 lines · Ramakrishna Pallala

Battery vendors like UER suggest to program Low Charge Voltage in case of high or low temperatures. So a battery can have different charge profile with in the battery operating temperature limits.

Next, there could be events like drop or rise in VBUS voltage in that case we might have to adjust the charge current to stabilize VBUS voltage.

Quoted 8 lines
Quoted 6 lines

This patch allows the Charger-Manager to adjust the charging parameters upon events like VBUS rise or drop and allows batteries to have multiple charge profiles for different temperature zones.

---

Applied, thanks a lot!

Oh, actually. I see the feature is still under discussion. I really need some kind of OK/Ack from charger-manager folks before applying.

Thanks,

Signature · 2 lines
Anton Vorontsov
Email: [email protected]
#3 lore raw
Quoted 13 lines
Quoted 7 lines · Ramakrishna Pallala
Quoted 6 lines

Battery vendors like UER suggest to program Low Charge Voltage in case of high or low temperatures. So a battery can have different charge profile with in the battery operating temperature limits.

Next, there could be events like drop or rise in VBUS voltage in that case we might have to adjust the charge current to stabilize VBUS

voltage.

Quoted 5 lines
Quoted 5 lines

This patch allows the Charger-Manager to adjust the charging parameters upon events like VBUS rise or drop and allows batteries to have multiple charge profiles for different temperature zones.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

---

Applied, thanks a lot!

Oh, actually. I see the feature is still under discussion. I really need some kind of OK/Ack from charger-manager folks before applying.

I will come with new patch once we come to a conclusion.

Thanks,
Ram ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�