diff options
| author | Chanwoo Choi <cw00.choi@samsung.com> | 2012-07-12 02:03:25 -0400 |
|---|---|---|
| committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-07-13 21:31:13 -0400 |
| commit | bee737bccb03ebd27f2d52706e9aed2fa2c8dcc4 (patch) | |
| tree | bf652913262e9e0504324c090b5893c58c936396 /include/linux/power | |
| parent | 85a392d47cac8fa9258c5609a7b02adade961076 (diff) | |
charger-manager: Use EXTCON Subsystem to detect charger cables for charging
This patch support that charger-manager use EXTCON(External Connector)
Subsystem to detect the state of charger cables for enabling or disabling
charger(regulator) and select the charger cable for charging among
a number of external cable according to policy of H/W board.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'include/linux/power')
| -rw-r--r-- | include/linux/power/charger-manager.h | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index 241065c9ce51..6cb9fbc9a153 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #define _CHARGER_MANAGER_H | 16 | #define _CHARGER_MANAGER_H |
| 17 | 17 | ||
| 18 | #include <linux/power_supply.h> | 18 | #include <linux/power_supply.h> |
| 19 | #include <linux/extcon.h> | ||
| 19 | 20 | ||
| 20 | enum data_source { | 21 | enum data_source { |
| 21 | CM_BATTERY_PRESENT, | 22 | CM_BATTERY_PRESENT, |
| @@ -65,6 +66,62 @@ struct charger_global_desc { | |||
| 65 | }; | 66 | }; |
| 66 | 67 | ||
| 67 | /** | 68 | /** |
| 69 | * struct charger_cable | ||
| 70 | * @extcon_name: the name of extcon device. | ||
| 71 | * @name: the name of charger cable(external connector). | ||
| 72 | * @extcon_dev: the extcon device. | ||
| 73 | * @wq: the workqueue to control charger according to the state of | ||
| 74 | * charger cable. If charger cable is attached, enable charger. | ||
| 75 | * But if charger cable is detached, disable charger. | ||
| 76 | * @nb: the notifier block to receive changed state from EXTCON | ||
| 77 | * (External Connector) when charger cable is attached/detached. | ||
| 78 | * @attached: the state of charger cable. | ||
| 79 | * true: the charger cable is attached | ||
| 80 | * false: the charger cable is detached | ||
| 81 | * @charger: the instance of struct charger_regulator. | ||
| 82 | * @cm: the Charger Manager representing the battery. | ||
| 83 | */ | ||
| 84 | struct charger_cable { | ||
| 85 | const char *extcon_name; | ||
| 86 | const char *name; | ||
| 87 | |||
| 88 | /* The charger-manager use Exton framework*/ | ||
| 89 | struct extcon_specific_cable_nb extcon_dev; | ||
| 90 | struct work_struct wq; | ||
| 91 | struct notifier_block nb; | ||
| 92 | |||
| 93 | /* The state of charger cable */ | ||
| 94 | bool attached; | ||
| 95 | |||
| 96 | struct charger_regulator *charger; | ||
| 97 | struct charger_manager *cm; | ||
| 98 | }; | ||
| 99 | |||
| 100 | /** | ||
| 101 | * struct charger_regulator | ||
| 102 | * @regulator_name: the name of regulator for using charger. | ||
| 103 | * @consumer: the regulator consumer for the charger. | ||
| 104 | * @cables: | ||
| 105 | * the array of charger cables to enable/disable charger | ||
| 106 | * and set current limit according to constratint data of | ||
| 107 | * struct charger_cable if only charger cable included | ||
| 108 | * in the array of charger cables is attached/detached. | ||
| 109 | * @num_cables: the number of charger cables. | ||
| 110 | */ | ||
| 111 | struct charger_regulator { | ||
| 112 | /* The name of regulator for charging */ | ||
| 113 | const char *regulator_name; | ||
| 114 | struct regulator *consumer; | ||
| 115 | |||
| 116 | /* | ||
| 117 | * Store constraint information related to current limit, | ||
| 118 | * each cable have different condition for charging. | ||
| 119 | */ | ||
| 120 | struct charger_cable *cables; | ||
| 121 | int num_cables; | ||
| 122 | }; | ||
| 123 | |||
| 124 | /** | ||
| 68 | * struct charger_desc | 125 | * struct charger_desc |
| 69 | * @psy_name: the name of power-supply-class for charger manager | 126 | * @psy_name: the name of power-supply-class for charger manager |
| 70 | * @polling_mode: | 127 | * @polling_mode: |
| @@ -109,7 +166,7 @@ struct charger_desc { | |||
| 109 | char **psy_charger_stat; | 166 | char **psy_charger_stat; |
| 110 | 167 | ||
| 111 | int num_charger_regulators; | 168 | int num_charger_regulators; |
| 112 | struct regulator_bulk_data *charger_regulators; | 169 | struct charger_regulator *charger_regulators; |
| 113 | 170 | ||
| 114 | char *psy_fuel_gauge; | 171 | char *psy_fuel_gauge; |
| 115 | 172 | ||
