From 866e8499578263b12a712a06eeda9d7a873a0702 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Mon, 7 Mar 2016 13:07:13 -0800 Subject: pd: Compilation fixes for upcoming board designs - Send host commands to TCPCs based upon CONFIG_HOSTCMD_PD, since boards with off-the-shelf TCPCs will also have a PDCMD task. - Don't log VBUS voltage if we have no VBUS ADC channel. BUG=chrome-os-partner:50819 BRANCH=None TEST=`make buildall -j` with subsequent kevin board commit. Signed-off-by: Shawn Nematbakhsh Change-Id: I33347402ec31e1754ad8e9a62814d5c1f345737d Reviewed-on: https://chromium-review.googlesource.com/331343 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Vincent Palatin --- common/charge_manager.c | 7 ++++++- common/host_command.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/charge_manager.c b/common/charge_manager.c index 6a17d9ee4a..8782d398e3 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -271,7 +271,12 @@ static void charge_manager_fill_power_info(int port, if (r->role == USB_PD_PORT_POWER_SINK_NOT_CHARGING) r->meas.voltage_now = 5000; else - r->meas.voltage_now = adc_read_channel(ADC_VBUS); + if (ADC_VBUS >= 0) + r->meas.voltage_now = + adc_read_channel(ADC_VBUS); + else + /* No VBUS ADC channel - voltage is unknown */ + r->meas.voltage_now = 0; } } #endif /* TEST_BUILD */ diff --git a/common/host_command.c b/common/host_command.c index 0dae3bf036..97b8cc59cc 100644 --- a/common/host_command.c +++ b/common/host_command.c @@ -567,7 +567,7 @@ enum ec_status host_command_process(struct host_cmd_handler_args *args) if (hcdebug) host_command_debug_request(args); -#ifdef HAS_TASK_PDCMD +#ifdef CONFIG_HOSTCMD_PD if (args->command >= EC_CMD_PASSTHRU_OFFSET(1) && args->command <= EC_CMD_PASSTHRU_MAX(1)) { rv = pd_host_command(args->command - EC_CMD_PASSTHRU_OFFSET(1), @@ -738,7 +738,7 @@ static int host_command_get_features(struct host_cmd_handler_args *args) #ifdef CONFIG_PMU_POWERINFO | EC_FEATURE_MASK_0(EC_FEATURE_PMU) #endif -#ifdef HAS_TASK_PDCMD +#ifdef CONFIG_HOSTCMD_PD | EC_FEATURE_MASK_0(EC_FEATURE_SUB_MCU) #endif #ifdef CONFIG_CHARGE_MANAGER -- cgit v1.2.1