summaryrefslogtreecommitdiff
path: root/include/linux/power
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-07 12:29:24 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-07 12:29:24 +0400
commite665faa424a4a782aa986274920c1fc5b76f5560 (patch)
tree2cf64abadecbbeadcffc02cb7671cb593fc45488 /include/linux/power
parentca4da6948bc6a7010ecf916dad528c177dcb9a81 (diff)
parent18766f0936d444fd7ff2e0064bd6e69a89d5c6fc (diff)
downloadlinux-e665faa424a4a782aa986274920c1fc5b76f5560.tar.xz
Merge tag 'for-v3.7' of git://git.infradead.org/battery-2.6
Pull battery updates from Anton Vorontsov: "1. New drivers: - Marvell 88pm860x charger and battery drivers; - Texas Instruments LP8788 charger driver; 2. Two new power supply properties: whether a battery is authentic, and chargers' maximal currents and voltages; 3. A lot of TI LP8727 Charger cleanups; 4. New features for Charger Manager, mainly now we can disable specific regulators; 5. Random fixes and cleanups for other drivers." Fix up trivial conflicts in <linux/mfd/88pm860x.h> * tag 'for-v3.7' of git://git.infradead.org/battery-2.6: (52 commits) pda_power: Remove ac_draw_failed goto and label charger-manager: Add support sysfs entry for charger charger-manager: Support limit of maximum possible charger-manager: Check fully charged state of battery periodically lp8727_charger: More pure cosmetic improvements lp8727_charger: Fix checkpatch warning lp8727_charger: Add description in the private data lp8727_charger: Fix a typo - chg_parm to chg_param lp8727_charger: Make some cosmetic changes in lp8727_delayed_func() lp8727_charger: Clean up lp8727_charger_changed() lp8727_charger: Return if the battery is discharging lp8727_charger: Make lp8727_charger_get_propery() simpler lp8727_charger: Make lp8727_ctrl_switch() inline lp8727_charger: Make lp8727_init_device() shorter lp8727_charger: Clean up lp8727_is_charger_attached() lp8727_charger: Use specific definition lp8727_charger: Clean up lp8727 definitions lp8727_charger: Use the definition rather than enum lp8727_charger: Fix code for getting battery temp lp8727_charger: Clear interrrupts at inital time ...
Diffstat (limited to 'include/linux/power')
-rw-r--r--include/linux/power/charger-manager.h47
1 files changed, 42 insertions, 5 deletions
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index cd22029e32aa..0e86840eb603 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -109,24 +109,43 @@ struct charger_cable {
* struct charger_regulator
* @regulator_name: the name of regulator for using charger.
* @consumer: the regulator consumer for the charger.
+ * @externally_control:
+ * Set if the charger-manager cannot control charger,
+ * the charger will be maintained with disabled state.
* @cables:
* the array of charger cables to enable/disable charger
* and set current limit according to constratint data of
* struct charger_cable if only charger cable included
* in the array of charger cables is attached/detached.
* @num_cables: the number of charger cables.
+ * @attr_g: Attribute group for the charger(regulator)
+ * @attr_name: "name" sysfs entry
+ * @attr_state: "state" sysfs entry
+ * @attr_externally_control: "externally_control" sysfs entry
+ * @attrs: Arrays pointing to attr_name/state/externally_control for attr_g
*/
struct charger_regulator {
/* The name of regulator for charging */
const char *regulator_name;
struct regulator *consumer;
+ /* charger never on when system is on */
+ int externally_control;
+
/*
* Store constraint information related to current limit,
* each cable have different condition for charging.
*/
struct charger_cable *cables;
int num_cables;
+
+ struct attribute_group attr_g;
+ struct device_attribute attr_name;
+ struct device_attribute attr_state;
+ struct device_attribute attr_externally_control;
+ struct attribute *attrs[4];
+
+ struct charger_manager *cm;
};
/**
@@ -140,7 +159,11 @@ struct charger_regulator {
* If it has dropped more than fullbatt_vchkdrop_uV after
* fullbatt_vchkdrop_ms, CM will restart charging.
* @fullbatt_uV: voltage in microvolt
- * If it is not being charged and VBATT >= fullbatt_uV,
+ * If VBATT >= fullbatt_uV, it is assumed to be full.
+ * @fullbatt_soc: state of Charge in %
+ * If state of Charge >= fullbatt_soc, it is assumed to be full.
+ * @fullbatt_full_capacity: full capacity measure
+ * If full capacity of battery >= fullbatt_full_capacity,
* it is assumed to be full.
* @polling_interval_ms: interval in millisecond at which
* charger manager will monitor battery health
@@ -148,7 +171,7 @@ struct charger_regulator {
* Specify where information for existance of battery can be obtained
* @psy_charger_stat: the names of power-supply for chargers
* @num_charger_regulator: the number of entries in charger_regulators
- * @charger_regulators: array of regulator_bulk_data for chargers
+ * @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.
@@ -158,6 +181,13 @@ struct charger_regulator {
* @measure_battery_temp:
* true: measure battery temperature
* false: measure ambient temperature
+ * @charging_max_duration_ms: Maximum possible duration for charging
+ * If whole charging duration exceed 'charging_max_duration_ms',
+ * cm stop charging.
+ * @discharging_max_duration_ms:
+ * Maximum possible duration for discharging with charger cable
+ * after full-batt. If discharging duration exceed 'discharging
+ * max_duration_ms', cm start charging.
*/
struct charger_desc {
char *psy_name;
@@ -168,6 +198,8 @@ struct charger_desc {
unsigned int fullbatt_vchkdrop_ms;
unsigned int fullbatt_vchkdrop_uV;
unsigned int fullbatt_uV;
+ unsigned int fullbatt_soc;
+ unsigned int fullbatt_full_capacity;
enum data_source battery_present;
@@ -180,6 +212,9 @@ struct charger_desc {
int (*temperature_out_of_range)(int *mC);
bool measure_battery_temp;
+
+ u64 charging_max_duration_ms;
+ u64 discharging_max_duration_ms;
};
#define PSY_NAME_MAX 30
@@ -194,8 +229,6 @@ struct charger_desc {
* @charger_enabled: the state of charger
* @fullbatt_vchk_jiffies_at:
* jiffies at the time full battery check will occur.
- * @fullbatt_vchk_uV: voltage in microvolt
- * criteria for full battery
* @fullbatt_vchk_work: work queue for full battery check
* @emergency_stop:
* When setting true, stop charging
@@ -206,6 +239,8 @@ struct charger_desc {
* saved status of external power before entering suspend-to-RAM
* @status_save_batt:
* saved status of battery before entering suspend-to-RAM
+ * @charging_start_time: saved start time of enabling charging
+ * @charging_end_time: saved end time of disabling charging
*/
struct charger_manager {
struct list_head entry;
@@ -218,7 +253,6 @@ struct charger_manager {
bool charger_enabled;
unsigned long fullbatt_vchk_jiffies_at;
- unsigned int fullbatt_vchk_uV;
struct delayed_work fullbatt_vchk_work;
int emergency_stop;
@@ -229,6 +263,9 @@ struct charger_manager {
bool status_save_ext_pwr_inserted;
bool status_save_batt;
+
+ u64 charging_start_time;
+ u64 charging_end_time;
};
#ifdef CONFIG_CHARGER_MANAGER