summaryrefslogtreecommitdiff
path: root/board/hoho
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/hoho
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/hoho')
-rw-r--r--board/hoho/board.h2
-rw-r--r--board/hoho/usb_pd_policy.c13
2 files changed, 13 insertions, 2 deletions
diff --git a/board/hoho/board.h b/board/hoho/board.h
index 74e3951b53..58dc4db20a 100644
--- a/board/hoho/board.h
+++ b/board/hoho/board.h
@@ -42,6 +42,8 @@
#define CONFIG_USB_PD_INTERNAL_COMP
#define CONFIG_USB_PD_IDENTITY_HW_VERS 1
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
+#define CONFIG_USB_PD_LOGGING
+#define CONFIG_USB_PD_LOG_SIZE 256
#define CONFIG_USB_PD_NO_VBUS_DETECT
/* mcdp2850 serial interface */
#define CONFIG_MCDP28X0 usart3_hw
diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c
index 9ecfd38611..efd1bbc243 100644
--- a/board/hoho/usb_pd_policy.c
+++ b/board/hoho/usb_pd_policy.c
@@ -243,8 +243,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;