pd: make source-only PD devices compatible with the common runtime

Add the proper checks to be able to compile source-only PD devices with
the common runtime.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chrome-os-partner:37078
TEST=make buildall
build honeybuns without CONFIG_USB_PD_DUAL_ROLE defined

Change-Id: I7ad0b39b2e62736117ec2d7b5163502afbf14786
Reviewed-on: https://chromium-review.googlesource.com/259112
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Vincent Palatin
2015-03-11 11:44:18 -07:00
committed by ChromeOS Commit Bot
parent 179972d2f9
commit 4c75ac48d3
2 changed files with 11 additions and 5 deletions

View File

@@ -306,9 +306,9 @@ struct mutex pd_crc_lock;
#ifdef CONFIG_COMMON_RUNTIME
static const char * const pd_state_names[] = {
"DISABLED",
"DISABLED", "SUSPENDED",
#ifdef CONFIG_USB_PD_DUAL_ROLE
"SUSPENDED", "SNK_DISCONNECTED", "SNK_DISCONNECTED_DEBOUNCE",
"SNK_DISCONNECTED", "SNK_DISCONNECTED_DEBOUNCE",
"SNK_HARD_RESET_RECOVER",
"SNK_DISCOVERY", "SNK_REQUESTED", "SNK_TRANSITION", "SNK_READY",
"SNK_DR_SWAP", "SNK_SWAP_INIT", "SNK_SWAP_SNK_DISABLE",
@@ -2947,6 +2947,7 @@ int pd_fetch_acc_log_entry(int port)
return EC_RES_SUCCESS;
}
#ifdef CONFIG_USB_PD_DUAL_ROLE
void pd_request_source_voltage(int port, int mv)
{
pd_set_max_voltage(mv);
@@ -2963,6 +2964,7 @@ void pd_request_source_voltage(int port, int mv)
task_wake(PORT_TO_TASK_ID(port));
}
#endif /* CONFIG_USB_PD_DUAL_ROLE */
static int command_pd(int argc, char **argv)
{
@@ -2972,7 +2974,7 @@ static int command_pd(int argc, char **argv)
if (argc < 2)
return EC_ERROR_PARAM_COUNT;
#ifdef CONFIG_CMD_PD
#if defined(CONFIG_CMD_PD) && defined(CONFIG_USB_PD_DUAL_ROLE)
/* command: pd <subcmd> <args> */
if (!strcasecmp(argv[1], "dualrole")) {
if (argc < 3) {
@@ -3052,7 +3054,7 @@ static int command_pd(int argc, char **argv)
return EC_ERROR_PARAM_COUNT;
if (*e || port >= PD_PORT_COUNT)
return EC_ERROR_PARAM2;
#ifdef CONFIG_CMD_PD
#if defined(CONFIG_CMD_PD) && defined(CONFIG_USB_PD_DUAL_ROLE)
if (!strcasecmp(argv[2], "tx")) {
set_state(port, PD_STATE_SNK_DISCOVERY);
@@ -3218,6 +3220,8 @@ DECLARE_CONSOLE_COMMAND(typec, command_typec,
#endif /* CONFIG_CMD_TYPEC */
#endif /* CONFIG_USBC_SS_MUX */
#ifdef HAS_TASK_HOSTCMD
static int hc_pd_ports(struct host_cmd_handler_args *args)
{
struct ec_response_usb_pd_ports *r = args->response;
@@ -3477,4 +3481,6 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_SET_AMODE,
EC_VER_MASK(0));
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
#endif /* HAS_TASK_HOSTCMD */
#endif /* CONFIG_COMMON_RUNTIME */

View File

@@ -580,8 +580,8 @@ struct pd_policy {
enum pd_states {
PD_STATE_DISABLED,
#ifdef CONFIG_USB_PD_DUAL_ROLE
PD_STATE_SUSPENDED,
#ifdef CONFIG_USB_PD_DUAL_ROLE
PD_STATE_SNK_DISCONNECTED,
PD_STATE_SNK_DISCONNECTED_DEBOUNCE,
PD_STATE_SNK_HARD_RESET_RECOVER,