diff options
author | Eric Yilun Lin <yllin@chromium.org> | 2020-02-14 09:56:49 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-24 06:17:54 +0000 |
commit | 0792aa6f5cf35f9e3fc1de37f8f4d28de71e2b34 (patch) | |
tree | 4c38942dea075e5545c7c58fb9006d7da854014c /board/servo_v4 | |
parent | 71f97f2c63ef5e7ad2d88645949efea26c23fb3f (diff) | |
download | chrome-ec-0792aa6f5cf35f9e3fc1de37f8f4d28de71e2b34.tar.gz |
servo_v4/pd: support more source voltage to DUT
usbc_action support new subcommand chg which limits the max voltage
of PDOs.
Also, serov_v4 provides more PDOs to the DUT if the adapter supports it,
besides 5, 12, 20V.
BRANCH=servo_v4
BUG=b:140256624
TEST=see servo_v4 provides various kinds of SrcCap to DUT
Change-Id: Ie33a4fcffe7dc2acbfc65e725c46e62a553f98c1
Signed-off-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2055266
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'board/servo_v4')
-rw-r--r-- | board/servo_v4/usb_pd_policy.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c index 13d55231f5..484ab96df0 100644 --- a/board/servo_v4/usb_pd_policy.c +++ b/board/servo_v4/usb_pd_policy.c @@ -92,7 +92,7 @@ * than 5V. */ static const uint16_t pd_src_voltages_mv[] = { - 5000, 9000, 12000, 15000, 20000, + 5000, 9000, 10000, 12000, 15000, 20000, }; static uint32_t pd_src_chg_pdo[ARRAY_SIZE(pd_src_voltages_mv)]; static uint8_t chg_pdo_cnt; @@ -967,9 +967,10 @@ DECLARE_CONSOLE_COMMAND(fakedisconnect, cmd_fake_disconnect, static int cmd_usbc_action(int argc, char *argv[]) { - if (argc != 2) + if (argc != 2 && argc != 3) return EC_ERROR_PARAM_COUNT; + /* TODO(b:140256624): drop *v command if we migrate to chg cmd. */ if (!strcasecmp(argv[1], "5v")) { do_cc(CONFIG_SRC(cc_config)); user_limited_max_mv = 5000; @@ -996,6 +997,25 @@ static int cmd_usbc_action(int argc, char *argv[]) CPRINTF("DRP = %d, host_mode = %d\n", !!(cc_config & CC_ENABLE_DRP), !!(cc_config & CC_ALLOW_SRC)); + } else if (!strcasecmp(argv[1], "chg")) { + int sink_v; + + if (argc != 3) + return EC_ERROR_PARAM2; + + sink_v = atoi(argv[2]); + if (!sink_v) + return EC_ERROR_PARAM2; + + user_limited_max_mv = sink_v * 1000; + do_cc(CONFIG_SRC(cc_config)); + update_ports(); + /* + * TODO(b:140256624): servod captures 'chg SRC' keyword to + * recognize if this command is supported in the firmware. + * Drop this message if when we phase out the usbc_role control. + */ + ccprintf("CHG SRC %dmV\n", user_limited_max_mv); } else { return EC_ERROR_PARAM1; } @@ -1003,5 +1023,5 @@ static int cmd_usbc_action(int argc, char *argv[]) return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(usbc_action, cmd_usbc_action, - "5v|12v|20v|dev|pol0|pol1|drp", + "5v|12v|20v|dev|pol0|pol1|drp|chg x(x=voltage)", "Set Servo v4 type-C port state"); |