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: Ib50e265d11eca10c3714049d8cfdf2657eff48c1
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/596796
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Caveh Jalali
2017-07-31 17:07:47 -07:00
committed by chrome-bot
parent e01813adc7
commit 28bfc80371
3 changed files with 13 additions and 1 deletions

View File

@@ -3915,6 +3915,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;
}

View File

@@ -4179,7 +4179,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 {

View File

@@ -242,6 +242,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.
*