diff options
author | Todd Broch <tbroch@chromium.org> | 2015-01-16 12:40:15 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-28 11:13:58 +0000 |
commit | 17f68998fbac95976c271e7403ffffc6f9f1aeaf (patch) | |
tree | 37c7132aced900be55868b5df1ef4b0dd2c13242 /util | |
parent | 89479d1fc22d17721f0ab7b9547f20054c870da3 (diff) | |
download | chrome-ec-17f68998fbac95976c271e7403ffffc6f9f1aeaf.tar.gz |
pd: Allow multiple mode entry.
Current simplified implementation allows single mode entry. Specification
allows multiple mode entry and its advantageous for things like flashing RW
while staying in DisplayPort mode on video dongles.
CL adds capability on DFP to track as many alternate modes as supported by the
DFP. Initial mode entered is still the default supported mode ( 1st entry, 1st
opos). Policy manager can then use host command, EC_CMD_USB_PD_SET_AMODE, to
enter additional supported modes.
On the UFP (hoho, dingdong) a small modification to track multiple svid mode
entries was made.
Signed-off-by: Todd Broch <tbroch@chromium.org>
BRANCH=samus
BUG=chrome-os-partner:33946
TEST=manual, On hoho
1. Still successfully enter default mode DP
2. Using ectool's pdsetmode can successfully enter/exit multiple modes.
For example,
# port:1 svid:18d1 opos:1 cmd:1==enter
ectool --name cros_pd pdsetmode 1 0x18d1 1 1
Checking with pdgetmode shows both modes entered.
3. Works across hard & soft resets
4. Can flash via ectool --name cros_pd flashpd 4 <port> <RW image>
5. Still drives external display. With bootarg drm.debug=0x6 and following
command: 'tail -f /var/log/messages | grep "Received HPD" &'
I see HPD assert & deassert when switching between GFU and DP mode.
If both modes entered screen stays lit (after reboot) during write.
Change-Id: I7a21ebea377402eb1b0a0cf1d29df59694e301b1
Reviewed-on: https://chromium-review.googlesource.com/241790
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/util/ectool.c b/util/ectool.c index de1b378fdc..cb7e7e904e 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -876,7 +876,7 @@ static int in_gfu_mode(int *opos, int port) } } - return r->active && (r->opos == *opos); + return r->opos == *opos; } /** @@ -905,6 +905,7 @@ static int enter_gfu_mode(int port) p->port = port; p->svid = USB_VID_GOOGLE; p->opos = opos; + p->cmd = PD_ENTER_MODE; ec_command(EC_CMD_USB_PD_SET_AMODE, 0, p, sizeof(*p), NULL, 0); @@ -1113,8 +1114,9 @@ int cmd_pd_set_amode(int argc, char *argv[]) struct ec_params_usb_pd_set_mode_request *p = (struct ec_params_usb_pd_set_mode_request *)ec_outbuf; - if (argc < 4) { - fprintf(stderr, "Usage: %s <port> <svid> <opos>\n", argv[0]); + if (argc < 5) { + fprintf(stderr, "Usage: %s <port> <svid> <opos> <cmd>\n", + argv[0]); return -1; } @@ -1125,17 +1127,22 @@ int cmd_pd_set_amode(int argc, char *argv[]) } p->svid = strtol(argv[2], &e, 0); - if (e && *e) { + if ((e && *e) || !p->svid) { fprintf(stderr, "Bad svid\n"); return -1; } p->opos = strtol(argv[3], &e, 0); - if (e && *e) { - fprintf(stderr, "Bad mode\n"); + if ((e && *e) || !p->opos) { + fprintf(stderr, "Bad opos\n"); return -1; } + p->cmd = strtol(argv[4], &e, 0); + if ((e && *e) || (p->cmd >= PD_MODE_CMD_COUNT)) { + fprintf(stderr, "Bad cmd\n"); + return -1; + } return ec_command(EC_CMD_USB_PD_SET_AMODE, 0, p, sizeof(*p), NULL, 0); } @@ -1165,10 +1172,10 @@ int cmd_pd_get_amode(int argc, char *argv[]) ec_inbuf, ec_max_insize); if (!r->svid) break; - printf("%cSVID:0x%04x ", (r->active) ? '*' : ' ', + printf("%cSVID:0x%04x ", (r->opos) ? '*' : ' ', r->svid); for (i = 0; i < PDO_MODES; i++) { - printf("%c0x%08x ", (r->active && (r->opos == i + 1)) ? + printf("%c0x%08x ", (r->opos && (r->opos == i + 1)) ? '*' : ' ', r->vdo[i]); } printf("\n"); |