power: charger-manager: Make chraging decision focused on battery status.
authorJonghwa Lee <jonghwa3.lee@samsung.com>
Wed, 22 Oct 2014 02:32:10 +0000 (11:32 +0900)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 03:01:02 +0000 (12:01 +0900)
commit59ec47bda4ba1c0df507b4c6dfd9969af6120373
tree080d997ae3050ba8ec746e482d607dc397be4711
parent361f1558dfc48cab51df9d2194fcb1301dcb65e9
power: charger-manager: Make chraging decision focused on battery status.

In cm_monitor() where charging management starts, it checks various charging
condition sequentially to decide next charging operation. However, as it
follows sequential process, cascade if statements, it does some duplicated
jobs which is already done in previous stage. It results delay in decision
making. And moreover, starting point of charing is spreaded all around, so
it makes maintain codes and debugging difficult.

Both of problems mentioned above becomes clean if it manages battery charging
with focusing battery status not following sequential condition checking.
Now, cm_monitor() moves battery state diagram and does optimal operation for
current state. As a result, it reduces whole monitoring time almost in half.

Change-Id: I1c8cfe57cea6fc8c02a4c0bf7bde6a0d8395b786
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
drivers/power/charger-manager.c
include/linux/power/charger-manager.h