power: supply: charger-manager: Make decisions focussed on battery status
authorJonghwa Lee <jonghwa3.lee@samsung.com>
Thu, 14 May 2020 23:04:31 +0000 (16:04 -0700)
committerSebastian Reichel <sre@kernel.org>
Fri, 28 Aug 2020 17:27:45 +0000 (19:27 +0200)
commite132fc6bb89bd307cfcdb8ba24afcd1985261485
treeda60e52633eaf44c7011e85bfb426e17d4fc3069
parentdfc63825aa15daa1d335e2291741949fd001b782
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>
drivers/power/supply/charger-manager.c
include/linux/power/charger-manager.h