diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2012-09-21 05:49:37 -0400 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-09-21 19:32:40 -0400 |
commit | 3950c7865cd7c963982a2c94457182b96732f4c9 (patch) | |
tree | e5fdab9c3c128362f3ac423d8275dc7b12e7439b /include/linux/power | |
parent | 8fcfe088e21aa0db9d62eaf565757def673efba6 (diff) |
charger-manager: Add support sysfs entry for charger
This patch add support sysfs entry for each charger(regulator).
Charger-manager use one or more chargers for charging battery but some
charger isn't necessary on specific scenario. So, if some charger isn't
needed, can disable specific charger through 'externally_control' entry
while system is on state and confirm the information(name, state) of
charger.
The list of added sysfs entry
- /sys/class/power_supply/battery/chargers/charger.[index]/name
show name of charger(regulator)
- /sys/class/power_supply/battery/chargers/charger.[index]/state
show either enabled or disabled state of charger
- /sys/class/power_supply/battery/chargers/charger.[index]/externally_control
If 'externally_control' of specific charger is 1, Charger-manager cannot
enable regulator for charging when charger cable is attached and charger
must be maintained with disabled state. If 'externally_control' is zero,
Charger-manager usually can control to enable/disable regulator.
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 | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index a7b388ea1588..0e86840eb603 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h | |||
@@ -109,24 +109,43 @@ struct charger_cable { | |||
109 | * struct charger_regulator | 109 | * struct charger_regulator |
110 | * @regulator_name: the name of regulator for using charger. | 110 | * @regulator_name: the name of regulator for using charger. |
111 | * @consumer: the regulator consumer for the charger. | 111 | * @consumer: the regulator consumer for the charger. |
112 | * @externally_control: | ||
113 | * Set if the charger-manager cannot control charger, | ||
114 | * the charger will be maintained with disabled state. | ||
112 | * @cables: | 115 | * @cables: |
113 | * the array of charger cables to enable/disable charger | 116 | * the array of charger cables to enable/disable charger |
114 | * and set current limit according to constratint data of | 117 | * and set current limit according to constratint data of |
115 | * struct charger_cable if only charger cable included | 118 | * struct charger_cable if only charger cable included |
116 | * in the array of charger cables is attached/detached. | 119 | * in the array of charger cables is attached/detached. |
117 | * @num_cables: the number of charger cables. | 120 | * @num_cables: the number of charger cables. |
121 | * @attr_g: Attribute group for the charger(regulator) | ||
122 | * @attr_name: "name" sysfs entry | ||
123 | * @attr_state: "state" sysfs entry | ||
124 | * @attr_externally_control: "externally_control" sysfs entry | ||
125 | * @attrs: Arrays pointing to attr_name/state/externally_control for attr_g | ||
118 | */ | 126 | */ |
119 | struct charger_regulator { | 127 | struct charger_regulator { |
120 | /* The name of regulator for charging */ | 128 | /* The name of regulator for charging */ |
121 | const char *regulator_name; | 129 | const char *regulator_name; |
122 | struct regulator *consumer; | 130 | struct regulator *consumer; |
123 | 131 | ||
132 | /* charger never on when system is on */ | ||
133 | int externally_control; | ||
134 | |||
124 | /* | 135 | /* |
125 | * Store constraint information related to current limit, | 136 | * Store constraint information related to current limit, |
126 | * each cable have different condition for charging. | 137 | * each cable have different condition for charging. |
127 | */ | 138 | */ |
128 | struct charger_cable *cables; | 139 | struct charger_cable *cables; |
129 | int num_cables; | 140 | int num_cables; |
141 | |||
142 | struct attribute_group attr_g; | ||
143 | struct device_attribute attr_name; | ||
144 | struct device_attribute attr_state; | ||
145 | struct device_attribute attr_externally_control; | ||
146 | struct attribute *attrs[4]; | ||
147 | |||
148 | struct charger_manager *cm; | ||
130 | }; | 149 | }; |
131 | 150 | ||
132 | /** | 151 | /** |