summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWonjoon Lee <woojoo.lee@samsung.com>2016-04-28 22:13:24 +0900
committerchrome-bot <chrome-bot@chromium.org>2016-05-05 01:12:24 -0700
commitd6546857dab57079c50ae9f1140941fd8fb37229 (patch)
tree4ed4f93f4b3e6394fdaceb3927b40f6e169364e8 /common
parent3ef613fa4403df1dcb063540553349e092bd8f5d (diff)
downloadchrome-ec-d6546857dab57079c50ae9f1140941fd8fb37229.tar.gz
charge_manager: Always set active charge port on first pass
Always call board_set_active_charge_port() on the first pass through charge_manager_refresh(), in case actions must be taken once the CHARGE_PORT_NONE selection is confirmed. BUG=None BRANCH=None TEST=Attach unpowered peripheral without AC and powerbtn, make sure ap boot-up Change-Id: I4bcf1d548d7a8c80f4395fc90ff499fce33c8373 Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/341076 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/charge_manager.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index fa015086da..02bcbee5e3 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -440,6 +440,8 @@ static void charge_manager_get_best_charge_port(int *new_port,
*/
static void charge_manager_refresh(void)
{
+ /* Always initialize charge port on first pass */
+ static int active_charge_port_initialized;
int new_supplier, new_port;
int new_charge_current, new_charge_current_uncapped;
int new_charge_voltage, i;
@@ -458,9 +460,10 @@ static void charge_manager_refresh(void)
* the port, for example, if the port has become a charge
* source.
*/
- if ((new_port == charge_port &&
- new_supplier == charge_supplier) ||
- board_set_active_charge_port(new_port) == EC_SUCCESS)
+ if ((active_charge_port_initialized &&
+ new_port == charge_port &&
+ new_supplier == charge_supplier) ||
+ board_set_active_charge_port(new_port) == EC_SUCCESS)
break;
/* 'Dont charge' request must be accepted */
@@ -474,6 +477,8 @@ static void charge_manager_refresh(void)
available_charge[i][new_port].current = 0;
}
+ active_charge_port_initialized = 1;
+
/*
* Clear override if it wasn't selected as the 'best' port -- it means
* that no charge is available on the port, or the port was rejected.