summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@google.com>2017-07-31 17:07:47 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-12 19:49:37 +0000
commite401a035620aba9ee371644383eb83d8ed35c86a (patch)
tree3102c4877e197c32ed40cdf26da296ae81031570
parentf452165c2380a74e3929de0cf6655fee88264a8a (diff)
downloadchrome-ec-e401a035620aba9ee371644383eb83d8ed35c86a.tar.gz
PD_CONTROL: add subcommand to power up a TCPC.
add a subcommand to the PD_CONTROL message to power up a specific TCPC. in practice, this typically just takes the TCPC out of sleep mode for cases where sleep mode is controlled by the EC. under the covers, board_set_tcpc_power_mode() gets a weak function definition so we don't need to special case this everywhere. TEST="make buildall" passes; "make tests" passes for reef. BRANCH=none BUG=b:35586895 Change-Id: Ic1ed6a70c79f5e7c78099cd0ceb3dfdc2a0489e0 Signed-off-by: Duncan Laurie <dlaurie@google.com> Original-Commit-Id: 28bfc8037156ba0f9c8189ef6e8b7c8a7d22d4cc Original-Change-Id: Ib50e265d11eca10c3714049d8cfdf2657eff48c1 Original-Signed-off-by: Caveh Jalali <caveh@google.com> Original-Reviewed-on: https://chromium-review.googlesource.com/596796 Original-Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/914658
-rw-r--r--common/usb_pd_protocol.c3
-rw-r--r--include/ec_commands.h3
-rw-r--r--include/usb_pd_tcpm.h8
3 files changed, 13 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 7c66b82d7f..b511aa4dd7 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -3799,6 +3799,9 @@ static int pd_control(struct host_cmd_handler_args *args)
#else
return EC_RES_INVALID_COMMAND;
#endif
+ } else if (cmd->subcmd == PD_CHIP_ON && board_set_tcpc_power_mode) {
+ board_set_tcpc_power_mode(cmd->chip, 1);
+ return EC_RES_SUCCESS;
} else {
return EC_RES_INVALID_COMMAND;
}
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 7f10ee5eda..5797eb58f1 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -4151,7 +4151,8 @@ enum ec_pd_control_cmd {
PD_SUSPEND = 0, /* Suspend the PD chip (EC: stop talking to PD) */
PD_RESUME, /* Resume the PD chip (EC: start talking to PD) */
PD_RESET, /* Force reset the PD chip */
- PD_CONTROL_DISABLE /* Disable further calls to this command */
+ PD_CONTROL_DISABLE, /* Disable further calls to this command */
+ PD_CHIP_ON, /* Power on the PD chip */
};
struct __ec_align1 ec_params_pd_control {
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index 3f231fb3f7..edcd3f5875 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -243,6 +243,14 @@ struct tcpc_config_t {
uint16_t tcpc_get_alert_status(void);
/**
+ * Optional, set the TCPC power mode.
+ *
+ * @param port Type-C port number
+ * @param mode 0: off/sleep, 1: on/awake
+ */
+void board_set_tcpc_power_mode(int port, int mode) __attribute__((weak));
+
+/**
* Initialize TCPC.
*
* @param port Type-C port number