summaryrefslogtreecommitdiff
path: root/include/charge_state_v2.h
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-08-08 10:54:08 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-12 05:11:39 +0000
commit283fe98939fa56c61280529e2f933bedb122a52a (patch)
tree9f23119e61da776c19363b572204071549ae2b0b /include/charge_state_v2.h
parentadbd5a0c9a6749468b7c085029cf5e5a41595dbf (diff)
downloadchrome-ec-283fe98939fa56c61280529e2f933bedb122a52a.tar.gz
samus: ryu: fix charge state machine init of input currentstabilize-6146.B
Currently charge state machine resets input current limit to default every time AC is connected. Problem is by the time charge state machine gets around to setting input current, it could have already been set by successful PD negotiation, and this ends up overriding that value. This fix has the state machine store desired input current limit, as determined from PD negotation or any other place, and send last desired input current limit on AC connect. BUG=chrome-os-partner:24461 BRANCH=none TEST=load on samus, test toggling between "pd 0 dev 5" and "pd 0 dev 20", and test plugging and unplugging zinger numerous times, and verify charger command always gives the expected input current limit based on PD negotiation. Change-Id: I18d8acc9e2085739e783c9c70c682d46bcce7fdb Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211639 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'include/charge_state_v2.h')
-rw-r--r--include/charge_state_v2.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h
index 7f2015dc74..b8503fcc9c 100644
--- a/include/charge_state_v2.h
+++ b/include/charge_state_v2.h
@@ -32,6 +32,7 @@ struct charge_state_data {
enum charge_state_v2 state;
int requested_voltage;
int requested_current;
+ int desired_input_current;
};
/*
@@ -57,5 +58,14 @@ enum ec_status charger_profile_override_get_param(uint32_t param,
enum ec_status charger_profile_override_set_param(uint32_t param,
uint32_t value);
+/**
+ * Set the charge input current limit. This value is stored and sent every
+ * time AC is applied.
+ *
+ * @param ma New input current limit in mA
+ * @return EC_SUCCESS or error
+ */
+int charge_set_input_current_limit(int ma);
+
#endif /* __CROS_EC_CHARGE_STATE_V2_H */