usb: power_smart: Allow CONFIG_USB_PORT_POWER_SMART_PORT_COUNT < 2

Don't require GPIO_USB2_ENABLE to be defined if we have only one port.

BUG=None
TEST=Redefine CONFIG_USB_PORT_POWER_SMART_PORT_COUNT to 1 for reef,
remove GPIO_USB2_ENABLE definition, verify build is successful.
BRANCH=None

Change-Id: I5bfbee48ceabd87bbbd45cb120fda320d5eb1897
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/387926
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2016-09-21 16:09:00 -07:00
committed by chrome-bot
parent 96b7e491e8
commit 576de77c1b

View File

@@ -103,12 +103,18 @@ int usb_charge_ports_enabled(void)
{
int mask = 0;
#if CONFIG_USB_PORT_POWER_SMART_PORT_COUNT >= 1
if (gpio_get_level(GPIO_USB1_ENABLE))
mask |= (1 << 0);
#endif
#if CONFIG_USB_PORT_POWER_SMART_PORT_COUNT >= 2
if (gpio_get_level(GPIO_USB2_ENABLE))
mask |= (1 << 1);
#endif
#if CONFIG_USB_PORT_POWER_SMART_PORT_COUNT >= 3
if (gpio_get_level(GPIO_USB3_ENABLE))
mask |= (1 << 2);
#endif
return mask;
}