summaryrefslogtreecommitdiffstats
path: root/include/linux/power
diff options
context:
space:
mode:
authorJonghwa Lee <jonghwa3.lee@samsung.com>2013-12-18 15:42:34 +0900
committerAnton Vorontsov <anton@enomsg.org>2013-12-23 17:09:09 -0800
commit5c49a6256bed52f639ed70d252b1c91d1ab899d6 (patch)
tree8c4d8d6e4fcadc81de02dea26f1a643a2db59399 /include/linux/power
parentd36240d26025bec95f3499e2401a56db98d9f01c (diff)
downloadlinux-5c49a6256bed52f639ed70d252b1c91d1ab899d6.tar.gz
linux-5c49a6256bed52f639ed70d252b1c91d1ab899d6.tar.bz2
linux-5c49a6256bed52f639ed70d252b1c91d1ab899d6.zip
charger-manager: Modify the way of checking battery's temperature
Charger-manager driver used to check battery temperature through the callback function passed by platform data. Unfortunatley, without that pre-defined callback function, charger-manager can't get battery's temperature at all. Also passing callback function through platform data ruins DT support for charger-manager. This patch mondifies charger-manager driver to get temperature of battery without pre-defined callback function. Now, charger-manager can use either of battery thermometer in fuel-gauge and ouside of battery. It uses thermal framework interface for outer thermometer if thermal fw is enabled. Otherwise, it tries to use fuel-gauge's through the power supply interface. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'include/linux/power')
-rw-r--r--include/linux/power/charger-manager.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index 0e86840eb603..9aec0293f204 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -37,6 +37,8 @@ enum cm_event_types {
CM_EVENT_BATT_FULL,
CM_EVENT_BATT_IN,
CM_EVENT_BATT_OUT,
+ CM_EVENT_BATT_OVERHEAT,
+ CM_EVENT_BATT_COLD,
CM_EVENT_EXT_PWR_IN_OUT,
CM_EVENT_CHG_START_STOP,
CM_EVENT_OTHERS,
@@ -173,11 +175,10 @@ struct charger_regulator {
* @num_charger_regulator: the number of entries in charger_regulators
* @charger_regulators: array of charger regulators
* @psy_fuel_gauge: the name of power-supply for fuel gauge
- * @temperature_out_of_range:
- * Determine whether the status is overheat or cold or normal.
- * return_value > 0: overheat
- * return_value == 0: normal
- * return_value < 0: cold
+ * @thermal_zone : the name of thermal zone for battery
+ * @temp_min : Minimum battery temperature for charging.
+ * @temp_max : Maximum battery temperature for charging.
+ * @temp_diff : Temperature diffential to restart charging.
* @measure_battery_temp:
* true: measure battery temperature
* false: measure ambient temperature
@@ -210,7 +211,12 @@ struct charger_desc {
char *psy_fuel_gauge;
- int (*temperature_out_of_range)(int *mC);
+ char *thermal_zone;
+
+ int temp_min;
+ int temp_max;
+ int temp_diff;
+
bool measure_battery_temp;
u64 charging_max_duration_ms;
@@ -226,13 +232,13 @@ struct charger_desc {
* @desc: instance of charger_desc
* @fuel_gauge: power_supply for fuel gauge
* @charger_stat: array of power_supply for chargers
+ * @tzd_batt : thermal zone device for battery
* @charger_enabled: the state of charger
* @fullbatt_vchk_jiffies_at:
* jiffies at the time full battery check will occur.
* @fullbatt_vchk_work: work queue for full battery check
* @emergency_stop:
* When setting true, stop charging
- * @last_temp_mC: the measured temperature in milli-Celsius
* @psy_name_buf: the name of power-supply-class for charger manager
* @charger_psy: power_supply for charger manager
* @status_save_ext_pwr_inserted:
@@ -250,13 +256,15 @@ struct charger_manager {
struct power_supply *fuel_gauge;
struct power_supply **charger_stat;
+#ifdef CONFIG_THERMAL
+ struct thermal_zone_device *tzd_batt;
+#endif
bool charger_enabled;
unsigned long fullbatt_vchk_jiffies_at;
struct delayed_work fullbatt_vchk_work;
int emergency_stop;
- int last_temp_mC;
char psy_name_buf[PSY_NAME_MAX + 1];
struct power_supply charger_psy;