summaryrefslogtreecommitdiff
path: root/board/samus
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-02-11 19:32:15 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-12 23:08:45 +0000
commit96536de3f4c2b942b5c40ac18a2a42d282f98dbf (patch)
tree3c63f70b667905fc65a66445553779ae71e5662e /board/samus
parentabbcf4152946c2a086bde85a2f56db0bbf54996f (diff)
downloadchrome-ec-96536de3f4c2b942b5c40ac18a2a42d282f98dbf.tar.gz
pd_log: Add command to request PD MCU to write a log
When we find that charging is in a wedged state, we may wish to write a PD log entry, but the PD MCU cannot detect such a state on its own. Therefore, add a new command to ask the PD MCU to write a log of a given type, and add a new board-specific custom log event. BUG=chrome-os-partner:36668 TEST=Manual on samus: ./ectool --dev=1 pdwritelog charge 0 ./ectool --dev=1 pdwritelog charge 1 ./ectool --dev=1 pdwritelog 1 0 ./ectool --dev=1 pdwritelog 2 0 ./ectool --dev=1 pdlog Verify log output matches expectation: 2015-02-12 11:12:49.290 P0 SRC 2015-02-12 11:12:49.296 P1 SNK Charger PD 20286mV max 20000mV / 3000mA 2015-02-12 11:12:49.303 P0 New connection 2015-02-12 11:12:49.310 P0 Board-custom event --- END OF LOG -- Also, verify kernel logging of wedged event: [ 181.378420] PDLOG 2015/02/12 19:13:44.019 P0 Event 02 (0000) [] Also, trigger wedged state on Samus and verify log entry is written. BRANCH=Samus Change-Id: I55c7c839cf8300fcd3931dccdaaf16c1065e31a8 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/248981 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/samus')
-rw-r--r--board/samus/extpower.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/board/samus/extpower.c b/board/samus/extpower.c
index 79eb941d18..19f4a5d5ff 100644
--- a/board/samus/extpower.c
+++ b/board/samus/extpower.c
@@ -245,6 +245,22 @@ static int get_boostin_voltage(void)
return ret;
}
+/*
+ * Send command to PD to write a custom persistent log entry indicating that
+ * charging was wedged. Returns pd_host_command success status.
+ */
+static int log_charge_wedged(void)
+{
+ static struct ec_params_pd_write_log_entry log_args;
+
+ log_args.type = PD_EVENT_MCU_BOARD_CUSTOM;
+ log_args.port = 0;
+
+ return pd_host_command(EC_CMD_PD_WRITE_LOG_ENTRY, 0,
+ &log_args,
+ sizeof(struct ec_params_pd_write_log_entry),
+ NULL, 0);
+}
/* Time interval between checking if charge circuit is wedged */
#define CHARGE_WEDGE_CHECK_INTERVAL (2*SECOND)
@@ -320,6 +336,7 @@ static void check_charge_wedged(void)
host_command_pd_send_status(PD_CHARGE_NONE);
charger_disable(1);
charge_circuit_state = CHARGE_CIRCUIT_WEDGED;
+ log_charge_wedged();
CPRINTS("Charge wedged! PROCHOT %02x, Stalled: %d",
prochot_status, charge_stalled_count);