summaryrefslogtreecommitdiff
path: root/board/dingdong
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-01-06 11:00:36 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-15 01:07:02 +0000
commit4e75e20f4ec5cecda6742d821b1a4484952fd07e (patch)
tree210a7f79055092da7b180a27a67f7d3331b339ee /board/dingdong
parent389ef0f90ff9318ced905d7a1ed8c025953aebc3 (diff)
downloadchrome-ec-4e75e20f4ec5cecda6742d821b1a4484952fd07e.tar.gz
Add PD events logging
Add a FIFO to log important events on the PD MCU and coming from the PD accessories. The retrieval of the accessories log from the accessories by the PD MCU is not implemented yet. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:32785 TEST=execute "ectool --name=cros_pd pdlog" before and after plugging Zinger charger. Change-Id: If96d73e711ff6ad64cfb99bd3e4d2d8f2643f19a Reviewed-on: https://chromium-review.googlesource.com/238854 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/dingdong')
-rw-r--r--board/dingdong/board.h2
-rw-r--r--board/dingdong/usb_pd_policy.c13
2 files changed, 13 insertions, 2 deletions
diff --git a/board/dingdong/board.h b/board/dingdong/board.h
index 6247ae5fcc..666ab2699e 100644
--- a/board/dingdong/board.h
+++ b/board/dingdong/board.h
@@ -36,6 +36,8 @@
#define CONFIG_USB_PD_IDENTITY_HW_VERS 1
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
#define CONFIG_USB_PD_NO_VBUS_DETECT
+#define CONFIG_USB_PD_LOGGING
+#define CONFIG_USB_PD_LOG_SIZE 256
#undef CONFIG_WATCHDOG_HELP
#undef CONFIG_LID_SWITCH
#undef CONFIG_TASK_PROFILING
diff --git a/board/dingdong/usb_pd_policy.c b/board/dingdong/usb_pd_policy.c
index 5c14e4a6da..520732cd26 100644
--- a/board/dingdong/usb_pd_policy.c
+++ b/board/dingdong/usb_pd_policy.c
@@ -244,8 +244,17 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
*rpayload = payload;
rsize = pd_custom_flash_vdm(port, cnt, payload);
- if (!rsize)
- return 0;
+ if (!rsize) {
+ int cmd = PD_VDO_CMD(payload[0]);
+ switch (cmd) {
+ case VDO_CMD_GET_LOG:
+ rsize = pd_vdm_get_log_entry(payload);
+ break;
+ default:
+ /* Unknown : do not answer */
+ return 0;
+ }
+ }
/* respond (positively) to the request */
payload[0] |= VDO_SRC_RESPONDER;