diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-09-10 03:49:34 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-17 01:24:05 +0000 |
commit | 5bc3dc3bbe8f062b39065678638b820de330dee2 (patch) | |
tree | 28144048e475ba5b4d47cb6b24a19db08e02ab9f /common/host_command_pd.c | |
parent | fab7ac3b9a5cc26927b8a40bbbba8049d64b323b (diff) | |
download | chrome-ec-5bc3dc3bbe8f062b39065678638b820de330dee2.tar.gz |
samus: add automatic retries for host commands from EC to PD
Add three retries for EC to PD host commands. With this change,
removed retry mechanism in host_command_pd.c which was a retry
only for the specific EC_CMD_PD_EXCHANGE_STATUS host command.
BUG=chrome-os-partner:32006
BRANCH=none
TEST=Loaded EC code onto samus. Added the following code
for testing failed host commands to samus_pd common/host_command.c
host_command_task():
if ((evt & TASK_EVENT_CMD_PENDING) && pending_args) {
if (i++ != 4)
pending_args->result =
host_command_process(pending_args);
else {
pending_args->result = -7;
i = 0;
}
host_send_response(pending_args);
}
This test code on samus_pd drops one in every five host commands.
With this code, from the EC, I send "pdcmd 0 0", and verified that
1 out of 5 times the EC prints a host command failed code, but then
retries successfully.
Change-Id: Ibf43feefbfc7d791c45c6689b82c66f5d71046ab
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/217461
Reviewed-by: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'common/host_command_pd.c')
-rw-r--r-- | common/host_command_pd.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/common/host_command_pd.c b/common/host_command_pd.c index ecd5e07cf5..444e9e3288 100644 --- a/common/host_command_pd.c +++ b/common/host_command_pd.c @@ -26,7 +26,7 @@ static void pd_exchange_status(void) { struct ec_params_pd_status ec_status; struct ec_response_pd_status pd_status; - int rv = 0, tries = 0; + int rv = 0; /* Send battery state of charge */ if (charge_get_flags() & CHARGE_FLAG_BATT_RESPONSIVE) @@ -34,15 +34,9 @@ static void pd_exchange_status(void) else ec_status.batt_soc = -1; - /* Try 3 times to get the PD MCU status. */ - while (tries++ < 3) { - rv = pd_host_command(EC_CMD_PD_EXCHANGE_STATUS, 0, &ec_status, + rv = pd_host_command(EC_CMD_PD_EXCHANGE_STATUS, 0, &ec_status, sizeof(struct ec_params_pd_status), &pd_status, sizeof(struct ec_response_pd_status)); - if (rv >= 0) - break; - task_wait_event(500*MSEC); - } if (rv < 0) { CPRINTS("Host command to PD MCU failed"); |