diff options
author | Sam Hurst <shurst@google.com> | 2017-01-10 09:55:37 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-01-26 18:43:52 -0800 |
commit | 17515de32c7dffc5a9afd7e365a4dd31b3d3074a (patch) | |
tree | 5957d718301b4c0377906cc3f4a49a501785b918 /board/kevin | |
parent | 7736c887d786c8ee2374dcc2b7fe4a4fc066c9bb (diff) | |
download | chrome-ec-17515de32c7dffc5a9afd7e365a4dd31b3d3074a.tar.gz |
pd: support gotoMin and giveBack
In Sink mode, on the receipt of a GotoMin message,
reduce the current consumption to some minimum level.
BUG=chrome-os-partner:33688
TEST=Manual testing
Used a Kevin, with test routine, to test GotoMin feature
on another Kevin unit.
Test routine:
if (!strcasecmp(argv[2], "gm")) {
ccprintf("send goto min\n");
send_control(port, PD_CTRL_GOTO_MIN);
send_control(port, PD_CTRL_PS_RDY);
}
Kevin with GotoMin feature:
# ectool usbpdpower 0
Port 0: SNK DRP PD 4277mV / 3000mA, max 5000mV / 3000mA / 15000mW
Port 1: Disconnected
After Test routine is executed:
# ectool usbpdpower 0
Port 0: SNK DRP PD 4906mV / 500mA, max 5000mV / 500mA / 2500mW
Port 1: Disconnected
BRANCH=none
Change-Id: Iaac6e19706ceb10ccaff4d602d63fc086c808c8f
Reviewed-on: https://chromium-review.googlesource.com/425728
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/kevin')
-rw-r--r-- | board/kevin/board.h | 4 | ||||
-rw-r--r-- | board/kevin/usb_pd_policy.c | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/board/kevin/board.h b/board/kevin/board.h index 304de3da1e..2985609b75 100644 --- a/board/kevin/board.h +++ b/board/kevin/board.h @@ -141,6 +141,7 @@ #ifdef BOARD_KEVIN #define CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD +#define CONFIG_USB_PD_GIVE_BACK #endif #define PD_OPERATING_POWER_MW 15000 @@ -148,6 +149,9 @@ #define PD_MAX_CURRENT_MA 3000 #define PD_MAX_VOLTAGE_MV 20000 +#define PD_MIN_CURRENT_MA 500 +#define PD_MIN_POWER_MW 2500 + #define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ #define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */ #define PD_VCONN_SWAP_DELAY 5000 /* us */ diff --git a/board/kevin/usb_pd_policy.c b/board/kevin/usb_pd_policy.c index dbd8bceec3..deef42c250 100644 --- a/board/kevin/usb_pd_policy.c +++ b/board/kevin/usb_pd_policy.c @@ -60,6 +60,16 @@ int board_vbus_source_enabled(int port) return vbus_en[port]; } +void pd_snk_give_back(int port, uint32_t * const ma, uint32_t * const mv) +{ + /* Just reduce the current */ + *ma = PD_MIN_CURRENT_MA; + pd_set_input_current_limit(port, *ma, *mv); +#ifdef CONFIG_CHARGE_MANAGER + charge_manager_set_ceil(port, CEIL_REQUESTOR_PD, *ma); +#endif +} + static void board_vbus_update_source_current(int port) { enum gpio_signal gpio = port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN; |