From 576de77c1b02bba2d850fc2d6d9c570d78b8d802 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Wed, 21 Sep 2016 16:09:00 -0700 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/387926 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Aseda Aboagye --- common/usb_port_power_smart.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/usb_port_power_smart.c b/common/usb_port_power_smart.c index 2c1da62f03..7a2af2612b 100644 --- a/common/usb_port_power_smart.c +++ b/common/usb_port_power_smart.c @@ -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; }