lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon,  7 May 2012 22:16:12 +0530
From:	Ramakrishna Pallala <ramakrishna.pallala@...el.com>
To:	linux-kernel@...r.kernel.org
Cc:	Anton Vorontsov <cbouatmailru@...il.com>,
	Anton Vorontsov <anton.vorontsov@...aro.org>,
	MyungJoo Ham <myungjoo.ham@...sung.com>,
	Ramakrishna Pallala <ramakrishna.pallala@...el.com>
Subject: [PATCH] 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.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@...el.com>
---
 drivers/power/charger-manager.c       |    6 +++++-
 include/linux/power/charger-manager.h |    5 +++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 86935ec..9f46353 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -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) {
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index 241065c..302107d 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -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;
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ