summaryrefslogtreecommitdiff
path: root/include/linux/power
diff options
context:
space:
mode:
authorJonghwa Lee <jonghwa3.lee@samsung.com>2020-05-15 02:04:31 +0300
committerSebastian Reichel <sre@kernel.org>2020-08-28 20:27:45 +0300
commite132fc6bb89bd307cfcdb8ba24afcd1985261485 (patch)
treeda60e52633eaf44c7011e85bfb426e17d4fc3069 /include/linux/power
parentdfc63825aa15daa1d335e2291741949fd001b782 (diff)
downloadlinux-e132fc6bb89bd307cfcdb8ba24afcd1985261485.tar.xz
power: supply: charger-manager: Make decisions focussed on battery status
cm_monitor(), where charging management starts, checks various charging condition sequentially to decide next charging operation. However, as it follows sequential process, cascaded if statements, it does some jobs which have already done in the previous stage. This results in a delay in decision making. Moreover, starting point of charging is spread all around which makes maintain code and debugging difficult. Both of the problems mentioned above become clean if it manages battery charging focusing on battery status not following sequential condition checking. Now, cm_monitor() moves battery state diagram and does the optimal operation for current state. As a result, it reduces whole monitoring time almost in half. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'include/linux/power')
-rw-r--r--include/linux/power/charger-manager.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index 3a98837684e3..c127dbe31e49 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -213,6 +213,7 @@ struct charger_desc {
* 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
+ * @battery_status: Current battery status
*/
struct charger_manager {
struct list_head entry;
@@ -232,6 +233,8 @@ struct charger_manager {
u64 charging_start_time;
u64 charging_end_time;
+
+ int battery_status;
};
#endif /* _CHARGER_MANAGER_H */