linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2] charger_manager: update charge profile upon temperature zone change
@ 2012-05-08  0:01 MyungJoo Ham
  2012-05-08 17:15 ` Pallala, Ramakrishna
  0 siblings, 1 reply; 8+ messages in thread
From: MyungJoo Ham @ 2012-05-08  0:01 UTC (permalink / raw)
  To: Ramakrishna Pallala, linux-kernel@vger.kernel.org
  Cc: Anton Vorontsov, Anton Vorontsov, 최찬우

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 4956 bytes --]

> 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@intel.com>

I don't see how the parameters are changed when update_charger is true.

Are you intending to do it at userspace after getting uevent_notify()? (I don't think it's good)

If the intension is to update some of the charger-manager internal parameters (struct charger_manager's struct charger_desc) according to the temperature, we'd need a more general method that can also update values in the charger-manager context.

For example, instead of simply putting a callback to determine whether an update is required or not, a table of (including hysterisis) temperatures and values to be updated (or callbacks to update charger_desc based on the temperature) might be a starting point. You may also need to consider using notifier chain w/ temperatures.

Cheers!
MyungJoo.

> ---
>  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(-)
> 
> diff --git a/Documentation/power/charger-manager.txt b/Documentation/power/charger-manager.txt
> index b4f7f4b..6fa2a10 100644
> --- a/Documentation/power/charger-manager.txt
> +++ b/Documentation/power/charger-manager.txt
> @@ -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
> 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
> 
> 
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH v2] charger_manager: update charge profile upon temperature zone change
@ 2012-05-07 17:58 Ramakrishna Pallala
  2012-06-19 23:50 ` Anton Vorontsov
  0 siblings, 1 reply; 8+ messages in thread
From: Ramakrishna Pallala @ 2012-05-07 17:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Anton Vorontsov, Anton Vorontsov, MyungJoo Ham,
	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.

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@intel.com>
---
 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(-)

diff --git a/Documentation/power/charger-manager.txt b/Documentation/power/charger-manager.txt
index b4f7f4b..6fa2a10 100644
--- a/Documentation/power/charger-manager.txt
+++ b/Documentation/power/charger-manager.txt
@@ -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
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


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

end of thread, other threads:[~2012-06-20  3:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-08  0:01 [PATCH v2] charger_manager: update charge profile upon temperature zone change MyungJoo Ham
2012-05-08 17:15 ` Pallala, Ramakrishna
2012-05-09  6:19   ` Tc, Jenny
2012-05-09  6:47     ` Pallala, Ramakrishna
  -- strict thread matches above, loose matches on Subject: below --
2012-05-07 17:58 Ramakrishna Pallala
2012-06-19 23:50 ` Anton Vorontsov
2012-06-20  2:03   ` Anton Vorontsov
2012-06-20  3:39     ` Pallala, Ramakrishna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).